aspose file tools*
The moose likes Web Services and the fly likes axis -ClassCastException...Pls help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "axis -ClassCastException...Pls help" Watch "axis -ClassCastException...Pls help" New topic
Author

axis -ClassCastException...Pls help

janne s
Ranch Hand

Joined: Sep 21, 2004
Posts: 81
Hi!

I'm trying to consume the webservices.I downloaded the latest axis version. using axis i got the java class, binding stub generated.When i send an id to webservices, it returns the data related to the id.When i try to invoke the service it get ClassCastException. I did google but found no solution. below is the code...

*************************************
TestClient:
public void searchMpi() throws Exception {
try{

MPIServiceLocator temp = new MPIServiceLocator();
MPI mpi = temp.getMPI();
MPIQueryReply x = MPIQueryReply)mpi.queryRecord(in0String,in1Long);

System.out.println(x.getRecord());
System.out.println("Status : " + x.getStatus());
System.out.println("Status String : " + x.getStatusString());
}
catch (Exception e){
e.printStackTrace();
} }

public static void main(String[] args) throws Exception {
QueryMpi qmpi = new QueryMpi();
qmpi.searchMpi();

*****************************************
axis generated soap binding stub class
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(""); // jaya code
_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;
}

***********************************************************
Stack Trace:

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.XML11Configuration.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:288)
at phh.latb.mpi.QueryMpi.searchMpi(QueryMpi.java:90)
at phh.latb.mpi.QueryMpi.main(QueryMpi.java:283)

{http://xml.apache.org/axis/}hostname : NOIC

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.XML11Configuration.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:288)
at phh.latb.mpi.QueryMpi.searchMpi(QueryMpi.java:90)
at phh.latb.mpi.QueryMpi.main(QueryMpi.java:283)

*********************************************
Thanks in advance
janne
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: axis -ClassCastException...Pls help
 
Similar Threads
Using SOAP fault messages
Unclear Axis fault
Problem with Java Client
No Such Operation Exception
Axis 1.4 username/password auth with stubs