Hi,
I am newbie to Apache
Soap and am just trying to pass a
java bean to my web service and I am getting the below error.
No Deserializer found to deserialize a 'urn:HelloWorldService:helloParam' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.
I am using Soap 2.2 and apache
tomcat 6.0.14.
I have the below deployment descriptor:
<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment" id="urn:HelloWorldService">
<isd
rovider type="java" scope="Application" methods="sayHello">
<isd:java class="com.suman.soap.services.hello.HelloWorldService" static="false"/>
</isd
rovider>
<isd:mappings>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding"
xmlns:x="urn:HelloWorldService" qname="x:helloParam"
javaType="com.suman.soap.services.hello.Hello"
java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
</isd:mappings>
</isd:service>
And my client code is as follows:
String soapEndPointURL = "http://localhost:8080/SoapPractice/servlet/rpcrouter";
String serviceName = "urn:HelloWorldService";
Response resp = null;
try
{
URL url = new URL(soapEndPointURL);
SOAPMappingRegistry smr = new SOAPMappingRegistry();
BeanSerializer bs = new BeanSerializer();
QName qname = new QName(serviceName, "helloParam");
smr.mapTypes(Constants.NS_URI_SOAP_ENC, qname, Hello.class, bs, bs);
Call call = new Call();
call.setSOAPMappingRegistry(smr);
call.setTargetObjectURI(serviceName);
call.setMethodName("sayHello");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Vector<Parameter> params = new Vector<Parameter>();
//Create the Hello object
Hello hello = new Hello();
hello.setFirstName("Suman");
hello.setLastName("Maity");
params.addElement(new Parameter("param",Hello.class,hello,null));
call.setParams(params);
resp = call.invoke(url, "");
}
catch(....
I have omitted rest of the error handling code.
I don't know if I am making any mistake. This is driving me crazy. Please help.