You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Michel Bergijk <mi...@cmg.nl> on 2002/02/26 09:51:47 UTC
RE: Problem In Deploying webservice
Hi,
Why don't you let your patientInfo class implement the Serializable
interface, and import java.io.*. You don't need to do anything else, just
say you implement it. Look into the Javadoc for more information.
Succes,
Michel
-----Original Message-----
From: dinakar [mailto:dinakar.s@eximsoft.com]
Sent: dinsdag 26 februari 2002 21:10
To: soap-user@xml.apache.org
Subject: Problem In Deploying webservice
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,b
eanSer,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
Error While Deploying.
Posted by dinakar <di...@eximsoft.com>.
Hi,
when i deploy in the command prompt using dd.xml file its given this error
D:\webservicedemo\patientprofile>java org.apache.soap.server.ServiceManagerClien
t http://localhost:8080/soap/servlet/rpcrouter deploy DeploymentDescriptor.xml
Exception in thread "main" java.lang.IllegalArgumentException: Unable to determi
ne namespace of 'patientinfo-object'.
at org.apache.soap.util.xml.DOMUtils.getQualifiedAttributeValue(Unknown
Source)
at org.apache.soap.server.DeploymentDescriptor.fromXML(Unknown Source)
at org.apache.soap.server.ServiceManagerClient.main(Unknown Source)
my dd.xml file is
<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
id="patientprofile">
<isd:provider type="java"
scope="Application"
methods="getAllPatientDetails">
<isd:java class="PatientProfileObject" static="false"/>
</isd:provider>
<isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener>
<isd:mappings>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:x="urn:patientobjectinfoclass" qname="patientinfo-object"
javaType="PatientInfo"
java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
</isd:mappings>
</isd:service>
thanks and regards
dinakar
Error While Deploying.
Posted by dinakar <di...@eximsoft.com>.
Hi,
when i deploy in the command prompt using dd.xml file its given this error
D:\webservicedemo\patientprofile>java org.apache.soap.server.ServiceManagerClien
t http://localhost:8080/soap/servlet/rpcrouter deploy DeploymentDescriptor.xml
Exception in thread "main" java.lang.IllegalArgumentException: Unable to determi
ne namespace of 'patientinfo-object'.
at org.apache.soap.util.xml.DOMUtils.getQualifiedAttributeValue(Unknown
Source)
at org.apache.soap.server.DeploymentDescriptor.fromXML(Unknown Source)
at org.apache.soap.server.ServiceManagerClient.main(Unknown Source)
my dd.xml file is
<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
id="patientprofile">
<isd:provider type="java"
scope="Application"
methods="getAllPatientDetails">
<isd:java class="PatientProfileObject" static="false"/>
</isd:provider>
<isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener>
<isd:mappings>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:x="urn:patientobjectinfoclass" qname="patientinfo-object"
javaType="PatientInfo"
java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
</isd:mappings>
</isd:service>
thanks and regards
dinakar