[
http://issues.apache.org/jira/browse/AXIS-2143?page=comments#action_12318661 ]
daniel damon commented on AXIS-2143:
------------------------------------
I am having the same problem as Ken. I have created a simple test case that
shows the problem, but first let me try to quantify more exactly when and where
the problem happens.
When an array is returned at the top level of a web service, everything seems
to work perfectly. For example, a service with a method:
public String[] getStringArray()
is handled correctly. WSDL2Java creates a service that happily and correctly
returns the String array.
However, when an array is included in a class that is returned by the service,
the array is not serialized correctly.
For example, the service method:
public MyBean getMyBean()
with MyBean defined as:
public class MyBean {
private String[] myStringArray;
public String[] getMyStringArray() { return myStringArray; }
public void setMyStringArray(String[] s) { myStringArray = s;}
}
does not serialize correctly. As Ken shows above, the array name appears twice
on the line - once for the array, then for each element in the array:
This is what appears on the line:
.......
<getMyBeanResponse xmlns="http://pkg">
<getMyBeanReturn>
<myStringArray>
<myStringArray>this is my first string</myStringArray>
<myStringArray>this is my second string</myStringArray>
</myStringArray>
..........
In my case, MyBean is in a different package (namespace), which may or may not
make a difference.
Here is the appropriate part of the wsdl that was used by WSDL2Java to generate
the service:
<element name="getMyBeanResponse">
<complexType>
<sequence>
<element name="getMyBeanReturn" type="tns2:MyBean"/>
</sequence>
</complexType>
</element>
.......
<complexType name="MyBean">
<sequence>
<element maxOccurs="unbounded" name="myStringArray" nillable="true"
type="xsd:string"/>
</sequence>
</complexType>
However, I did notice that the wsdl that the service generates is
significantly different than the original wsdl. The appropriate parts are:
<element name="getMyBeanResponse">
<complexType>
<sequence>
<element name="getMyBeanReturn" type="tns1:MyBean" />
</sequence>
</complexType>
.......
<complexType name="MyBean">
<sequence>
<element name="myStringArray" nillable="true" type="impl:ArrayOf_xsd_string"
/>
<element name="oneInt" type="xsd:int" />
</sequence>
</complexType>
......
<complexType name="ArrayOf_xsd_string">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:string" />
</sequence>
</complexType>
Hope this helps. I will also post the entire example source code
> Array serialization error with multiple namespaces
> --------------------------------------------------
>
> Key: AXIS-2143
> URL: http://issues.apache.org/jira/browse/AXIS-2143
> Project: Apache Axis
> Type: Bug
> Components: Serialization/Deserialization
> Versions: 1.2.1
> Environment: Axis 1.2.1 and also latest build of 1.3 running under websphere
> on windows xp. JDK 1.3.
> Reporter: Ken Katsma
>
> Tthe problem still exists with multiple namespaces. For the following wsdl I
> get an incorrect response of:
> <getCoverageTeamByEcidResponse
> xmlns="http://coverage.pw.services.crm.jpmorgan.com">
> <getCoverageTeamByEcidReturn>
> <coverageTeamInfoTO>
> <coverageTeamInfoTO>
> <cvrRoleTmrDs xsi:nil="true"/>
> Notice the extra TO entry. It should look like:
> <getCoverageTeamByEcidResponse
> xmlns="http://coverage.pw.services.crm.jpmorgan.com">
> <getCoverageTeamByEcidReturn>
> <coverageTeamInfoTO>
> <item>
> <cvrRoleTmrDs xsi:nil="true"/>
> Here is the wsdl:
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions
> targetNamespace="http://contact.pw.services.crm.jpmorgan.com"
> xmlns:apachesoap="http://xml.apache.org/xml-soap"
> xmlns:impl="http://contact.pw.services.crm.jpmorgan.com"
> xmlns:intf="http://contact.pw.services.crm.jpmorgan.com"
> xmlns:tns2="http://request.contact.pw.services.crm.jpmorgan.com"
> xmlns:tns3="http://headers.message.framework.core.crm.jpmorgan.com"
> xmlns:tns4="http://response.contact.pw.services.crm.jpmorgan.com"
> xmlns:tns5="http://to.pw.services.crm.jpmorgan.com"
> 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.3
> Built on Jul 26, 2005 (04:05:35 GMT+00:00)-->
> <wsdl:types>
> <schema elementFormDefault="qualified"
> targetNamespace="http://contact.pw.services.crm.jpmorgan.com"
> xmlns="http://www.w3.org/2001/XMLSchema">
> <import namespace="http://to.pw.services.crm.jpmorgan.com"/>
> <import namespace="http://response.contact.pw.services.crm.jpmorgan.com"/>
> <import
> namespace="http://headers.message.framework.core.crm.jpmorgan.com"/>
> <import namespace="http://request.contact.pw.services.crm.jpmorgan.com"/>
> <element name="getContactByEcid">
> <complexType>
> <sequence>
> <element name="request" type="tns2:GetContactByEcidRequest"/>
> </sequence>
> </complexType>
> </element>
> <complexType name="ArrayOf_tns3_SortDetail">
> <sequence>
> <element maxOccurs="unbounded" minOccurs="0" name="item"
> type="tns3:SortDetail"/>
> </sequence>
> </complexType>
> <element name="getContactByEcidResponse">
> <complexType>
> <sequence>
> <element name="getContactByEcidReturn"
> type="tns4:GetContactByEcidResponse"/>
> </sequence>
> </complexType>
> </element>
> <complexType name="ArrayOf_tns3_ErrorIdentifier">
> <sequence>
> <element maxOccurs="unbounded" minOccurs="0" name="item"
> type="tns3:ErrorIdentifier"/>
> </sequence>
> </complexType>
> <complexType name="ArrayOf_tns5_ClientContactTO">
> <sequence>
> <element maxOccurs="unbounded" minOccurs="0" name="item"
> type="tns5:ClientContactTO"/>
> </sequence>
> </complexType>
> </schema>
> <schema elementFormDefault="qualified"
> targetNamespace="http://headers.message.framework.core.crm.jpmorgan.com"
> xmlns="http://www.w3.org/2001/XMLSchema">
> <import namespace="http://to.pw.services.crm.jpmorgan.com"/>
> <import namespace="http://response.contact.pw.services.crm.jpmorgan.com"/>
> <import namespace="http://request.contact.pw.services.crm.jpmorgan.com"/>
> <import namespace="http://contact.pw.services.crm.jpmorgan.com"/>
> <complexType name="SortDetail">
> <sequence>
> <element name="sortColumn" nillable="true" type="xsd:string"/>
> <element name="sortOrder" nillable="true" type="xsd:string"/>
> </sequence>
> </complexType>
> <complexType name="PagingRequestDetail">
> <sequence>
> <element name="endRow" type="xsd:int"/>
> <element name="maxRow" type="xsd:int"/>
> <element name="sortDetail" nillable="true"
> type="impl:ArrayOf_tns3_SortDetail"/>
> <element name="startRow" type="xsd:int"/>
> </sequence>
> </complexType>
> <complexType name="RequestHeader">
> <sequence>
> <element name="applicationLineOfBusinessRoleIdentifier" nillable="true"
> type="xsd:string"/>
> <element name="requestingAppID" nillable="true" type="xsd:string"/>
> <element name="submitTime" nillable="true" type="xsd:string"/>
> <element name="trackingID" nillable="true" type="xsd:string"/>
> <element name="workerStandardIdentifier" nillable="true"
> type="xsd:string"/>
> </sequence>
> </complexType>
> <complexType name="Request">
> <sequence>
> <element name="pagingRequestDetail" nillable="true"
> type="tns3:PagingRequestDetail"/>
> <element name="requestHeader" nillable="true"
> type="tns3:RequestHeader"/>
> <element name="scope" nillable="true" type="xsd:string"/>
> </sequence>
> </complexType>
> <complexType name="PagingResponseDetail">
> <sequence>
> <element name="rowReturned" type="xsd:int"/>
> <element name="totalRowAvailable" type="xsd:int"/>
> </sequence>
> </complexType>
> <complexType name="ErrorIdentifier">
> <sequence>
> <element name="key" nillable="true" type="xsd:string"/>
> <element name="value" nillable="true" type="xsd:string"/>
> </sequence>
> </complexType>
> <complexType name="ErrorDetail">
> <sequence>
> <element name="applicationErrorCode" nillable="true" type="xsd:string"/>
> <element name="applicationErrorID" nillable="true" type="xsd:string"/>
> <element name="applicationErrorMsg" nillable="true" type="xsd:string"/>
> <element name="errorIdentifier" nillable="true"
> type="impl:ArrayOf_tns3_ErrorIdentifier"/>
> <element name="systemErrorCode" nillable="true" type="xsd:string"/>
> <element name="systemErrorMsg" nillable="true" type="xsd:string"/>
> </sequence>
> </complexType>
> <complexType name="ResponseHeader">
> <sequence>
> <element name="errorDetail" nillable="true" type="tns3:ErrorDetail"/>
> <element name="responseStatus" nillable="true" type="xsd:string"/>
> <element name="submitTime" nillable="true" type="xsd:string"/>
> <element name="successStatusCode" nillable="true" type="xsd:string"/>
> <element name="trackingID" nillable="true" type="xsd:string"/>
> </sequence>
> </complexType>
> <complexType name="Response">
> <sequence>
> <element name="pagingResponseDetail" nillable="true"
> type="tns3:PagingResponseDetail"/>
> <element name="responseHeader" nillable="true"
> type="tns3:ResponseHeader"/>
> </sequence>
> </complexType>
> </schema>
> <schema elementFormDefault="qualified"
> targetNamespace="http://request.contact.pw.services.crm.jpmorgan.com"
> xmlns="http://www.w3.org/2001/XMLSchema">
> <import namespace="http://to.pw.services.crm.jpmorgan.com"/>
> <import namespace="http://response.contact.pw.services.crm.jpmorgan.com"/>
> <import
> namespace="http://headers.message.framework.core.crm.jpmorgan.com"/>
> <import namespace="http://contact.pw.services.crm.jpmorgan.com"/>
> <complexType name="GetContactByEcidRequest">
> <complexContent>
> <extension base="tns3:Request">
> <sequence>
> <element name="ecid" nillable="true" type="xsd:string"/>
> </sequence>
> </extension>
> </complexContent>
> </complexType>
> </schema>
> <schema elementFormDefault="qualified"
> targetNamespace="http://to.pw.services.crm.jpmorgan.com"
> xmlns="http://www.w3.org/2001/XMLSchema">
> <import namespace="http://response.contact.pw.services.crm.jpmorgan.com"/>
> <import
> namespace="http://headers.message.framework.core.crm.jpmorgan.com"/>
> <import namespace="http://request.contact.pw.services.crm.jpmorgan.com"/>
> <import namespace="http://contact.pw.services.crm.jpmorgan.com"/>
> <complexType name="ClientContactTO">
> <sequence>
> <element name="addressCity" nillable="true" type="xsd:string"/>
> <element name="addressCode" nillable="true" type="xsd:string"/>
> <element name="addressCountryCode" nillable="true" type="xsd:string"/>
> <element name="addressId" nillable="true" type="xsd:string"/>
> <element name="addressLine1" nillable="true" type="xsd:string"/>
> <element name="addressLine2" nillable="true" type="xsd:string"/>
> <element name="addressLine3" nillable="true" type="xsd:string"/>
> <element name="addressPostalCode" nillable="true" type="xsd:string"/>
> <element name="addressStateCode" nillable="true" type="xsd:string"/>
> <element name="clientId" nillable="true" type="xsd:string"/>
> <element name="commEmail" nillable="true" type="xsd:string"/>
> <element name="commTypeCode" nillable="true" type="xsd:string"/>
> <element name="commTypeId" nillable="true" type="xsd:string"/>
> <element name="commWokePhone" nillable="true" type="xsd:string"/>
> <element name="commWorkFax" nillable="true" type="xsd:string"/>
> <element name="commWorkFaxExt" nillable="true" type="xsd:string"/>
> <element name="commWorkPhoneExt" nillable="true" type="xsd:string"/>
> <element name="contactDeleteInd" nillable="true" type="xsd:string"/>
> <element name="contactFirstName" nillable="true" type="xsd:string"/>
> <element name="contactId" nillable="true" type="xsd:string"/>
> <element name="contactInactiveInd" nillable="true" type="xsd:string"/>
> <element name="contactLastName" nillable="true" type="xsd:string"/>
> <element name="contactMiddleName" nillable="true" type="xsd:string"/>
> <element name="contactPrefixCode" nillable="true" type="xsd:string"/>
> <element name="contactPrimaryInd" nillable="true" type="xsd:string"/>
> <element name="contactSalutation" nillable="true" type="xsd:string"/>
> <element name="contactSuffix" nillable="true" type="xsd:string"/>
> <element name="contactTitle" nillable="true" type="xsd:string"/>
> <element name="ecid" nillable="true" type="xsd:string"/>
> </sequence>
> </complexType>
> </schema>
> <schema elementFormDefault="qualified"
> targetNamespace="http://response.contact.pw.services.crm.jpmorgan.com"
> xmlns="http://www.w3.org/2001/XMLSchema">
> <import namespace="http://to.pw.services.crm.jpmorgan.com"/>
> <import
> namespace="http://headers.message.framework.core.crm.jpmorgan.com"/>
> <import namespace="http://request.contact.pw.services.crm.jpmorgan.com"/>
> <import namespace="http://contact.pw.services.crm.jpmorgan.com"/>
> <complexType name="GetContactByEcidResponse">
> <complexContent>
> <extension base="tns3:Response">
> <sequence>
> <element name="clientContactTO" nillable="true"
> type="impl:ArrayOf_tns5_ClientContactTO"/>
> </sequence>
> </extension>
> </complexContent>
> </complexType>
> </schema>
> </wsdl:types>
> <wsdl:message name="getContactByEcidResponse">
> <wsdl:part element="impl:getContactByEcidResponse" name="parameters"/>
> </wsdl:message>
> <wsdl:message name="getContactByEcidRequest">
> <wsdl:part element="impl:getContactByEcid" name="parameters"/>
> </wsdl:message>
> <wsdl:portType name="GetContactByEcid">
> <wsdl:operation name="getContactByEcid">
> <wsdl:input message="impl:getContactByEcidRequest"
> name="getContactByEcidRequest"/>
> <wsdl:output message="impl:getContactByEcidResponse"
> name="getContactByEcidResponse"/>
> </wsdl:operation>
> </wsdl:portType>
> <wsdl:binding name="GetContactByEcidSoapBinding"
> type="impl:GetContactByEcid">
> <wsdlsoap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsdl:operation name="getContactByEcid">
> <wsdlsoap:operation soapAction=""/>
> <wsdl:input name="getContactByEcidRequest">
> <wsdlsoap:body use="literal"/>
> </wsdl:input>
> <wsdl:output name="getContactByEcidResponse">
> <wsdlsoap:body use="literal"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:service name="GetContactByEcidService">
> <wsdl:port binding="impl:GetContactByEcidSoapBinding"
> name="GetContactByEcid">
> <wsdlsoap:address
> location="http://localhost:2000/PWServicesWEB/services/GetContactByEcid"/>
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
> ----------------------------------------------------------------------------------------------------------
> I can get a correct response if I remove all the extra namespaces and
> collapse my objects into a single namespace like this:
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions
> targetNamespace="http://coverage.pw.services.crm.jpmorgan.com"
> xmlns:apachesoap="http://xml.apache.org/xml-soap"
> xmlns:impl="http://coverage.pw.services.crm.jpmorgan.com"
> 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.2.1
> Built on Jun 15, 2005 (04:05:16 GMT+00:00)-->
> <wsdl:types>
> <schema elementFormDefault="qualified"
> targetNamespace="http://coverage.pw.services.crm.jpmorgan.com"
> xmlns="http://www.w3.org/2001/XMLSchema">
> <element name="getCoverageTeamByEcid">
> <complexType>
> <sequence>
> <element name="request" type="impl:GetCoverageTeamByEcidRequest"/>
> </sequence>
> </complexType>
> </element>
> <complexType name="ArrayOf_impl_SortDetail">
> <sequence>
> <element maxOccurs="unbounded" minOccurs="0" name="item"
> type="impl:SortDetail"/>
> </sequence>
> </complexType>
> <element name="getCoverageTeamByEcidResponse">
> <complexType>
> <sequence>
> <element name="getCoverageTeamByEcidReturn"
> type="impl:GetCoverageTeamByEcidResponse"/>
> </sequence>
> </complexType>
> </element>
> <complexType name="ArrayOf_impl_ErrorIdentifier">
> <sequence>
> <element maxOccurs="unbounded" minOccurs="0" name="item"
> type="impl:ErrorIdentifier"/>
> </sequence>
> </complexType>
> <complexType name="ArrayOf_impl_CoverageTeamInfoTO">
> <sequence>
> <element maxOccurs="unbounded" minOccurs="0" name="item"
> type="impl:CoverageTeamInfoTO"/>
> </sequence>
> </complexType>
> <complexType name="SortDetail">
> <sequence>
> <element name="sortColumn" nillable="true" type="xsd:string"/>
> <element name="sortOrder" nillable="true" type="xsd:string"/>
> </sequence>
> </complexType>
> <complexType name="PagingRequestDetail">
> <sequence>
> <element name="endRow" type="xsd:int"/>
> <element name="maxRow" type="xsd:int"/>
> <element name="sortDetail" nillable="true"
> type="impl:ArrayOf_impl_SortDetail"/>
> <element name="startRow" type="xsd:int"/>
> </sequence>
> </complexType>
> <complexType name="RequestHeader">
> <sequence>
> <element name="applicationLineOfBusinessRoleIdentifier" nillable="true"
> type="xsd:string"/>
> <element name="requestingAppID" nillable="true" type="xsd:string"/>
> <element name="submitTime" nillable="true" type="xsd:string"/>
> <element name="trackingID" nillable="true" type="xsd:string"/>
> <element name="workerStandardIdentifier" nillable="true"
> type="xsd:string"/>
> </sequence>
> </complexType>
> <complexType name="Request">
> <sequence>
> <element name="pagingRequestDetail" nillable="true"
> type="impl:PagingRequestDetail"/>
> <element name="requestHeader" nillable="true" type="impl:RequestHeader"/>
> <element name="scope" nillable="true" type="xsd:string"/>
> </sequence>
> </complexType>
> <complexType name="PagingResponseDetail">
> <sequence>
> <element name="rowReturned" type="xsd:int"/>
> <element name="totalRowAvailable" type="xsd:int"/>
> </sequence>
> </complexType>
> <complexType name="ErrorIdentifier">
> <sequence>
> <element name="key" nillable="true" type="xsd:string"/>
> <element name="value" nillable="true" type="xsd:string"/>
> </sequence>
> </complexType>
> <complexType name="ErrorDetail">
> <sequence>
> <element name="applicationErrorCode" nillable="true" type="xsd:string"/>
> <element name="applicationErrorID" nillable="true" type="xsd:string"/>
> <element name="applicationErrorMsg" nillable="true" type="xsd:string"/>
> <element name="errorIdentifier" nillable="true"
> type="impl:ArrayOf_impl_ErrorIdentifier"/>
> <element name="systemErrorCode" nillable="true" type="xsd:string"/>
> <element name="systemErrorMsg" nillable="true" type="xsd:string"/>
> </sequence>
> </complexType>
> <complexType name="ResponseHeader">
> <sequence>
> <element name="errorDetail" nillable="true" type="impl:ErrorDetail"/>
> <element name="responseStatus" nillable="true" type="xsd:string"/>
> <element name="submitTime" nillable="true" type="xsd:string"/>
> <element name="successStatusCode" nillable="true" type="xsd:string"/>
> <element name="trackingID" nillable="true" type="xsd:string"/>
> </sequence>
> </complexType>
> <complexType name="Response">
> <sequence>
> <element name="pagingResponseDetail" nillable="true"
> type="impl:PagingResponseDetail"/>
> <element name="responseHeader" nillable="true"
> type="impl:ResponseHeader"/>
> </sequence>
> </complexType>
> <complexType name="GetCoverageTeamByEcidRequest">
> <complexContent>
> <extension base="impl:Request">
> <sequence>
> <element name="ecid" nillable="true" type="xsd:string"/>
> </sequence>
> </extension>
> </complexContent>
> </complexType>
> <complexType name="CoverageTeamInfoTO">
> <sequence>
> <element name="cvrRoleTmrDs" nillable="true" type="xsd:string"/>
> <element name="cvrTeamMembTmrCd" nillable="true" type="xsd:string"/>
> <element name="employeeCityName" nillable="true" type="xsd:string"/>
> <element name="employeeEmail" nillable="true" type="xsd:string"/>
> <element name="employeeFirstName" nillable="true" type="xsd:string"/>
> <element name="employeeLastName" nillable="true" type="xsd:string"/>
> <element name="employeeMiddleName" nillable="true" type="xsd:string"/>
> <element name="employeePhone" nillable="true" type="xsd:string"/>
> <element name="employeeStandardId" nillable="true" type="xsd:string"/>
> <element name="employeeStateCode" nillable="true" type="xsd:string"/>
> <element name="employeeTitleName" nillable="true" type="xsd:string"/>
> <element name="primaryFlag" nillable="true" type="xsd:string"/>
> </sequence>
> </complexType>
> <complexType name="GetCoverageTeamByEcidResponse">
> <complexContent>
> <extension base="impl:Response">
> <sequence>
> <element name="coverageTeamInfoTO" nillable="true"
> type="impl:ArrayOf_impl_CoverageTeamInfoTO"/>
> </sequence>
> </extension>
> </complexContent>
> </complexType>
> </schema>
> </wsdl:types>
> <wsdl:message name="getCoverageTeamByEcidResponse">
> <wsdl:part element="impl:getCoverageTeamByEcidResponse"
> name="parameters"/>
> </wsdl:message>
> <wsdl:message name="getCoverageTeamByEcidRequest">
> <wsdl:part element="impl:getCoverageTeamByEcid" name="parameters"/>
> </wsdl:message>
> <wsdl:portType name="GetCoverageTeamByEcid">
> <wsdl:operation name="getCoverageTeamByEcid">
> <wsdl:input message="impl:getCoverageTeamByEcidRequest"
> name="getCoverageTeamByEcidRequest"/>
> <wsdl:output message="impl:getCoverageTeamByEcidResponse"
> name="getCoverageTeamByEcidResponse"/>
> </wsdl:operation>
> </wsdl:portType>
> <wsdl:binding name="GetCoverageTeamByEcidSoapBinding"
> type="impl:GetCoverageTeamByEcid">
> <wsdlsoap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsdl:operation name="getCoverageTeamByEcid">
> <wsdlsoap:operation soapAction=""/>
> <wsdl:input name="getCoverageTeamByEcidRequest">
> <wsdlsoap:body use="literal"/>
> </wsdl:input>
> <wsdl:output name="getCoverageTeamByEcidResponse">
> <wsdlsoap:body use="literal"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:service name="GetCoverageTeamByEcidService">
> <wsdl:port binding="impl:GetCoverageTeamByEcidSoapBinding"
> name="GetCoverageTeamByEcid">
> <wsdlsoap:address
> location="http://localhost:2000/PWServicesWEB/services/GetCoverageTeamByEcid"/>
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira