Hi all,
i have my server class that accept java Object class as a parameter..The
signature of this class is
public String log(Object a_oActionInfoStruct)
Now from my client i would like to send any user defined java class to this
server ...
I have tried to send my MailInfo class .I deployed my service using
deployment descriptor successfully as attached with this mail.. The code for
my java client is also mention below. But when i run my program it get
exception
[SOAPException: faultCode=SOAP-ENV:Client; msg=Unable to instantiate
'MailInfo': MailInfo] at SoapTestLogger.main(SoapTestLogger.java:59)
Exception in thread "main" Process Exit...
Please help me to resolve this condition as how to send Object class from
client.
public class SoapTestLogger
{
public static void main( String[] args) throws Exception
{
Call call = new Call();
URL url = new URL("http://localhost:8080/soap/servlet/rpcrouter/");
String SOAPActionURI = "";
SOAPMappingRegistry smr = call.getSOAPMappingRegistry();
call.setTargetObjectURI("urn:loggerservice");
call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/");
BeanSerializer ser_0 = new BeanSerializer();
smr.mapTypes("http://schemas.xmlsoap.org/soap/encoding/", new QName(
"urn:classtypes","MailInfo"), MailInfo.class, ser_0, ser_0);
System.out.println ("Calling Log method");
MailInfo mlInfo = new
MailInfo("[EMAIL PROTECTED]","[EMAIL PROTECTED]","TEST","TEST"
);
call.setMethodName("log");
Vector params = new Vector();
params.addElement(new Parameter("obj",mlInfo.getClass(),mlInfo,null));
call.setParams(params);
Response resp = call.invoke(url, SOAPActionURI);
// Check the response.
if (resp.generatedFault())
{
Fault fault = resp.getFault();
throw new SOAPException(fault.getFaultCode(), fault.getFaultString());
}
else
{
Parameter retValue = resp.getReturnValue();
String str= (String) retValue.getValue();
System.out.println ("Result is" + str);
}
}
}
Thanx in adnvance