axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Keese <>
Subject Re: Document/Literal : bad part name in axis server response
Date Fri, 07 Jan 2005 01:38:42 GMT
OK.  I looked over your mail again and I saw a problem.  You are using 
document/literal, right?  For the request, you should have the name of 
the method within your soap body.   And for the response, I'm not sure 
what is correct but I listed my hypothesis below.   (I'm still figuring 
it out myself)

Here's the current request:

>     <soap:Body>
>        <tns:in0>ABC</tns:in0>
>     </soap:Body>
>  </soap:Envelope>
You are calling the method "reverse" with the parameter "in0", right?  I 
think the SOAP body should be:


(I'm not sure about the namespaces though)

Here's the current response

>>  <soapenv:Body>
>>     <in0Return xmlns="">CBA</in0Return>
>>  </soapenv:Body></soapenv:Envelope>
It thinks that in0 is the name of your method, rather than the name of 
the parameter to the method.

To setup the request, you need a schema type with the same name as your 

<schema xmlns=""
targetNamespace="" elementFormDefault="qualified">
  <complexType name="reverse">
      <element name="in0" type="xsd:string"/>

Then you setup a message that just points to the schema type (it's useless but you have to
put it in because that's the way WSDL works):

<wsdl:message name="reverseRequest">
     <wsdl:part name="parameters" element="impl:reverse"/>

I'm not sure how to setup the WSDL with regard to responses.  If you look at
(or other links from,  you will see this:

<s:element name="PostScoreResponse">
      <s:element minOccurs="1" maxOccurs="1" name="PostScoreResult" type="s:boolean"/>

<wsdl:message name="PostScoreSoapOut">
  <wsdl:part name="parameters" element="tns:PostScoreResponse"/>

(Again, the message just points to the schema definition, where the element name is methodName
+ "Response".
I guess that this would produce a response like


It seems like a lot of overhead for one number but I've got a feeling that the clients won't
work unless you structure it like that.  I'm still experimenting though.


Ephemeris Lappis wrote:

>Before i open a bug, i'd like to have the opinion of experts !
>All my last tests around document/literal style let me with troubles. To
>start again with simple things, i have made a basic service to evaluate the
>primary interoperability with my J2ME client. This simple service provides a
>single operation that takes a string, reverses it and return it.
>On the client side, i work with the SUN Wireless toolkit that support the
>JSR172 (web-service for J2ME). Using the axis wsdl i have successfully
>generated the j2me client stubs, and built my midlet to call the web
>service. At run time, the client reports an error in the server response :
>the name of the response part for the return value is not as defined in the
>wsdl descriptor. To be sure, i had made the test again putting the tcp
>monitor in the middle... and it seems the client is right !
>The name of the part in the wsdl is 'reverseReturn' and axis uses
>Is it a bug, or just another mis-interpretation of mine ?
>Thanks to give your opinion before i open an unnecessary bug report...
>Here the java code :
>--- java interface ---
>import java.rmi.Remote;
>import java.rmi.RemoteException;
>public interface StringTool extends Remote {
>	public String reverse(String string) throws RemoteException;
>I have successfully generated the wsdl with the following ant script :
>--- wsdl2java ant script ---
><property name="my.namespace" value="" />
><java2wsdl output="./wsdl/j2me05ws.wsdl"
>           className=""
>           namespace="${my.namespace}"
>           porttypename="StringUtility"
>           serviceportname="StringUtilityPort"
>           serviceelementname="J2ME05"
>           style="DOCUMENT"
>           location="">
>	<classpath>
>		<pathelement location="${}" />
>		<path refid="my.axis.classpath" />
>	</classpath>
>The resulting WSDL, with the expected part names !
>--- WSDL ---
><?xml version="1.0" encoding="UTF-8"?>
><wsdl:definitions targetNamespace=""
><!--WSDL created by Apache Axis version: 1.2RC2
>Built on Nov 16, 2004 (12:19:44 EST)-->
> <wsdl:types>
>  <schema xmlns=""
>targetNamespace="" elementFormDefault="qualified">
>   <element name="in0" type="xsd:string"/>
>   <element name="reverseReturn" type="xsd:string"/>
>  </schema>
> </wsdl:types>
>   <wsdl:message name="reverseRequest">
>      <wsdl:part name="in0" element="impl:in0"/>
>   </wsdl:message>
>   <wsdl:message name="reverseResponse">
>      <wsdl:part name="reverseReturn" element="impl:reverseReturn"/>
>   </wsdl:message>
>   <wsdl:portType name="StringUtility">
>      <wsdl:operation name="reverse" parameterOrder="in0">
>         <wsdl:input name="reverseRequest" message="impl:reverseRequest"/>
>         <wsdl:output name="reverseResponse"
>      </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:binding name="StringUtilityPortSoapBinding"
>      <wsdlsoap:binding style="document"
>      <wsdl:operation name="reverse">
>         <wsdlsoap:operation soapAction=""/>
>         <wsdl:input name="reverseRequest">
>            <wsdlsoap:body use="literal"/>
>         </wsdl:input>
>         <wsdl:output name="reverseResponse">
>            <wsdlsoap:body use="literal"/>
>         </wsdl:output>
>      </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:service name="J2ME05">
>      <wsdl:port name="StringUtilityPort"
>         <wsdlsoap:address location=""/>
>      </wsdl:port>
>   </wsdl:service>
>And now, the dumped http request and response :
>--- request ---
>POST /j2me05ws-ejb/J2ME-05-WS/J2ME05WS HTTP/1.1
>User-Agent: Profile/MIDP-1.0 Configuration/CLDC-1.0
>Content-Language: en-US
>Content-Type: text/xml
>SOAPAction: "
>Content-Length: 315
>Host: localhost
><?xml version="1.0" encoding="utf-8"?>
>   <soap:Envelope xmlns:xsi=""
>      <soap:Body>
>         <tns:in0>ABC</tns:in0>
>      </soap:Body>
>   </soap:Envelope>
>--- response ---
>HTTP/1.1 200 OK
>Set-Cookie: JSESSIONID=75C329A6CED0EE74D896E083043AFA0A; Path=/j2me05ws-ejb
>Content-Type: text/xml;charset=utf-8
>Transfer-Encoding: chunked
>Date: Tue, 21 Dec 2004 14:15:18 GMT
>Server: Apache-Coyote/1.1
><soapenv:Envelope xmlns:soapenv=""
>   <soapenv:Body>
>      <in0Return xmlns="">CBA</in0Return>
>   </soapenv:Body></soapenv:Envelope>

View raw message