5 Replies Latest reply on Sep 20, 2005 9:58 AM by Thomas Diesler

    SimpleDeserializer Exception

    stw2000 Newbie

      Trying to get a simple webservice running using JBossWS but getting the following exception on the server side. I was testing out a Complex Type with an array.

      org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which
      is NOT expected, in something it was trying to deserialize.


      Current setup:

      JBoss 4.0.3RC2 (we are targeting this release)
      wscompile (wsdp 1.6)

      I'm using Axis 1.2.1 for DII client.

      wsdl

      <?xml version="1.0" encoding="UTF-8"?>
      
      <definitions name="WsTestService" targetNamespace="http://wstest/"
       xmlns:tns="http://wstest/" xmlns="http://schemas.xmlsoap.org/wsdl/"
       xmlns:ns2="http://wstest/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
       <types>
       <schema targetNamespace="http://wstest/types"
       xmlns:tns="http://wstest/types"
       xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
       xmlns="http://www.w3.org/2001/XMLSchema">
       <complexType name="MyMsg">
       <sequence>
       <element name="data" type="string" nillable="true" minOccurs="0"
       maxOccurs="unbounded"/>
       <element name="item1" type="string" nillable="true"/>
       <element name="item2" type="string" nillable="true"/>
       </sequence>
       </complexType>
       </schema>
       </types>
       <message name="WsTestEndpoint_pingMsg">
       <part name="MyMsg_1" type="ns2:MyMsg"/>
       </message>
       <message name="WsTestEndpoint_pingMsgResponse">
       <part name="result" type="ns2:MyMsg"/>
       </message>
       <portType name="WsTestEndpoint">
       <operation name="pingMsg" parameterOrder="MyMsg_1">
       <input message="tns:WsTestEndpoint_pingMsg"/>
       <output message="tns:WsTestEndpoint_pingMsgResponse"/>
       </operation>
       </portType>
       <binding name="WsTestEndpointBinding" type="tns:WsTestEndpoint">
       <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
       style="rpc"/>
       <operation name="pingMsg">
       <soap:operation soapAction=""/>
       <input>
       <soap:body use="literal" namespace="http://wstest/"/>
       </input>
       <output>
       <soap:body use="literal" namespace="http://wstest/"/>
       </output>
       </operation>
       </binding>
       <service name="WsTestService">
       <port name="WsTestEndpointPort" binding="tns:WsTestEndpointBinding">
       <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
       </port>
       </service>
      </definitions>


      mapping.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <java-wsdl-mapping xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd"
       version="1.1">
       <package-mapping>
       <package-type>wstest</package-type>
       <namespaceURI>http://wstest/types</namespaceURI>
       </package-mapping>
       <package-mapping>
       <package-type>wstest</package-type>
       <namespaceURI>http://wstest/</namespaceURI>
       </package-mapping>
       <java-xml-type-mapping>
       <java-type>wstest.MyMsg</java-type>
       <root-type-qname xmlns:typeNS="http://wstest/types">
       typeNS:MyMsg</root-type-qname>
       <qname-scope>complexType</qname-scope>
       <variable-mapping>
       <java-variable-name>data</java-variable-name>
       <xml-element-name>data</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>item1</java-variable-name>
       <xml-element-name>item1</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>item2</java-variable-name>
       <xml-element-name>item2</xml-element-name>
       </variable-mapping>
       </java-xml-type-mapping>
       <service-interface-mapping>
       <service-interface>wstest.WsTestService</service-interface>
       <wsdl-service-name xmlns:serviceNS="http://wstest/">
       serviceNS:WsTestService</wsdl-service-name>
       <port-mapping>
       <port-name>WsTestEndpointPort</port-name>
       <java-port-name>WsTestEndpointPort</java-port-name>
       </port-mapping>
       </service-interface-mapping>
       <service-endpoint-interface-mapping>
       <service-endpoint-interface>
       wstest.WsTestEndpoint</service-endpoint-interface>
       <wsdl-port-type xmlns:portTypeNS="http://wstest/">
       portTypeNS:WsTestEndpoint</wsdl-port-type>
       <wsdl-binding xmlns:bindingNS="http://wstest/">
       bindingNS:WsTestEndpointBinding</wsdl-binding>
       <service-endpoint-method-mapping>
       <java-method-name>pingMsg</java-method-name>
       <wsdl-operation>pingMsg</wsdl-operation>
       <method-param-parts-mapping>
       <param-position>0</param-position>
       <param-type>wstest.MyMsg</param-type>
       <wsdl-message-mapping>
       <wsdl-message xmlns:wsdlMsgNS="http://wstest/">
       wsdlMsgNS:WsTestEndpoint_pingMsg</wsdl-message>
       <wsdl-message-part-name>MyMsg_1</wsdl-message-part-name>
       <parameter-mode>IN</parameter-mode>
       </wsdl-message-mapping>
       </method-param-parts-mapping>
       <wsdl-return-value-mapping>
       <method-return-value>wstest.MyMsg</method-return-value>
       <wsdl-message xmlns:wsdlMsgNS="http://wstest/">
       wsdlMsgNS:WsTestEndpoint_pingMsgResponse</wsdl-message>
       <wsdl-message-part-name>result</wsdl-message-part-name>
       </wsdl-return-value-mapping>
       </service-endpoint-method-mapping>
       </service-endpoint-interface-mapping>
      </java-wsdl-mapping>
      


      webservices.xml

      <?xml version="1.0" encoding="UTF-8"?>
      
      <webservices xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/j2ee_web_services_1_1.xsd"
       version="1.1">
      
       <webservice-description>
       <icon>
       </icon>
      
       <webservice-description-name>WsTestService</webservice-description-name>
      
       <wsdl-file>META-INF/wsdl/WsTestService.wsdl</wsdl-file>
       <jaxrpc-mapping-file>META-INF/wstest-mapping.xml</jaxrpc-mapping-file>
      
       <port-component>
      
       <icon>
       </icon>
      
       <port-component-name>WsTestEndpoint</port-component-name>
       <wsdl-port>WsTestEndpointPort</wsdl-port>
       <service-endpoint-interface>
       wstest.WsTestEndpoint</service-endpoint-interface>
       <service-impl-bean>
       <ejb-link>WsTest</ejb-link>
       </service-impl-bean>
       </port-component>
      
       </webservice-description>
      
      </webservices>
      


      
      SessionBean enpoint.
      
      public class WsTestBean implements SessionBean {
      
       public MyMsg pingMsg(MyMsg msg) {
       System.out.println(msg);
       return msg;
       }
      }
      


      Simple data object with String fields and String array.

      
      public class MyMsg implements Serializable {
      
       private String item1;
       private String item2;
       private String[] data;
      
       public MyMsg() {
       }
      
       public String[] getData() {
       return data;
       }
      
       public void setData(String[] data) {
       this.data = data;
       }
      
       public String getItem1() {
       return item1;
       }
      
       public void setItem1(String item1) {
       this.item1 = item1;
       }
      
       public String getItem2() {
       return item2;
       }
      
       public void setItem2(String item2) {
       this.item2 = item2;
       }
      }
      
      


      Axis is generating ths following SOAP message.

      <?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>
       <pingMsg xmlns="http://wstest/">
       <MyMsg_1 xmlns="">
       <data>
       <data>shawn</data>
       <data>white</data>
       </data>
       <item1>ip</item1>
       <item2 xsi:nil="true"/>
       </MyMsg_1>
       </pingMsg>
       </soapenv:Body>
       </soapenv:Envelope>
      


      Basically is seems to fail on the array field. I took the array field out and it worked fine.

      I'm not using a ws4ee-deployment.xml file as the one being auto generated seems fine. Though, I did try it to no avail.

      I belive I've followed all the advice on the WIKI but a bit at a loss why the String[] is not being handled properly.

      Also for some reason Axis is not putting the xmlns value for the parameter, so JBossWS also gives a warning about this (this normal?). Is this possibly the cause?

      Any help would be very appreciated