WebServices returning a java.util.Vector

E

Espen Dietrichs

I am trying to deploy a webservice that returns a java.util.Vector (using
IBM Websphere 5.0, the latest version of AXIS and J2EE 1.3).

I first tried the simpler case; a webservice returning an array. This
succeeded utilising the following wsdd file:

<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="AktiviteterWebService" provider="java:RPC">
<parameter name="className"
value="eqd.webservices.aktiviteter.AktiviteterWebService"/>
<parameter name="allowedMethods" value="execute"/>
<beanMapping qname="ns:AktivitetDO"
xmlns:ns="urn:AktiviteterWebService"
languageSpecificType="java:eqd.webservices.aktiviteter.AktivitetDO"/>
<typeMapping qname="ns:AktivitetDOArray"
xmlns:ns="urn:AktiviteterWebService"
type="java:eqd.webservices.aktiviteter.AktivitetDO[]"
serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
encodingStyle=""/>
</service>
</deployment>

Modifying the webservice and the wsdd file now returning a java.util.Vector
(containing objects of the type AktivitetDO) gives the following
runtimeexception:

- Exception:
org.xml.sax.SAXException: No deserializer for
{urn:AktiviteterWebService}AktivitetDO
at org.apache.axis.client.Call.invoke(Call.java:2272)
at org.apache.axis.client.Call.invoke(Call.java:2171)
at org.apache.axis.client.Call.invoke(Call.java:1691)
at
localhost.WSAktiviteter_war.services.AktiviteterWebService.AktiviteterWebSer
viceSoapBindingStub.execute(AktiviteterWebServiceSoapBindingStub.java:97)
at eqd3.webservice.TestAktiviteter.main(TestAktiviteter.java:65)
at eqd3.webservice.TestAktiviteter.main(TestAktiviteter.java:65)

The wsdd file looks like this:

<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="AktiviteterWebService" provider="java:RPC">
<parameter name="className"
value="eqd.webservices.aktiviteter.AktiviteterWebService"/>
<parameter name="allowedMethods" value="execute"/>
<beanMapping qname="myNS:AktivitetDO" xmlns:myNS="urn:AktiviteterWebService"
languageSpecificType="java:eqd.webservices.aktiviteter.AktivitetDO"/>
<typeMapping
qname="ns:AktivitetDOVector" xmlns:ns="urn:AktiviteterWebService"
type="java:java.util.Vector"
serializer="org.apache.axis.encoding.ser.VectorSerializerFactory"
deserializer="org.apache.axis.encoding.ser.VectorDeserializerFactory"
encodingStyle=""/>
</service>
</deployment>

The generated wsdl takes the following form:

<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions
targetNamespace="http://localhost:9080/WSAktiviteter_war/services/Aktivitete
rWebService" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://localhost:9080/WSAktiviteter_war/services/AktiviteterWebS
ervice"
xmlns:intf="http://localhost:9080/WSAktiviteter_war/services/AktiviteterWebS
ervice" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns1="urn:AktiviteterWebService"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <wsdl:types>
- <schema targetNamespace="urn:AktiviteterWebService"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
- <complexType name="AktivitetDO">
- <sequence>
<element name="aktivitetstype" nillable="true" type="xsd:string" />
<element name="aktivitetsnummer" nillable="true" type="xsd:string" />
</sequence>
</complexType>
</schema>
- <schema targetNamespace="http://xml.apache.org/xml-soap"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
- <complexType name="Vector">
- <sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item"
type="xsd:anyType" />
</sequence>
</complexType>
</schema>
</wsdl:types>
- <wsdl:message name="executeRequest">
<wsdl:part name="aktivitettype" type="xsd:string" />
</wsdl:message>
- <wsdl:message name="executeResponse">
<wsdl:part name="executeReturn" type="apachesoap:Vector" />
</wsdl:message>
- <wsdl:portType name="AktiviteterWebService">
- <wsdl:eek:peration name="execute" parameterOrder="aktivitettype">
<wsdl:input message="impl:executeRequest" name="executeRequest" />
<wsdl:eek:utput message="impl:executeResponse" name="executeResponse" />
</wsdl:eek:peration>
</wsdl:portType>
- <wsdl:binding name="AktiviteterWebServiceSoapBinding"
type="impl:AktiviteterWebService">
<wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:eek:peration name="execute">
<wsdlsoap:eek:peration soapAction="" />
- <wsdl:input name="executeRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://localhost:9080/WSAktiviteter_war/services/AktiviteterWebSe
rvice" use="encoded" />
</wsdl:input>
- <wsdl:eek:utput name="executeResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://localhost:9080/WSAktiviteter_war/services/AktiviteterWebSe
rvice" use="encoded" />
</wsdl:eek:utput>
</wsdl:eek:peration>
</wsdl:binding>
- <wsdl:service name="AktiviteterWebServiceService">
- <wsdl:port binding="impl:AktiviteterWebServiceSoapBinding"
name="AktiviteterWebService">
<wsdlsoap:address
location="http://localhost:9080/WSAktiviteter_war/services/AktiviteterWebSer
vice" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I guess the problem is related to the definition of the wsdd file and the
linkage (or lack of linkage) between the Vector and AktivititDO-object.

Happy for any feedback!

Regards,

Espen Dietrichs
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,698
Latest member
LydiaHalle

Latest Threads

Top