java - Axis - Response class extends AxisFault and is thrown instead of returned? -


i have generated java class files using axis1 (axis-1.4.jar). have ws method call (i can see generated java code too).

say method call accepts requesta parameter , returns object of type responsea. problem have responsea extends axisfault (i can see in generated java source file responsea). axisfault on own turn extends remoteexception.

as result of this, responsea object returned not returned me thrown to/at me remoteexception.

so when this

try {     responsea x = call(y); // y requesta } catch (exception ex) {     ex.printstacktrace(); } 

in client code, flow of control goes catch block , catching should getting in x variable (i.e. ex x be).

any idea makes axis generate responsea class subclass of axisfault? also, in general, when class generated axis, generated subclass of axisfault?

i think current problem. think in weird situation response succesful ws method call not returned me instead thrown to/at me.

many in advance.

       package com.test.fulfillment3;      // responsea     public class actionresponse  extends org.apache.axis.axisfault  implements java.io.serializable {      ...      }       // --------------------------------------------------------------------------------------------------------------------------------------------       package com.test.fulfillment3;      // 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;     }         }      }       // --------------------------------------------------------------------------------------------------------------------------------------------   

i found problem few months ago. wsdl file defined response type (of method) fault. class responsea/actionresponse generated subclass of axisfault axis.

in case, @ runtime, client-side axis-generated code (parts of pasted above) "thinks" server-side method not return on server side (even though does), , throws return value instead of returning it.

very weird situation tend treat problem in wsdl itself. don't think normal return value/type defined fault @ same time (in wsdl file). wanted share answer in case else runs same issue.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -