I
posted this mail couple of times on the mailing list, but it failed to appear in
the list. I apologize if the duplicates of this mail have already appeared
before.
Please
reply to this mail for the solution to below problem.
-----Original Message-----
From: Yuvraj Waswani
Sent: Friday, August 22, 2003 3:39 PM
To: '[EMAIL PROTECTED]'
Subject: Specifying Bean namespace in WSDL
From: Yuvraj Waswani
Sent: Friday, August 22, 2003 3:39 PM
To: '[EMAIL PROTECTED]'
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
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>
<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">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<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: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);
cachedSerQNames.add(qName);
cls = bus.hello.HelloDetail.class;
_call.registerTypeMapping(cls, qName, sf, df, false);