• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Array of Complex Type- item tag missing

 
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Friends,
I am using axis 1.2 [Not sure of exact number version], consuming a web service.

Input to the web service has an array of Complex Type.
Array PartName of Arrayof object is "fields" mapping to

hence each item in the array is of type KeyValuePair

When we send soap request, I get the ArrayoFcomplextype partname "fields" in the item part name also

For Example instead of this

We get


Thus giving error in server side, Invalid Element.

Can you help me in this issue.
 
Karthik Rajendiran
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Detailed issue


While Accessing a webservice using axis 1.2, we are sending the input as arrayofComplex Data Type.

ComplexData Type - a Class KeyValuePair.
public class KeyValuePair implements java.io.Serializable {
private java.lang.String key;
private java.lang.String value;
public KeyValuePair() { }

public KeyValuePair(java.lang.String key, java.lang.String value) {
this.key = key;
this.value = value;
}
}

Input to the webservice is array of the above mentioned data Type.

We are expecting the following request.

<?xml version="1.0" encoding="UTF-8"?><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 rocessEvent soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://www.epiphany.com/RP">
<package xsi:type="xsd:string">THREE</package>
<event xsi:type="xsd:string">OfferRequest</event>
<fields soapenc:arrayType="ns1:ArrayOfKeyValuePair[10]" xsi:type="soapenc:Array" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<item href="#id0"/>
<item href="#id1"/>
</fields>
</ns1 rocessEvent>

<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns7:KeyValuePair" xmlns:ns7="http://www.epiphany.com/RP" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<key xsi:type="xsd:string">
SessionId
</key>
<value xsi:type="xsd:string">
1234567890
</value>
</multiRef>

<multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:KeyValuePair" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://www.epiphany.com/RP">
<key xsi:type="xsd:string">
Customer_ID
</key>
<value xsi:type="xsd:string">
</value>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>

Instead we are getting the following

<?xml version="1.0" encoding="UTF-8"?><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 rocessEvent soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://www.epiphany.com/RP">
<package xsi:type="xsd:string">THREE</package>
<event xsi:type="xsd:string">OfferRequest</event>
<fields soapenc:arrayType="ns1:ArrayOfKeyValuePair[10]" xsi:type="soapenc:Array" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<fields href="#id0"/>
<fields href="#id1"/>
</fields>
</ns1 rocessEvent>

<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns7:KeyValuePair" xmlns:ns7="http://www.epiphany.com/RP" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<key xsi:type="xsd:string">
SessionId
</key>
<value xsi:type="xsd:string">
1234567890
</value>
</multiRef>

<multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:KeyValuePair" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://www.epiphany.com/RP">
<key xsi:type="xsd:string">
Customer_ID
</key>
<value xsi:type="xsd:string">
</value>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>


Note the ArrayOfKeyValuePair should have tag named <item> as per soap standards, but we get the parent array tag name in its
element name too. i.e fields tag is replaced for <item tag

HOw to solve this issue and get expected response.

Fyi
We have given the Serializer and Deserializer as below
QName arrayOfKeyValuePairQname = new javax.xml.namespace.QName("http://www.epiphany.com/RP", "ArrayOfKeyValuePair");
QName arrayOfReturnedOffersQname = new javax.xml.namespace.QName("http://www.epiphany.com/RP", "ArrayOfReturnedOffer");
QName keyValuePairQName = new javax.xml.namespace.QName("http://www.epiphany.com/RP", "KeyValuePair");
QName returnedOfferQName = new javax.xml.namespace.QName("http://www.epiphany.com/RP", "ReturnedOffer");


TypeMappingRegistry typeMappingRegistry = service.getTypeMappingRegistry();
TypeMapping map = typeMappingRegistry.getDefaultTypeMapping();

map.register(KeyValuePair[].class, arrayOfKeyValuePairQname,
new ArraySerializerFactory(KeyValuePair[].class, arrayOfKeyValuePairQname),
new ArrayDeserializerFactory());

map.register(KeyValuePair.class, keyValuePairQName,
new BeanSerializerFactory(KeyValuePair.class,
keyValuePairQName), new BeanDeserializerFactory(
KeyValuePair.class, keyValuePairQName));

map.register(ReturnedOffer.class, returnedOfferQName,
new BeanSerializerFactory(ReturnedOffer.class,
returnedOfferQName), new BeanDeserializerFactory (
ReturnedOffer.class, returnedOfferQName));

Still we are not able to get the expected result. Kindly help us ASAP.


WSDL Entry is as follows.
<xsd:complexType name="KeyValuePair">
<xsd:sequence>
<xsd:element name="key" type="xsd:string"/>
<xsd:element name="value" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOfKeyValuePair">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:sequence>
<xsd:element name="item" type="rp:KeyValuePair" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="rp:KeyValuePair[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>

<message name="ProcessEventRequest">
<part name="package" type="xsd:string"/>
<part name="event" type="xsd:string"/>
<part name="fields" type="rp:ArrayOfKeyValuePair"/>
</message>
 
Karthik Rajendiran
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just for Reference.

Same issue is raised as bug in axis jira users community.

https://issues.apache.org/jira/browse/AXIS-2250

https://issues.apache.org/jira/browse/AXIS-2095
reply
    Bookmark Topic Watch Topic
  • New Topic