Hi

I am new to webservices and axis.
I am trying to use axis with tomcat using eclipse wtp plugin to create
webservices.
I create a simple java class that has two methods one returning string
and another returning an array of string. My client is in java is
giving the following error.

Exception:
org.xml.sax.SAXException: SimpleDeserializer encountered a child
element, which is NOT expected, in something it was trying to
deserialize.
       at 
org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:189)
       at 
org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:963)
       at 
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
       at 
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:722)
       at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:233)
       at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)
       at org.apache.axis.client.Call.invoke(Call.java:2272)
       at org.apache.axis.client.Call.invoke(Call.java:2171)
       at org.apache.axis.client.Call.invoke(Call.java:1691)
       at 
com.shantanu.HelloTestSoapBindingStub.getMsgs(HelloTestSoapBindingStub.java:139)
       at com.shantanu.ClientTest.main(ClientTest.java:15)

Though using soap monitor i can see that i am receiving 3 items in the
response. my soap message returned is:

HTTP/1.1 200 OK

Content-Type: text/xml;charset=utf-8

Date: Mon, 02 May 2005 17:05:19 GMT

Server: Apache-Coyote/1.1

Connection: close

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
<soapenv:Body>
<getMsgsResponse xmlns="http://shantanu.com";>
<getMsgsReturn mlns="">
<item>msg1</item>
<item>msg2</item>
<item>msg3</item>
</getMsgsReturn>
</getMsgsResponse>
</soapenv:Body></soapenv:Envelope>
--

my wsdl is.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://shantanu.com";
xmlns:impl="http://shantanu.com"; xmlns:intf="http://shantanu.com";
xmlns:apachesoap="http://xml.apache.org/xml-soap";
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
xmlns="http://schemas.xmlsoap.org/wsdl/";>
<wsdl:types>
 <schema xmlns="http://www.w3.org/2001/XMLSchema";
targetNamespace="http://shantanu.com";>
  <element name="getWelcomeMsg">
   <complexType/>
  </element>
  <element name="getWelcomeMsgResponse">
   <complexType>
    <sequence>
     <element name="getWelcomeMsgReturn" type="xsd:string"/>
    </sequence>
   </complexType>
  </element>
  <element name="getMsgs">
   <complexType/>
  </element>
  <element name="getMsgsResponse">
   <complexType>
    <sequence>
     <element name="getMsgsReturn" type="string" minOccurs="0"
maxOccurs="unbounded"/>
    </sequence>
   </complexType>
  </element>
 </schema>
</wsdl:types>

  <wsdl:message name="getWelcomeMsgResponse">

     <wsdl:part name="parameters" element="impl:getWelcomeMsgResponse"/>

  </wsdl:message>

  <wsdl:message name="getMsgsResponse">

     <wsdl:part name="parameters" element="impl:getMsgsResponse"/>

  </wsdl:message>

  <wsdl:message name="getMsgsRequest">

     <wsdl:part name="parameters" element="impl:getMsgs"/>

  </wsdl:message>

  <wsdl:message name="getWelcomeMsgRequest">

     <wsdl:part name="parameters" element="impl:getWelcomeMsg"/>

  </wsdl:message>

  <wsdl:portType name="HelloTest">

     <wsdl:operation name="getWelcomeMsg">

        <wsdl:input name="getWelcomeMsgRequest"
message="impl:getWelcomeMsgRequest"/>

        <wsdl:output name="getWelcomeMsgResponse"
message="impl:getWelcomeMsgResponse"/>

     </wsdl:operation>

     <wsdl:operation name="getMsgs">

        <wsdl:input name="getMsgsRequest" message="impl:getMsgsRequest"/>

        <wsdl:output name="getMsgsResponse" message="impl:getMsgsResponse"/>

     </wsdl:operation>

  </wsdl:portType>

  <wsdl:binding name="HelloTestSoapBinding" type="impl:HelloTest">

     <wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

     <wsdl:operation name="getWelcomeMsg">

        <wsdlsoap:operation
soapAction="http://localhost:9090/axis/services/HelloTest/getWelcomeMsg"/>

        <wsdl:input name="getWelcomeMsgRequest">

           <wsdlsoap:body use="literal" namespace="http://shantanu.com"/>

        </wsdl:input>

        <wsdl:output name="getWelcomeMsgResponse">

           <wsdlsoap:body use="literal" namespace="http://shantanu.com"/>

        </wsdl:output>

     </wsdl:operation>

     <wsdl:operation name="getMsgs">

        <wsdlsoap:operation
soapAction="http://localhost:9090/axis/services/HelloTest/getMsgs"/>

        <wsdl:input name="getMsgsRequest">

           <wsdlsoap:body use="literal" namespace="http://shantanu.com"/>

        </wsdl:input>

        <wsdl:output name="getMsgsResponse">

           <wsdlsoap:body use="literal" namespace="http://shantanu.com"/>

        </wsdl:output>

     </wsdl:operation>

  </wsdl:binding>

  <wsdl:service name="HelloTestService">

     <wsdl:port name="HelloTest" binding="impl:HelloTestSoapBinding">

        <wsdlsoap:address
location="http://localhost:9090/axis/services/HelloTest"/>

     </wsdl:port>

  </wsdl:service>

</wsdl:definitions>

If i create a client in .net I can receive only first item in the string array.
any comments....

Shantanu Chawla

Graduate Student
Department of Computer Science,
San Diego State University

Reply via email to