Hi Gordon, This type of problem has been posted before, it was quite some time ago, you could search Axis mail list. You could look at upgrading from Axis 1.3 to Axis 1.4. I had no problems when upgrading from Axis 1.3 to Axis 1.4. I use Axis 1.4 and have no problems with sending and receiving int arrays. I happen to have a test SOAP service that sends and receive numbers inside a bean. ( See attachments ) Attached is the WSDL and a sample SOAP request message. I use Axis in a custom built standalone mode. Note: When I create a JavaBean class, I also include the Apache Axis Meta-Data, to help the Axis serialization process. ================================================================ elemField = new org.apache.axis.description.ElementDesc () ;
elemField.setFieldName ( "a_int" ) ; elemField.setXmlName ( new javax.xml.namespace.QName ( "http://soap.service.acme.com", "a_int" ) ) ; elemField.setXmlType ( new javax.xml.namespace.QName ( "http://www.w3.org/2001/XMLSchema", "int" ) ) ; elemField.setNillable ( true ) ; elemField.setItemQName ( new javax.xml.namespace.QName ( "http://soap.service.acme.com", "item" ) ) ; // int array typeDesc.addFieldDesc ( elemField ) ; ================================================================ SOAP message using int [] <?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/ <http://schemas.xmlsoap.org/soap/envelope/> " xmlns:xsd=" http://www.w3.org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema> " xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance <http://www.w3.org/2001/XMLSchema-instance> "> <soapenv:Body> <getNumber xmlns=" http://soap.service.acme.com <http://soap.service.acme.com> "> <param1> <a_byte>XXXXX</a_byte> <a_int> <item>123</item> <item>456</item> </a_int> <n_double>20.1</n_double> <n_float>21.11</n_float> <n_int>22</n_int> <n_long>22345678</n_long> <o_bigdecimal>223.546</o_bigdecimal> <o_biginteger>22385943</o_biginteger> <o_double>2435.456</o_double> <o_int>23245</o_int> </param1> </getNumber> </soapenv:Body> </soapenv:Envelope> ================================================================ <schema elementFormDefault="qualified" targetNamespace=" http://soap.service.acme.com <http://soap.service.acme.com> " xmlns=" http://www.w3.org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema> "> <element name="getNumber"> <complexType> <sequence> <element name="param1" type="impl:EveryNumber"/> </sequence> </complexType> </element> <complexType name="ArrayOf_xsd_int"> <sequence> <element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:int"/> </sequence> </complexType> <complexType name="EveryNumber"> <sequence> <element maxOccurs="1" minOccurs="0" name="a_byte" nillable="true" type="xsd:base64Binary"/> <element name="a_int" nillable="true" type="impl:ArrayOf_xsd_int"/> <element name="n_double" type="xsd:double"/> <element name="n_float" type="xsd:float"/> <element name="n_int" type="xsd:int"/> <element name="n_long" type="xsd:long"/> <element maxOccurs="1" minOccurs="0" name="o_bigdecimal" nillable="true" type="xsd:decimal"/> <element maxOccurs="1" minOccurs="0" name="o_biginteger" nillable="true" type="xsd:integer"/> <element maxOccurs="1" minOccurs="0" name="o_double" nillable="true" type="xsd:double"/> <element maxOccurs="1" minOccurs="0" name="o_int" nillable="true" type="xsd:int"/> </sequence> </complexType> ================================================================ [Alick Buckley] -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, 21 February 2008 11:58 PM To: [email protected] Subject: Re: Badly formed XML response with array of complex types Hi Everybody I am getting the same problem even when the return object only has an array of primitives Response message from web service is; <?xml version="1.0" encoding="utf-16"?> <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> <getTestDataResponse xmlns="http://access.cobra.chubb.com"> <getTestDataReturn> <!-- *** <testInts> tag is repeated both for the array itself and each of its elements!!! *** --> <testInts> <testInts>1</testInts> </testInts> <testSting>ohmygosh!</testSting> </getTestDataReturn> </getTestDataResponse> </soapenv:Body> </soapenv:Envelope> I'm sure I must be missing something really obvious here. The object I am returning is of type TestData and is defined as follows; package com.chubb.cobra.model.echo; public class TestData { private String testString; private int[] testInts = null; public TestData() { } public int[] getTestInts() { return testInts; } public void setTestInts(int[] testInts) { this.testInts = testInts; } public String getTestString() { return this.testString; } public void setTestString(String testString) { this.testString = testString; } } I'm new to web services and I really would appreciate any suggestions on what I could be doing wrong here as it's really holding me up Thanks Gordon Inactive hide details for [EMAIL PROTECTED]@chubb.com [EMAIL PROTECTED] 18/02/2008 15:00 Please respond to [email protected] To [email protected] cc Subject Badly formed XML response with array of complex types Hi I am having a problem using Axis 1.3 to create a web service with a complex return type. My example is pretty simple: In my Java code I am returning a single Vehicle object which has a RegNumber int field and an array of VehicleDriver objects each of which has a driverId int field and a driverName String field. The problem I am getting is that in the xml response that is being sent to my .NET client the driver array tag and the tags for the individual drivers themselves are both getting the name of the driver array in my Java code. To clarify, this is the response I'm getting: ResponseCode: 200 (OK) Date:Fri, 15 Feb 2008 17:54:49 GMT Server:WebLogic Server 8.1 SP2 Fri Dec 5 15:01:51 PST 2003 316284 Content-Type:text/xml; charset=utf-8 Transfer-Encoding:chunked <?xml version="1.0" encoding="utf-16"?> <soapenv:Envelope xmlns:soapenv=" <http://schemas.xmlsoap.org/soap/envelope/> http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=" <http://www.w3.org/2001/XMLSchema> http://www.w3.org/2001/XMLSchema" xmlns:xsi=" <http://www.w3.org/2001/XMLSchema-instance> http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <getVehicleResponse xmlns=" <http://access.cobra.chubb.com/> http://access.cobra.chubb.com"> <getVehicleReturn> <drivers> <drivers> <driverId>1</driverId> <driverName>Mr Ian Edward Wit</driverName> </drivers> <drivers> <driverId>2</driverId> <driverName>Mrs Deborah Wit</driverName> </drivers> </drivers> <regNumber>358 JWP</regNumber> </getVehicleReturn> </getVehicleResponse> </soapenv:Body> </soapenv:Envelope> My wsdl looks like this: <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace=" <http://localhost:7001/services/services/ServicesFacade> http://localhost:7001/services/services/ServicesFacade" xmlns:apachesoap=" <http://xml.apache.org/xml-soap> http://xml.apache.org/xml-soap" xmlns:impl=" <http://localhost:7001/services/services/ServicesFacade> http://localhost:7001/services/services/ServicesFacade" xmlns:intf=" <http://localhost:7001/services/services/ServicesFacade> http://localhost:7001/services/services/ServicesFacade" xmlns:tns1=" <http://access.cobra.chubb.com/> http://access.cobra.chubb.com" xmlns:wsdl=" <http://schemas.xmlsoap.org/wsdl/> http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap=" <http://schemas.xmlsoap.org/wsdl/soap/> http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd=" <http://www.w3.org/2001/XMLSchema> http://www.w3.org/2001/XMLSchema"> <!--WSDL created by Apache Axis version: 1.3 Built on Oct 05, 2005 (05:23:37 EDT)--> <wsdl:types> <schema elementFormDefault="qualified" targetNamespace=" <http://access.cobra.chubb.com/> http://access.cobra.chubb.com" xmlns=" <http://www.w3.org/2001/XMLSchema> http://www.w3.org/2001/XMLSchema"> <import namespace=" <http://localhost:7001/services/services/ServicesFacade> http://localhost:7001/services/services/ServicesFacade"/> <element name="getVehicle"> <complexType> <sequence> <element name="policyItemId" type="xsd:int"/> </sequence> </complexType> </element> <element name="getVehicleResponse"> <complexType> <sequence> <element name="getVehicleReturn" type="impl:Vehicle"/> </sequence> </complexType> </element> </schema> <schema elementFormDefault="qualified" targetNamespace=" <http://localhost:7001/services/services/ServicesFacade> http://localhost:7001/services/services/ServicesFacade" xmlns=" <http://www.w3.org/2001/XMLSchema> http://www.w3.org/2001/XMLSchema"> <complexType name="VehicleDriver"> <sequence> <element name="driverId" type="xsd:int"/> <element name="driverName" nillable="true" type="xsd:string"/> </sequence> </complexType> <complexType name="ArrayOfVehicleDriver"> <sequence> <element maxOccurs="unbounded" minOccurs="0" name="item" type="impl:VehicleDriver"/> </sequence> </complexType> <complexType name="Vehicle"> <sequence> <element name="drivers" nillable="true" type="impl:ArrayOfVehicleDriver"/> <element name="regNumber" nillable="true" type="xsd:string"/> </sequence> </complexType> </schema> </wsdl:types> <wsdl:message name="getVehicleRequest"> <wsdl:part element="tns1:getVehicle" name="parameters"/> </wsdl:message> <wsdl:message name="getVehicleResponse"> <wsdl:part element="tns1:getVehicleResponse" name="parameters"/> </wsdl:message> <wsdl:portType name="ServicesFacade"> <wsdl:operation name="getVehicle"> <wsdl:input message="impl:getVehicleRequest" name="getVehicleRequest"/> <wsdl:output message="impl:getVehicleResponse" name="getVehicleResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="ServicesFacadeSoapBinding" type="impl:ServicesFacade"> <wsdlsoap:binding style="document" transport=" <http://schemas.xmlsoap.org/soap/http> http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="getVehicle"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="getVehicleRequest"> <wsdlsoap:body use="literal"/> </wsdl:input> <wsdl:output name="getVehicleResponse"> <wsdlsoap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="ServicesFacadeService"> <wsdl:port binding="impl:ServicesFacadeSoapBinding" name="ServicesFacade"> <wsdlsoap:address location=" <http://localhost:7001/services/services/ServicesFacade> http://localhost:7001/services/services/ServicesFacade"/> </wsdl:port> </wsdl:service> </wsdl:definitions> This seems to result in the returned data not coming through as I guess the response doesn't really make sense. Has anyone else experienced the same problem and if so what do I need to change to fix it??? Any help would be greatly appreciated. Cheers Gordon
<<attachment: graycol.gif>>
<<attachment: ecblank.gif>>
EveryNumber.java
Description: Binary data
EveryNumberService.wsdl
Description: Binary data
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
