I have generated some java class files using Axis1 (axis-1.4.jar). I have a WS method call (I can see its generated java code too).
Say this method call accepts a RequestA as parameter and returns an object of type ResponseA. The problem I have now is that ResponseA extends AxisFault (I can see that in the generated java source file for ResponseA). AxisFault on its own turn extends RemoteException.
As a result of this, the ResponseA object returned is not returned to me but is thrown to/at me as it is a RemoteException.
So when I do something like this
try {
ResponseA x = call(y); // y is RequestA
} catch (Exception ex) {
ex.printStackTrace();
}
in my client code, the flow of control goes to the catch block and I am actually catching what I should normally be getting in the x variable (i.e. ex is what x would normally be).
Any idea what makes Axis generate my ResponseA class as a subclass of AxisFault? Also, in general, when is a class generated by Axis, generated as subclass of AxisFault?
I think this is my current problem. I think I am in the weird situation that the response from a succesful WS method call is not returned to me but is instead thrown to/at me.
Many thanks in advance.
package com.test.fulfillment3;
// This is the ResponseA
public class Actionresponse extends org.apache.axis.AxisFault implements java.io.Serializable {
...
}
// --------------------------------------------------------------------------------------------------------------------------------------------
package com.test.fulfillment3;
// This is the RequestA
public class Actionrequest implements java.io.Serializable {
...
}
// --------------------------------------------------------------------------------------------------------------------------------------------
package com.test.fulfillment3;
public class Status_ServiceBindingStub {
..............
public com.test.fulfillment3.Actionresponse status_ServiceOp(com.test.fulfillment3.Actionrequest in) throws java.rmi.RemoteException, com.test.fulfillment3.Status_ServiceFault4, com.test.fulfillment3.Status_ServiceFault2, com.test.fulfillment3.Status_ServiceFault3, com.test.fulfillment3.Actionresponse {
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("http://soa.jboss.org/TEST/Status_ServiceOp");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("", "Status_ServiceOp"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {in});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (com.test.fulfillment3.Actionresponse) _resp;
} catch (java.lang.Exception _exception) {
return (com.test.fulfillment3.Actionresponse) org.apache.axis.utils.JavaUtils.convert(_resp, com.test.fulfillment3.Actionresponse.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
if (axisFaultException.detail != null) {
if (axisFaultException.detail instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException) axisFaultException.detail;
}
if (axisFaultException.detail instanceof com.test.fulfillment3.Status_ServiceFault4) {
throw (com.test.fulfillment3.Status_ServiceFault4) axisFaultException.detail;
}
if (axisFaultException.detail instanceof com.test.fulfillment3.Status_ServiceFault2) {
throw (com.test.fulfillment3.Status_ServiceFault2) axisFaultException.detail;
}
if (axisFaultException.detail instanceof com.test.fulfillment3.Status_ServiceFault3) {
throw (com.test.fulfillment3.Status_ServiceFault3) axisFaultException.detail;
}
if (axisFaultException.detail instanceof com.test.fulfillment3.Actionresponse) {
throw (com.test.fulfillment3.Actionresponse) axisFaultException.detail;
}
}
throw axisFaultException;
}
}
}
// --------------------------------------------------------------------------------------------------------------------------------------------