You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by jo...@ersl.ie on 2009/06/24 12:09:03 UTC

Unable to build client side message with document style

Hi 

I am developing an AXIS 1.4 client for a remote server (AXIS 1.3). The axis 
guide: 
http://ws.apache.org/axis/java/user-guide.html#ServiceStylesRPCDocumentWrapp 
edAndMessage details a message structure (which is similar to what I want): 

  <soap:Body>
    <myNS:PurchaseOrder xmlns:myNS="http://commerce.com/PO">
      <item>SK001</item>
      <quantity>1</quantity>
      <description>Sushi Knife</description>
    </myNS:PurchaseOrder>
  </soap:Body> 

The guide says: 

"For a document style service, this would map to a method like this:
public void method(PurchaseOrder po)" 

However using the stub generated by wsdl2java I am getting a message 
structure like: 

  <soap:Body>
	<method>
		<myNS:PurchaseOrder xmlns:myNS="http://commerce.com/PO">
			<item>SK001</item>
			<quantity>1</quantity>
			<description>Sushi Knife</description>
		</myNS:PurchaseOrder>
	</method>
  </soap:Body>

where I have populated the part passed to the invoke method with an 
org.w3c.dom.Element containing an xml fragment: 

		<myNS:PurchaseOrder xmlns:myNS="http://commerce.com/PO">
			<item>SK001</item>
			<quantity>1</quantity>
			<description>Sushi Knife</description>
		</myNS:PurchaseOrder>
		
wsdl binding is: 

	<wsdl:binding name="....." type="impl:....">
		<wsdlsoap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
		<wsdl:operation name="process">
			<wsdlsoap:operation soapAction=""/>
			<wsdl:input name="processRequest">
				<wsdlsoap:body use="literal"/>
			</wsdl:input>
		
wsdl types: 

	<wsdl:types>
		<schema targetNamespace="......">
			<import namespace="...."/>
			<element name="process" type="xsd:anyType"/>
		</schema>		
		
So in my case I am getting a message on the wire like: 

  <soap:Body>
	<process>
		<myNS:PurchaseOrder xmlns:myNS="http://commerce.com/PO">
			<item>SK001</item>
			<quantity>1</quantity>
			<description>Sushi Knife</description>
		</myNS:PurchaseOrder>
	</process>
  </soap:Body>		 

Where I don't want the process elements
		
Thanks John

Re: Unable to build client side message with document style

Posted by jo...@ersl.ie.
joa@ersl.ie writes: 

> Hi  
> 
> I am developing an AXIS 1.4 client for a remote server (AXIS 1.3). The 
> axis guide: 
> http://ws.apache.org/axis/java/user-guide.html#ServiceStylesRPCDocumentWra 
> pp edAndMessage details a message structure (which is similar to what I 
> want):  
> 
>  <soap:Body>
>    <myNS:PurchaseOrder xmlns:myNS="http://commerce.com/PO">
>      <item>SK001</item>
>      <quantity>1</quantity>
>      <description>Sushi Knife</description>
>    </myNS:PurchaseOrder>
>  </soap:Body>  
> 
> The guide says:  
> 
> "For a document style service, this would map to a method like this:
> public void method(PurchaseOrder po)"  
> 
> However using the stub generated by wsdl2java I am getting a message 
> structure like:  
> 
>  <soap:Body>
> 	<method>
> 		<myNS:PurchaseOrder xmlns:myNS="http://commerce.com/PO">
> 			<item>SK001</item>
> 			<quantity>1</quantity>
> 			<description>Sushi Knife</description>
> 		</myNS:PurchaseOrder>
> 	</method>
>  </soap:Body> 
> 
> where I have populated the part passed to the invoke method with an 
> org.w3c.dom.Element containing an xml fragment:  
> 
> 		<myNS:PurchaseOrder xmlns:myNS="http://commerce.com/PO">
> 			<item>SK001</item>
> 			<quantity>1</quantity>
> 			<description>Sushi Knife</description>
> 		</myNS:PurchaseOrder>
> 		
> wsdl binding is:  
> 
> 	<wsdl:binding name="....." type="impl:....">
> 		<wsdlsoap:binding style="document" 
> transport="http://schemas.xmlsoap.org/soap/http"/>
> 		<wsdl:operation name="process">
> 			<wsdlsoap:operation soapAction=""/>
> 			<wsdl:input name="processRequest">
> 				<wsdlsoap:body use="literal"/>
> 			</wsdl:input>
> 		
> wsdl types:  
> 
> 	<wsdl:types>
> 		<schema targetNamespace="......">
> 			<import namespace="...."/>
> 			<element name="process" type="xsd:anyType"/>
> 		</schema>		
> 		
> So in my case I am getting a message on the wire like:  
> 
>  <soap:Body>
> 	<process>
> 		<myNS:PurchaseOrder xmlns:myNS="http://commerce.com/PO">
> 			<item>SK001</item>
> 			<quantity>1</quantity>
> 			<description>Sushi Knife</description>
> 		</myNS:PurchaseOrder>
> 	</process>
>  </soap:Body>		  
> 
> Where I don't want the process elements
> 		
> Thanks John

Ok I have had a further look at this and my understanding is now that the 
wsdl has a wrapped document style - I.e. that is where the operation name is 
also included as a top level element in the input message (see wsdl below), 
and this is why the operation name (process) is being put into the input 
message. Could someone confirm this from the wdsl below (sensitive stuff 
replaced with ellipses)? 

Thanks John 

<wsdl:definitions targetNamespace=".....">
	<!--WSDL created by Apache Axis version: 1.3 Built on Oct 05, 2005 
(05:23:37 EDT)-->
	<wsdl:types>
		<schema targetNamespace="....">
			<import namespace="...."/>
			<element name="process" type="xsd:anyType"/>
		</schema>
		<schema targetNamespace="....">
			<element name="processReturn" type="xsd:anyType"/>
			<element name="fault" type="xsd:anyType"/>
		</schema>
	</wsdl:types>
	<wsdl:message name="processResponse">
		<wsdl:part element="impl:processReturn" name="processReturn"/>
	</wsdl:message>
	<wsdl:message name="processRequest">
		<wsdl:part element="tns1:process" name="part"/>
	</wsdl:message>
	<wsdl:message name="WebServicesRuntimeException">
		<wsdl:part element="impl:fault" name="fault"/>
	</wsdl:message>
	<wsdl:portType name="WebServiceExceptionLoggingAdapter">
		<wsdl:operation name="process">
			<wsdl:input message="impl:processRequest" name="processRequest"/>
			<wsdl:output message="impl:processResponse" name="processResponse"/>
			<wsdl:fault message="impl:WebServicesRuntimeException" 
name="WebServicesRuntimeException"/>
		</wsdl:operation>
	</wsdl:portType>
	<wsdl:binding name="...." type="impl:WebServiceExceptionLoggingAdapter">
		<wsdlsoap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
		<wsdl:operation name="process">
			<wsdlsoap:operation soapAction=""/>
			<wsdl:input name="processRequest">
				<wsdlsoap:body use="literal"/>
			</wsdl:input>
			<wsdl:output name="processResponse">
				<wsdlsoap:body use="literal"/>
			</wsdl:output>
			<wsdl:fault name="WebServicesRuntimeException">
				<wsdlsoap:fault name="WebServicesRuntimeException" use="literal"/>
			</wsdl:fault>
		</wsdl:operation>
	</wsdl:binding>
	<wsdl:service name="WebServiceExceptionLoggingAdapterService">
		<wsdl:port binding="impl:..." name="....">
		</wsdl:port>
	</wsdl:service>
</wsdl:definitions>