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



                                                                       
             [EMAIL PROTECTED]                                         
             om                                                        
                                                                        To
             18/02/2008 15:00          [email protected]         
                                                                        cc
                                                                       
             Please respond to                                     Subject
             [EMAIL PROTECTED]         Badly formed XML response with  
                  he.org               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/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";>
<soapenv:Body>
<getVehicleResponse xmlns="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"; xmlns:apachesoap="
http://xml.apache.org/xml-soap"; xmlns:impl="
http://localhost:7001/services/services/ServicesFacade"; xmlns:intf="
http://localhost:7001/services/services/ServicesFacade"; xmlns:tns1="
http://access.cobra.chubb.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 Oct 05, 2005 (05:23:37 EDT)-->
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="
http://access.cobra.chubb.com"; xmlns="http://www.w3.org/2001/XMLSchema";>
<import namespace="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"; xmlns="
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"/>
<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"/>
</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

<<inline: graycol.gif>>

<<inline: pic11761.gif>>

<<inline: ecblank.gif>>

Reply via email to