You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by jocsch <jo...@freaquac.de> on 2005/01/11 21:50:23 UTC
Problem with custom serialization
Hi list,
I have a problem with the serialization of a javabean style object.
Short description: The javabean has an integer field which is not represented
by a <xsd:int> type but instead by a pair of
<level href="#id4"/>
<multiRef id="id4" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
soapenc:arrayType="xsd:anyType[3]" xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">2</multiRef>
Does anybody have an idea how I can change this? Is this possible.
The following snippets are involved:
The called service will return a List of BasePage objects:
public class BasePage {
private String name;
private String id;
//no difference if I use Integer
private int level;
public BasePage() {}
public BasePage(String id, String name, int level) {
this.id = id;
this.name = name;
this.level = new Integer(level);
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
wsdd:
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="guiService" provider="java:RPC">
<parameter name="className" value="com.tst.PageFront"/>
<parameter name="allowedMethods" value="*"/>
<beanMapping qname="freaquac:BasePage" xmlns:freaquac="urn:guiService"
languageSpecificType="java:com.tst.domain.BasePage"/>
</service>
</deployment>
SOAP resonse:
<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>
<ns1:getAllPagesResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://localhost:8787/services/guiService">
<getAllPagesReturn href="#id0"/>
</ns1:getAllPagesResponse>
<multiRef id="id0" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
soapenc:arrayType="xsd:anyType[3]" xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<item href="#id1"/>
<item href="#id2"/>
<item href="#id3"/>
</multiRef>
<multiRef id="id2" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
soapenc:arrayType="xsd:anyType[3]" xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<id xsi:type="soapenc:string">xyz</id>
<level href="#id4"/>
<name xsi:type="soapenc:string">Gemeindehof</name>
</multiRef>
<multiRef id="id1" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
soapenc:arrayType="xsd:anyType[3]" xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<id xsi:type="soapenc:string">xyz</id>
<level href="#id5"/>
<name xsi:type="soapenc:string">Gemeindeaufbau</name>
</multiRef>
<multiRef id="id3" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
soapenc:arrayType="xsd:anyType[3]" xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<id xsi:type="soapenc:string">xyz</id>
<level href="#id6"/>
<name xsi:type="soapenc:string">Gemeindehaus</name>
</multiRef>
<multiRef id="id6" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
soapenc:arrayType="xsd:anyType[3]" xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">3</multiRef>
<multiRef id="id4" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
soapenc:arrayType="xsd:anyType[3]" xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">2</multiRef>
<multiRef id="id5" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
soapenc:arrayType="xsd:anyType[3]" xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1</multiRef>
</soapenv:Body></soapenv:Envelope>
WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace="http://localhost:8787/services/guiService"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://localhost:8787/services/guiService"
xmlns:intf="http://localhost:8787/services/guiService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.2RC2Built on Nov 16, 2004
(12:19:44 EST)-->
<wsdl:types>
<schema
targetNamespace="http://localhost:8787/services/guiService"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://xml.apache.org/xml-soap"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ArrayOf_xsd_anyType">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:anyType[]"/>
</restriction>
</complexContent>
</complexType>
</schema>
<schema targetNamespace="http://xml.apache.org/xml-soap"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://localhost:8787/services/guiService"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="Vector">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item"
type="xsd:anyType"/>
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="getAllPagesRequest">
<wsdl:part name="st" type="soapenc:string"/>
</wsdl:message>
<wsdl:message name="getAllPagesResponse">
<wsdl:part name="getAllPagesReturn"
type="impl:ArrayOf_xsd_anyType"/>
</wsdl:message>
<wsdl:portType name="PageFront">
<wsdl:operation name="getAllPages" parameterOrder="st">
<wsdl:input message="impl:getAllPagesRequest"
name="getAllPagesRequest"/>
<wsdl:output message="impl:getAllPagesResponse"
name="getAllPagesResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="guiServiceSoapBinding" type="impl:PageFront">
<wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getAllPages">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getAllPagesRequest">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://rpcfacade.lzxadmin.ponframe.freaquac.de" use="encoded"/>
</wsdl:input>
<wsdl:output name="getAllPagesResponse">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://localhost:8787/services/guiService" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="PageFrontService">
<wsdl:port binding="impl:guiServiceSoapBinding" name="guiService">
<wsdlsoap:address
location="http://localhost:8787/services/guiService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>