You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Kevin Christmas <ke...@DCHHealth.com> on 2000/10/18 20:21:56 UTC
Deserializing problem
Can someone help me figure out how to resolve this? Basically, I have
modified the demo GetAddress class to call my service that I deployed which
returns a class that extends Object and has an int and a String as members.
Caught SOAPException (SOAP-ENV:Client): No Deserializer found to deserialize
a 'urn:xml-soap-account-demo:account' using encoding style
'http://schemas.xmlsoap.org/soap/encoding/'.
Here is my descriptor:
<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
id="urn:CustToAcct">
<isd:provider type="java"
scope="Application"
methods="getAcctNum">
<isd:java class="com.DCHHealth.soap.test.Translate" static="false"/>
</isd:provider>
<isd:mappings>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:x="urn:xml-soap-account-demo" qname="x:account"
javaType="com.DCHHealth.soap.test.Account"
java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
</isd:mappings>
</isd:service>
Client code:
public static void main(String[] args) throws Exception
{
URL url = new URL("http://localhost:9051/soap/servlet/rpcrouter");
String custNum = new String("2");
SOAPMappingRegistry smr = new SOAPMappingRegistry();
BeanSerializer beanSer = new BeanSerializer();
// Map the types.
smr.mapTypes(Constants.NS_URI_SOAP_ENC,
new QName("urn:xml-soap-account-demo", "account"),
Account.class, beanSer, beanSer);
// Build the call.
Call call = new Call();
//call.setSOAPMappingRegistry(smr);
call.setTargetObjectURI("urn:CustToAcct");
call.setMethodName("getAcctNum");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Vector params = new Vector();
params.addElement(new Parameter("custNum", String.class,
custNum, null));
call.setParams(params);
// Invoke the call.
Response resp;
try
{
resp = call.invoke(url, "");
}
catch (SOAPException e)
{
System.err.println("Caught SOAPException (" +
e.getFaultCode() + "): " +
e.getMessage());
return;
}
// Check the response.
if (!resp.generatedFault())
{
Parameter ret = resp.getReturnValue();
Object value = ret.getValue();
System.out.println(value != null ? "\n" + value : "I don't
know.");
}
else
{
Fault fault = resp.getFault();
System.err.println("Generated fault: ");
System.out.println (" Fault Code = " + fault.getFaultCode());
System.out.println (" Fault String = " +
fault.getFaultString());
}
}