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 Thomas Bahn <tb...@preussag-systemhaus.de> on 2002/07/29 21:33:58 UTC
Non-standard (?) Array in return of SOAP-RPC call
Hi all,
I have a problem with a web service on a SAP Business Connector server,
which I want to use from Java with Axis. I got an wsdl file with a
description of this service, which has complex parameters (arrays of
objects) and a complex return (also some arrays of objects). I used
WSDL2Java to generate some classes, which I modified to make them work. I
get the call out and get a return, but Axis cannot "understand" it, giving
me a fault.
I cannot register the QName
{http://www.webmethods.com/2001/10/soap/encoding}data, since it had to be
used for different classes: EXTENSIONIN and EXTENSIONOUT. The information,
which class is to be used, is encoded in the tag itself.
How can I handle this? A new deserializer? Can I register the QName in
another way? Has the Bean-/ArrayDeserializer or the DCI to be modified? Or
should I make a proxy, which replaces the offending line in the result in
such a way, that it looks like in the call?
Thanks in advance,
Thomas
Details:
The logged fault:
13400 [main] ERROR org.apache.axis.client.Call - Exception:
org.xml.sax.SAXException: No deserializer defined for array type
{http://www.webmethods.com/2001/10/soap/encoding}data
at
org.apache.axis.encoding.ser.ArrayDeserializer.onStartElement(ArrayDeserializer.java:254)
at
org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:393)
at
org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:870)
at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:199)
at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:644)
at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:235)
at
org.apache.axis.message.RPCElement.getParams(RPCElement.java:259)
at org.apache.axis.client.Call.invoke(Call.java:1806)
at org.apache.axis.client.Call.invoke(Call.java:1711)
at org.apache.axis.client.Call.invoke(Call.java:1251)
at
de.preussag_systemhaus.www.KostenstellenBindingStub.holeKostenstellenliste(KostenstellenBindingStub.java:245)
at WebServiceTest.main(WebServiceTest.java:146)
The problem, as far I understand, is the non-standard (?) return of the
arrayType:
<EXTENSIONIN SOAP-ENC:arrayType="p1:data[1]"
xmlns:p1="http://www.webmethods.com/2001/10/soap/encoding">
<item>
<VALUEPART1 xsi:type="xsd:string">One</VALUEPART1>
<VALUEPART2 xsi:type="xsd:string">Two</VALUEPART2>
</item>
</EXTENSIONIN>
<EXTENSIONOUT SOAP-ENC:arrayType="p1:data[1]"
xmlns:p1="http://www.webmethods.com/2001/10/soap/encoding">
<item>
<VALUEPART1 xsi:type="xsd:string">Three</VALUEPART1>
<VALUEPART2 xsi:type="xsd:string">Four</VALUEPART2>
</item>
</EXTENSIONOUT>
In the call the arrays were encoded like this:
<ns2:EXTENSIONIN xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="ns2:EXTENSIONIN[1]">
<item>
<VALUEPART1 xsi:type="xsd:string">1</VALUEPART1>
<VALUEPART2 xsi:type="xsd:string">2</VALUEPART2>
</item>
</ns2:EXTENSIONIN>
<ns2:EXTENSIONOUT xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="ns2:EXTENSIONOUT[1]">
<item>
<VALUEPART1 xsi:type="xsd:string">3</VALUEPART1>
<VALUEPART2 xsi:type="xsd:string">4</VALUEPART2>
</item>
</ns2:EXTENSIONOUT>
In *BindingStub.java in the constructor(Service):
qName = new
javax.xml.namespace.QName("http://www.preussag-systemhaus.de/notes-sap-abgleich/kostenstellen",
"EXTENSIONIN");
cachedSerQNames.add(qName);
cls = de.preussag_systemhaus.www.EXTENSIONIN.class;
cachedSerClasses.add(cls);
cachedSerFactories.add(beansf);
cachedDeserFactories.add(beandf);
qName = new
javax.xml.namespace.QName("http://www.preussag-systemhaus.de/notes-sap-abgleich/kostenstellen",
"EXTENSIONOUT");
cachedSerQNames.add(qName);
cls = de.preussag_systemhaus.www.EXTENSIONOUT.class;
cachedSerClasses.add(cls);
cachedSerFactories.add(beansf);
cachedDeserFactories.add(beandf);
In *BindingStub.java in the rpc method I added the parameter:
call.addParameter(
new javax.xml.namespace.QName("", "EXTENSIONIN"),
new
javax.xml.namespace.QName("http://www.preussag-systemhaus.de/notes-sap-abgleich/kostenstellen",
"EXTENSIONIN"),
de.preussag_systemhaus.www.EXTENSIONIN[].class,
javax.xml.rpc.ParameterMode.INOUT
);
call.addParameter(
new javax.xml.namespace.QName("", "EXTENSIONOUT"),
new
javax.xml.namespace.QName("http://www.preussag-systemhaus.de/notes-sap-abgleich/kostenstellen",
"EXTENSIONOUT"),
de.preussag_systemhaus.www.EXTENSIONOUT[].class,
javax.xml.rpc.ParameterMode.INOUT
);
In the wsdl file they were descripted as following:
...
<xsd:element ref="EXTENSIONIN" minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element ref="EXTENSIONOUT" minOccurs="0"
maxOccurs="unbounded"/>
...
<xsd:element name="EXTENSIONIN">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="VALUEPART1" type="xsd:string"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="VALUEPART2" type="xsd:string"
minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="EXTENSIONOUT">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="VALUEPART1" type="xsd:string"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="VALUEPART2" type="xsd:string"
minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
THOMAS BAHN
Diplom-Mathematiker
Organisations- und Systemberatung
Preussag
Systemhaus GmbH
Lise-Meitner-Str. 25-29
24223 Raisdorf
Mobil
Telefon
Fax
E-Mail
01 79/9 35 79 16
0 43 07/8 15-2 16
0 43 07/8 15-1 47
tbahn@preussag-systemhaus.de