----- Original Message -----
Sent: Friday, August 22, 2003 11:51
AM
Subject: Specifying Bean namespace in
WSDL
Hi,
Is there a way
to tell Java2WSDL tool , namespace for a Bean object being passed as
parameter to my webservice; so that the same namespace is registered against
the bean inside the generated client stub (using WSDL2Java)
?
I use Java2WSDL
to generate WSDL for a webservice which takes in my value object as a
parameter. Although I have provided a "QName" for my value object
in wsdd (server-config.wsdd), the output WSDL file which is generated
has an auto-generated namespace for my value object. Therefore, when this
WSDL file is given to WSDL2Java for generating client stub, the stub
contains the auto-generated namespace against my value object, instead of
the namespace (qname) i specified in wsdd. This apparently causes the
webservice to fail, as the Axis server is not able to find deserializer
for that auto generated namespace.
The
exception I get :
AxisFault
faultCode: {http://xml.apache.org/axis/}Server.userException
faultString:
org.xml.sax.SAXException: Deserializing parameter 'in0': could not
find deserializer for type {http://hello.bus}HelloDetail
faultActor:
null
faultDetail:
stackTrace: org.xml.sax.SAXException:
Deserializing parameter 'in0': could not find deserializer for type
{http://hello.bus}HelloDetail
Here
is the snippet from wsdd :
<service name="HelloWebService"
provider="java:RPC">
<parameter name="allowedMethods"
value="*"/>
<parameter name="className"
value="testaxis.detailws.service.HelloWS"/>
<beanMapping
languageSpecificType="java:bus.hello.HelloDetail" qname="ns1:MyDetailObject"
xmlns:ns1="recentNamespace"/>
</service>
Here is
the WSDL excerpt which is generated for this web service
:
<?xml version="1.0" encoding="UTF-8"
?>
- <wsdl:definitions
targetNamespace="detailWebServiceNameSpace" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="abcdefgh" xmlns:intf="detailWebServiceNameSpace" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://hello.bus" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <schema
targetNamespace="http://hello.bus"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
- <complexType
name="HelloDetail">
<element name="accessKey"
type="xsd:int" />
<element name="helloMessage"
nillable="true" type="xsd:string" />
</sequence>
</complexType>
<element name="HelloDetail"
nillable="true" type="tns1:HelloDetail" />
</schema>
</wsdl:types>
- <wsdl:message
name="sayHelloMessageRequest">
<wsdl:part name="in0" type="tns1:HelloDetail"
/>
</wsdl:message>
The stub
generated using this WSDL contains the following code
:
qName =
new javax.xml.namespace.QName("http://hello.bus",
"HelloDetail");
cachedSerQNames.add(qName);
cls =
bus.hello.HelloDetail.class;
_call.registerTypeMapping(cls,
qName, sf, df,
false);