You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by William Brogden <wb...@bga.com> on 2001/08/13 00:30:59 UTC

Problem w Custom Serializer

I am trying to implement a custom serializer. I want to serialize
an array of org.w3c.dom.Element objects. In my deployment descriptor
mappings I have:

<isd:mappings>
   <isd:map encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/" 
     xmlns:x="urn:Ch06Pubs" qname="x:booklist"
     javaType="[Lorg.w3c.dom.Element;"
     java2XMLClassName=
       "com.lanw.soapsrvr.ElementArraySerializer"
     xml2JavaClassName=
       "com.lanw.soapsrvr.ElementArraySerializer"
     />     
</isd:mappings>

The client query looks like this:

<SOAP-ENV:Envelope 
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
  xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" 
  xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:getByTopic xmlns:ns1="urn:Publications" 
   SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<elementName xsi:type="xsd:string" 
  
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">Java</elementName>
</ns1:getByTopic>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The method getByTopic is defined as returning Element[]
Other methods in the class return String[] as expected.
The fault message that is returned when the above request is made is:

<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>java.lang.ClassCastException:
[Lorg.w3c.dom.Element;</faultstring>
<faultactor>/soap/servlet/rpcrouter</faultactor>
<detail>
<stackTrace>[SOAPException: faultCode=SOAP-ENV:Server;
msg=java.lang.ClassCastException: [Lorg.w3c.dom.Element;]
	at
org.apache.soap.providers.RPCJavaProvider.invoke(RPCJavaProvider.java:138)
	at
org.apache.soap.server.http.RPCRouterServlet.doPost(RPCRouterServlet.java:287)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
.... long trace snipped

</stackTrace>
</detail>
</SOAP-ENV:Fault>

The custom serializer class is loaded but the
marshal method is never called.


-- 
WBB - wbrogden@lanw.com