Re: WSIF vs. OracleBPEL , namespace issue

Aleksander Slominski <[email protected]> Tue, 15 Aug 2006 18:54:29 -0400
Newsgroups gmane.comp.apache.webservices.wsif.user
Message-ID <[email protected]>
Aparicio wrote:
> Hi fellow WSIF users.
> I am trying to create a simple client to call BPEL processes through the
> WSIF framework. I  use the Axis SOAP provider, but I seem to be running into
> some namespace issues. The BPEL process has a "process" method that takes in
> a person element consisting of name and address fields. The type is defined
> in an XSD imported into the wsdl. Here's the BPEL process' WSDL definition:
>
> ------------------------------------------------------------
> <definitions
>      name="ConvertPerson"
>      targetNamespace="http://ciber.no/ConvertPerson"
>      xmlns="http://schemas.xmlsoap.org/wsdl/"
>      xmlns:tns="http://ciber.no/ConvertPerson"
>      xmlns:ns1="http://types.ciber.no"
>      xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
>      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>      xmlns:client="http://ciber.no/ConvertPerson"
>     >
>     <types>
>         <xsd:schema xmlns:client="http://ciber.no/ConvertPerson"
> xmlns:ns1="http://types.ciber.no"
> xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
>              xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>             <xsd:import namespace="http://types.ciber.no"
> schemaLocation="Person.xsd"/>
>         </xsd:schema>
>         <xsd:schema xmlns:client="http://ciber.no/ConvertPerson"
> xmlns:ns1="http://types.ciber.no"
>             
> xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>             <xsd:import namespace="http://types.ciber.no"
> schemaLocation="ConvertedPerson.xsd"/>
>         </xsd:schema>
>     </types>
>
>     <message name="ConvertPersonRequestMessage">
>         <part name="payload" element="ns1:person"/>
>     </message>
>     <message name="ConvertPersonResponseMessage">
>         <part name="payload" element="ns1:ConvertedPerson"/>
>     </message>
>     <portType name="ConvertPerson">
>         <operation name="process">
>             <input message="tns:ConvertPersonRequestMessage"/>
>
>             <output message="tns:ConvertPersonResponseMessage"/>
>         </operation>
>     </portType>
>     <binding name="ConvertPersonBinding" type="tns:ConvertPerson">
>         <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>         <operation name="process">
>             <soap:operation style="document" soapAction="process"/>
>             <input>
>                 <soap:body use="literal"/>
>
>             </input>
>             <output>
>                 <soap:body use="literal"/>
>             </output>
>         </operation>
>     </binding>
>     <service name="ConvertPerson">
>         <port name="ConvertPersonPort" binding="tns:ConvertPersonBinding">
>             <soap:address
> location="http://NOLMarApa:9700/orabpel/default/ConvertPerson/1.0"/>
>
>         </port>
>     </service>
>   <plnk:partnerLinkType name="ConvertPerson">
>     <plnk:role name="ConvertPersonProvider">
>       <plnk:portType name="tns:ConvertPerson"/>
>     </plnk:role>
>   </plnk:partnerLinkType>
> </definitions>
> -----------------------------------------------------------------------------------
>
>
>
> Here's the Person.xsd
> ---------------------------------------------------------------
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>             xmlns="http://types.ciber.no"
>             targetNamespace="http://types.ciber.no"
> elementFormDefault="qualified">
>   <xsd:element name="person">
>     <xsd:complexType>
>       <xsd:sequence>
>         <xsd:element name="name" type="xsd:string"/>
>         <xsd:element name="address" type="xsd:string"/>
>       </xsd:sequence>
>     </xsd:complexType>
>   </xsd:element>
>
> </xsd:schema>
> ------------------------------------------------------------------------------------------
>
>
> Here is my java code:
> -----------------------------------------------------------------------------------
> package no.ciber.wsiftest;
>
> import javax.xml.namespace.QName;
>
> import junit.framework.TestCase;
>
> import org.apache.wsif.WSIFMessage;
> import org.apache.wsif.WSIFOperation;
> import org.apache.wsif.WSIFPort;
> import org.apache.wsif.WSIFService;
> import org.apache.wsif.WSIFServiceFactory;
>
> public class Client extends TestCase {
>
> 	
> 		public void testProcess() {
> 			
> 			String wsdlLocation =
> "http://NOLMarApa:9700/orabpel/default/ConvertPerson/1.0/ConvertPerson?wsdl";
> 		
> 			
> 			WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
> 			try {
> 				WSIFService service = factory.getService(wsdlLocation, 
> 						null, 
> 						"ConvertPerson", 
> 						null, 
> 						"ConvertPerson");
> 				
> 				
> 				service.mapType(new QName("http://types.ciber.no","person"),
> Person.class);
> 				service.mapType(new QName("http://types.ciber.no","ConvertedPerson"),
> ConvertedPerson.class);
> 				
> 				
> 				WSIFPort port = service.getPort("ConvertPersonPort");
> 				WSIFOperation operation = port.createOperation("process",
> "PersonConvertRequestMessage", "PersonConvertResponseMessage");
> 				
> 				WSIFMessage inputMessage = operation.createInputMessage();
> 				WSIFMessage outputMessage = operation.createOutputMessage();
> 				WSIFMessage faultMessage = operation.createFaultMessage();
> 				
> 				Person request = new Person();
> 				request.setName("John Doe");
> 				request.setAddress("Mystreet 11");
> 				
> 				inputMessage.setObjectPart("payload", request);
> 				boolean success =
> operation.executeRequestResponseOperation(inputMessage, outputMessage,
> faultMessage);
> 				
> 				if(success== true) {
> 					ConvertedPerson response = (ConvertedPerson)
> outputMessage.getObjectPart("payload");
> 					System.out.println("Recieved: " + response.getResult());
> 				} else {
> 					System.err.println("Something else happened!");
> 				}
> 				
> 			} catch (Exception e) {
> 				e.printStackTrace();
> 			}	
> 			
> 		}
> 		
> 		public static void main(String []args) {
> 			Client client = new Client();
> 			client.testProcess();
> 		}
> 		
> }
>
> -------------------------------------------------------------------------------------------------------
> The Person.java object representing the request element, is a simple
> JavaBean with name and address variables.
>
>
>
> What happens?
>
> When calling the BPEL process using this code, WSIF somehow mixes up the
> namespace of the Person object. A correct request message payload should be:
>
> <person xmlns="http://types.ciber.no"><name>John Doe</name><address>Mystreet
> 11</address></person></part>
>
> However, WSIF produces the following request object:
>
> <person><address>Mystreet 11</address><name>John Doe</name></person>
>
> As shown, WSIF omits the "http://types.ciber.no" namespace in the <person>
> elements. This results in an error since the BPEL process can't resolve the
> xpath expression /ns1:person/ns1:name or ns1:address
>
> This call was made using the 2.0.1_IB3 . The 2.0 version also fails.
>
> Does anyone have a clue what's happening here?
>   

hi Mario,

hard to say - it would be useful to confirm that AXIS1 when used alone
is ending the XML messages you want. you may also want to enable
tracing/logging in WSIF (and AXIS) to see what is going on.

if possible also please try the latest pre-release 2.1.0 version (it
should have more recent AXIS jar used) from

http://people.apache.org/dist/ws/wsif/

thanks,

alek

-- 
The best way to predict the future is to invent it - Alan Kay