Hi All,
I have just subscribed into the soap-user
mailiing list and hope i will get used of it.
I am new to soap technologies i have
just started to execute some java samples applications.
I am using jakarta-tomcat 3.2.3 and
soap 2.2 as an deployment server.
I have deployed some samples classes
which accepts two parameters as request like String,Integer,Float and
also
sends an response as String or
Integer .That was working fine.
Now i wanted to Pass an User Defined
Object as an Parameter and also should recieve an Object as an response.
When i did that i am facing an
problem.I have two classes PatientProfileObject and patientInfo
class.
This is my PatientProfileObject class
import java.util.*;
public class
PatientProfileObject
{
public
PatientProfileObject()
{
}
public static Hashtable
patients;
static
{
patients=new Hashtable();
patientInfo patient1=new
patientInfo("First","FirstAddress","Fever");
patients.put("100",patient1);
}
public
Hashtable getAllPatientDetails()
{
return
patients;
}
}
This is patientInfo class
public class patientInfo
{
String
id,name,address,desease;
public
patientInfo()
{
}
public patientInfo(String
name,String address,String
desease)
{
this.name=name;
this.address=address;
this.desease=desease;
}
public
patientInfo createPatienInfo(String name,String address,String
desease)
{
patientInfo patientinfo=new
patientInfo(name,address,desease);
return
patientinfo;
}
}
And this is my Client Class
import java.io.*;
import java.util.*;
import java.net.*;
import
org.w3c.dom.*;
import org.apache.soap.util.xml.*;
import
org.apache.soap.*;
import org.apache.soap.encoding.*;
import
org.apache.soap.encoding.soapenc.*;
import org.apache.soap.rpc.*;
public class PatientClientObject
{
public static void
main(String args[]) throws Exception
{
URL url=new
URL("http://10.10.20.58:8070/soap/servlet/rpcrouter");
String urn="patientprofile";
SOAPMappingRegistry
smr=new SOAPMappingRegistry();
BeanSerializer
beanSer=new BeanSerializer();
smr.mapTypes(Constants.NS_URI_SOAP_ENC,new
QName("urn:patientobjectclass","patient-object"),PatientProfileObject.class,beanSer,beanSer);
smr.mapTypes(Constants.NS_URI_SOAP_ENC,new
QName("urn:patientobjectinfoclass","patientinfo-object"),patientInfo.class,beanSer,beanSer);
Call call1=new Call();
call1.setTargetObjectURI(urn);
call1.setSOAPMappingRegistry(smr);
try
{
call1.setMethodName("getAllPatientDetails");
call1.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Response
response2=call1.invoke(url,"");
if(!response2.generatedFault())
{
Parameter
result2=response2.getReturnValue();
Object patients=result2.getValue();
Hashtable
patientTable=(Hashtable)patients;
Enumeration
enum=patientTable.elements();
Vector
vect;
Enumeration
vectEnum;
while
(enum.hasMoreElements())
{
System.out.println(enum.nextElement());
}
}
else
{
Fault
fault2=response2.getFault();
System.out.println("Error is " + fault2.getFaultCode()+" " +
fault2.getFaultString());
}
}//try ends
catch (SOAPException
sexceptionss)
{
System.out.println(sexceptionss.getMessage());
}
}//method ends
}
I have deployed this service using deploy tool and when i run the client
iam getting this error
Error is SOAP-ENV:Server
java.lang.IllegalArgumentException: No Serializer found to serialize a
'patientInfo' using encoding style
'http://schemas.xmlsoap.org
/soap/encoding/'.
i think the problem is in deploying. can anyone
pls help me in this regard
thanks in advance
thanks and regards
dinakar.s