W
write2gordon
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:
I am returning a single Vehicle object which has a RegNumber int field
and an array of Driver objects each of which has a driverId int field
and a name String field.
The problem I am getting is that in the xml response that is being
sent 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.
i.e.This is my response
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
art element="tns1:getVehicle" name="parameters"/>
</wsdl:message>
<wsdl:message name="getVehicleResponse">
<wsdl
art element="tns1:getVehicleResponse" name="parameters"/>
</wsdl:message>
<wsdl
ortType name="ServicesFacade">
<wsdl
peration name="getVehicle">
<wsdl:input message="impl:getVehicleRequest"
name="getVehicleRequest"/>
<wsdl
utput message="impl:getVehicleResponse"
name="getVehicleResponse"/>
</wsdl
peration>
</wsdl
ortType>
<wsdl:binding name="ServicesFacadeSoapBinding"
type="impl:ServicesFacade">
<wsdlsoap:binding style="document" transport="http://
schemas.xmlsoap.org/soap/http"/>
<wsdl
peration name="getVehicle">
<wsdlsoap
peration soapAction=""/>
<wsdl:input name="getVehicleRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl
utput name="getVehicleResponse">
<wsdlsoap:body use="literal"/>
</wsdl
utput>
</wsdl
peration>
</wsdl:binding>
<wsdl:service name="ServicesFacadeService">
<wsdl
ort binding="impl:ServicesFacadeSoapBinding"
name="ServicesFacade">
<wsdlsoap:address location="http://localhost:7001/services/
services/ServicesFacade"/>
</wsdl
ort>
</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
I am having a problem using Axis 1.3 to create a web service with a
complex return type.
My example is pretty simple:
I am returning a single Vehicle object which has a RegNumber int field
and an array of Driver objects each of which has a driverId int field
and a name String field.
The problem I am getting is that in the xml response that is being
sent 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.
i.e.This is my response
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
</wsdl:message>
<wsdl:message name="getVehicleResponse">
<wsdl
</wsdl:message>
<wsdl
<wsdl
<wsdl:input message="impl:getVehicleRequest"
name="getVehicleRequest"/>
<wsdl
name="getVehicleResponse"/>
</wsdl
</wsdl
<wsdl:binding name="ServicesFacadeSoapBinding"
type="impl:ServicesFacade">
<wsdlsoap:binding style="document" transport="http://
schemas.xmlsoap.org/soap/http"/>
<wsdl
<wsdlsoap
<wsdl:input name="getVehicleRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl
<wsdlsoap:body use="literal"/>
</wsdl
</wsdl
</wsdl:binding>
<wsdl:service name="ServicesFacadeService">
<wsdl
name="ServicesFacade">
<wsdlsoap:address location="http://localhost:7001/services/
services/ServicesFacade"/>
</wsdl
</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