I am trying to deserialize a bean which has a Map as a member.
//////
import java.util.Map;
public class Order
{
private String customerName;
private Map m;
public String getCustomerName() { return customerName; }
public void setCustomerName(String name) { customerName = name; }
public Map getM() { return m; }
public void setM(Map name) { m = name; }
}
//////
I deployed a service which returns an array of such beans.
The message was serialized correctly but failed to deserialize on the client
side:
Error : org.xml.sax.SAXException: Unregistered type: interface
java.util.Map
All I did not the client side was to add the standard Bean deserializer for
my bean.
call.addDeserializerFactory(qn,
samples.userguide.example5.Order.class,
new org.apache.axis.encoding.BeanSerializer.BeanSerFactory());
since all I did on the service side was to add the the serializer for the
bean.
<beanMapping qname="myNS:order" xmlns:myNS="urn:BeanService"
languageSpecificType="java:samples.userguide.example5.Order"/>
Somehow, the service knew how to serialize java.util.Map. Here is the mssage
which came across (this was an empty map with no elements):
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:processOrderResponse xmlns:ns1="OrderProcessor">
<processOrderResult href="#id0"/>
</ns1:processOrderResponse>
<multiRef id="id0" SOAP-ENC:root="0" xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="ns2:order[1]"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="urn:BeanService">
<item href="#id1"/>
</multiRef>
<multiRef id="id1" SOAP-ENC:root="0" xsi:type="ns3:order"
xmlns:ns3="urn:BeanService"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<customerName xsi:type="xsd:string">N0</customerName>
<m href="#id2"/>
</multiRef>
<multiRef id="id2" SOAP-ENC:root="0" xsi:type="ns4:Map"
xmlns:ns4="http://xml.apache.org/xml-soap"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>