I used Axis2-generated adb client with a little modification. In the client, the generated code uses AxisCallback. I think that is very common piece of code in Axis2-generated ADB client. Because the application stuck, I replaced AxisCallback object with an Callback object, and it works fine.

Maybe there is something incorrect in the generated code?

Thanks.

Here is the code for AxisCallback:


           public void onMessage(
                   org.apache.axis2.context.MessageContext resultContext) {
               try {
org.apache.axiom.soap.SOAPEnvelope resultEnv = resultContext.getEnvelope();

                   java.lang.Object object = fromOM(resultEnv.getBody()
                           .getFirstElement(),
xxxx.clients.adb.xxxServicesServiceStub.xxxUserResponse.class,
                           getEnvelopeNamespaces(resultEnv));
callback.receiveResultxxxUser((xxxx.clients.adb.xxxServicesServiceStub.xxxUserResponse) object);
               } catch (org.apache.axis2.AxisFault e) {
                   callback.receiveErrorxxxUser(e);
               }
           }

           public void onError(java.lang.Exception error) {
               if (error instanceof org.apache.axis2.AxisFault) {
org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error;
                   org.apache.axiom.om.OMElement faultElt = f.getDetail();

                   if (faultElt != null) {
                       if (faultExceptionNameMap.containsKey(
                               faultElt.getQName())) {
                           //make the fault by reflection
                           try {
java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(faultElt.getQName()); java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName); java.lang.Exception ex = (java.lang.Exception) exceptionClass.newInstance();

                               //message class
java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(faultElt.getQName()); java.lang.Class messageClass = java.lang.Class.forName(messageClassName); java.lang.Object messageObject = fromOM(faultElt,
                                       messageClass, null);
java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", new java.lang.Class[]{messageClass});
                               m.invoke(ex,
new java.lang.Object[]{messageObject});

callback.receiveErrorxxxUser(new java.rmi.RemoteException(
                                       ex.getMessage(), ex));
                           } catch (java.lang.ClassCastException e) {
// we cannot intantiate the class - throw the original Axis fault
                               callback.receiveErrorxxxUser(f);
                           } catch (java.lang.ClassNotFoundException e) {
// we cannot intantiate the class - throw the original Axis fault
                               callback.receiveErrorxxxUser(f);
                           } catch (java.lang.NoSuchMethodException e) {
// we cannot intantiate the class - throw the original Axis fault
                               callback.receiveErrorxxxUser(f);
} catch (java.lang.reflect.InvocationTargetException e) { // we cannot intantiate the class - throw the original Axis fault
                               callback.receiveErrorxxxUser(f);
                           } catch (java.lang.IllegalAccessException e) {
// we cannot intantiate the class - throw the original Axis fault
                               callback.receiveErrorxxxUser(f);
                           } catch (java.lang.InstantiationException e) {
// we cannot intantiate the class - throw the original Axis fault
                               callback.receiveErrorxxxUser(f);
                           } catch (org.apache.axis2.AxisFault e) {
// we cannot intantiate the class - throw the original Axis fault
                               callback.receiveErrorxxxUser(f);
                           }
                       } else {
                           callback.receiveErrorxxxUser(f);
                       }
                   } else {
                       callback.receiveErrorxxxUser(f);
                   }
               } else {
                   callback.receiveErrorremoveUser(error);
               }
           }

           public void onFault(
                   org.apache.axis2.context.MessageContext faultContext) {
org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext);
               onError(fault);
           }

           public void onComplete() {
               //nothing here
           }


Rajith Attapattu wrote:
How did u use it?
Can you cut paste the code here.

Regards,

Rajith Attapattu
Red Hat.

On 10/11/07, *Huitang Li* < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Hi,

    When I use the new API AxisCallback, the application seems stuck,
    and it
    is taking forever to get any response. However, when I switched to the
    Callback class, I got the response from web service quickly.

    Any idea?


    Thanks.



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    For additional commands, e-mail: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to