you have defined the bean mappings required for serialization and deserialization at the server and client side ?
On 11/21/05, jsri <[EMAIL PROTECTED]> wrote:
Hello all
I'm a newbie to webservices. I'm trying to consume webservices. I'm using axis1.3 ,Eclipse IDE. Using axis i got the java & stub classes generated. I'm able to receive string literals from webservice. Problem comes with objects..bean. This is the scenairo of the application...When i send an Patient ID to the webservices it returns demographic information related to the Patient ID.
(a) Query record -method returns Patient record for the requested Patient-MPI ID
1. I sent an invalid MPI ID. I got msg from webservice- "MPI ID doesn't exists" .
2.When i send the existing MPI ID i get ClassCastException.
It show the error at call.invoke().I tried using the same jar files used by the webservice provider to generate java calsses &stubs.still got the same errors. I attached wsdl and soapbindingstub class.I'm pasting the code snippets&stack trace below.
Generated SoapBindingStub.java
*****************************************************************
public com.stchome.mpi.MPIQueryReply queryRecord(java.lang.String in0, long in1) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[0]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("urn:mpi", "queryRecord"));
setRequestHeaders(_call);
setAttachments(_call);
try {
java.lang.Object _resp = _call.invoke(new java.lang.Object [] {in0, new java.lang.Long(in1)});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (com.stchome.mpi.MPIQueryReply) _resp;
}
catch (java.lang.Exception _exception) {
return (com.stchome.mpi.MPIQueryReply) org.apache.axis.utils.JavaUtils.convert(_resp, com.stchome.mpi.MPIQueryReply.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
*****************************************************************
ClientTest.java Query Record
******************************************************************
public void QueryMPI() throws Exception {
java.lang.String in0String = new String("system"); //mpi user
long in1Long = 17831;
try{
MPIServiceLocator temp = new MPIServiceLocator();
MPI mpi = temp.getMPI();
com.stchome.mpi.MPIQueryReply x = mpi.queryRecord(in0String,in1Long);
System.out.println((x.getRecord()).getFirstName());
System.out.println("Status : " + x.getStatus ());
System.out.println("Status String : " + x.getStatusString());
}
*****************************************************************************
AxisFault
faultCode: { http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.ClassCastException
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.lang.ClassCastException
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement (DeserializationContext.java:1087)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch (Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse (Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java :696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java :206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at mpi.MPISoapBindingStub.queryRecord(MPISoapBindingStub.java:310)
at dhh.oph.latb.mpi.QueryMpi.searchMpi(QueryMpi.java :92)
at dhh.oph.latb.mpi.QueryMpi.main(QueryMpi.java:286)
{http://xml.apache.org/axis/}hostname:OPH-DHOYLE
java.lang.ClassCastException
at org.apache.axis.message.SOAPFaultBuilder.createFault (SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.xerces.parsers.AbstractSAXParser.endElement (Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument (Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java :345)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke (AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at mpi.MPISoapBindingStub.queryRecord(MPISoapBindingStub.java:310)
at dhh.oph.latb.mpi.QueryMpi.searchMpi(QueryMpi.java:92)
at dhh.oph.latb.mpi.QueryMpi.main(QueryMpi.java:286)
Any kind of help is appreciated.
Thanks
jsri