I have a web service using JBoss 4.0.2.  I am generating the WSDL and jax-rpc 
mapping file using wscompile in rpc/literal mode.  I am having problems on the 
server with the deserialization of objects that contain arrays of Java Strings. 
 The SOAP message that is being generated by the client seems to use SOAP 
encoding for the arrays, which it shouldn't be. When the server tries to 
deserialize the encoded object, the deserialization fails.  

The error that is thrown is a SAXException with the following message: 
"SimpleDeserializer encountered a child element, which is NOT expected, in 
something it was trying to deserialize."  The element that it is encountering 
is the < item > tag around the array elements.

This seems really basic, but I have googled and have not found anything that 
solves my problem.  Please help!  I'm stumped. 

The Java object that is causing problems:


  | public final class DocumentBean {
  |     private String [] vals;
  |     public DocumentBean() {}
  |     public DocumentBean(String [] vals) { this.vals = vals; }       
  |     public String [] getVals() { return vals; }
  |     public void setVals(String [] vals) { this.vals = vals; }    
  | }
  | 

My wscompile ant task:


  | <wscompile 
  |     fork="true" 
  |     keep="false"
  |     verbose="true" 
  |     base="${tms-build.dir}/classes" 
  |     classpath="${wscompile.classpath}"
  |     server="true"
  |     mapping="${tms-build.dir}/jaxrpc-mapping.xml"
  |     features="rpcliteral,wsi"
  |     config="${tms-resources.dir}/tws/config.xml">
  |     <classpath>
  |             <path refid="wscompile.classpath" />
  |     </classpath>
  | </wscompile>
  | 


The WSDL:

 
  |    <schema targetNamespace="http://document.tws.mycompany.com";
  |     xmlns:tns="http://document.tws.mycompany.com";
  |     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";>
  |       <import namespace="http://document.enterprise.mycompany.com"/>
  |       <import namespace="http://tws.mycompany.com/types"/>
  |       <complexType name="DocumentBean">
  |         <sequence>
  |           <element name="vals" type="string" nillable="true" minOccurs="0" 
maxOccurs="unbounded"/>
  |        </sequence>
  |     </complexType>
  |   </schema>
  | 


The JAX-RPC mapping:


  | <java-type>com.mycompany.tws.document.DocumentBean</java-type>
  | <root-type-qname 
xmlns:typeNS="http://document.tws.mycompany.com";>typeNS:DocumentBean</root-type-qname>
  | <qname-scope>complexType</qname-scope>
  | <variable-mapping>
  | <java-variable-name>vals</java-variable-name>
  | <xml-element-name>vals</xml-element-name>
  | </variable-mapping>
  | </java-xml-type-mapping>
  | 


The SOAP message generated by the client:


  | <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>
  |     <storeDocument xmlns="http://tws.mycompany.com";>
  |       <DocumentBean_1 xmlns="">
  |         <vals><item>phoebe</item></vals>
  |       </DocumentBean_1>
  |     </storeDocument>
  |   </soapenv:Body>
  | </soapenv:Envelope>
  | 


The stack trace on the server when the deserialization fails:


  | 2005-11-19 15:08:10,651 DEBUG 
[org.jboss.axis.encoding.ser.BeanDeserializer] onStartChild: vals
  | 2005-11-19 15:08:10,651 DEBUG 
[org.jboss.axis.encoding.DeserializationContextImpl] Enter:getDeserializer: 
[class=class 
[Ljava.lang.String;,xmlType={http://schemas.xmlsoap.org/soap/encoding/}Array]
  | 2005-11-19 15:08:10,651 DEBUG 
[org.jboss.axis.encoding.DeserializationContextImpl] Exit:getDeserializer: null
  | 2005-11-19 15:08:10,651 DEBUG 
[org.jboss.axis.encoding.ser.BeanDeserializer] Using itemXmlType = 
{http://www.w3.org/2001/XMLSchema}string
  | 2005-11-19 15:08:10,651 DEBUG 
[org.jboss.axis.encoding.DeserializationContextImpl] Enter:getDeserializer: 
[class=class java.lang.String,xmlType={http://www.w3.org/2001/XMLSchema}string]
  | 2005-11-19 15:08:10,651 DEBUG 
[org.jboss.axis.encoding.DeserializationContextImpl] Exit:getDeserializer: 
[EMAIL PROTECTED]
  | 2005-11-19 15:08:10,661 DEBUG 
[org.jboss.axis.encoding.DeserializationContextImpl] Pushing handler [EMAIL 
PROTECTED]
  | 2005-11-19 15:08:10,661 DEBUG 
[org.jboss.axis.encoding.DeserializationContextImpl] Exit: 
DeserializationContextImpl::startElement()
  | 2005-11-19 15:08:10,661 DEBUG 
[org.jboss.axis.encoding.DeserializationContextImpl] Enter: 
DeserializationContextImpl::startElement(, item)
  | 2005-11-19 15:08:10,661 ERROR [org.jboss.axis.providers.java.RPCInvocation] 
org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which 
is NOT expected, in something it was trying to deserialize.
  | org.xml.sax.SAXException: SimpleDeserializer encountered a child element, 
which is NOT expected, in something it was trying to deserialize.
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3908039#3908039

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3908039


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to