axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Norris Merritt <>
Subject Re: [jira] Created: (AXIS2-3094) NPE thrown from OperationClient addMessageContext method after calling reset method
Date Sat, 29 Sep 2007 00:05:28 GMT

For what it's worth, the following hacks fix this issue for me:

Comment out the line in OperationClient.reset() that sets oc to null
and replace it with code to clear() the messageContexts hashmap instead:

         //   oc = null;

        HashMap mep = oc.getMessageContexts();

        if ( mep != null )

With the above change, one is actually able to reuse an OperationClient, but
then a related issue gets surfaced that requires an additional small change:
If any execute gets an AxisFault, a subsequent call to reset() causes it to
throw the "cannotreset" fault, even if one has carefully called
operationClient.complete() on all the messageContext objects. Even calling
the complete() method on the contained OperationContext object doesn't help,
i.e. operationClient.getOperationContext().setComplete( true );
The "completed" flag maintained in the OperationClient object remains false
somehow. This only happens for executes that get faults. So I changed
reset() a little more, to not throw the exception if one has called the
complete() method of the OperationContext. Admittedly a hack, but it works.
Here is the hacked-up reset method I am using:

     * Reset the operation client to a clean status after the MEP has
     * This is how you can reuse an operation client. NOTE: this does not
     * the options; only the internal state so the client can be used again.
     * @throws AxisFault if reset is called before the MEP client has
completed an
     *                   interaction.
    public void reset() throws AxisFault 
        if (!completed) 

            if ( oc != null && oc.isComplete() == true )
              // Allow the reset, the operation context says it is complete.
              throw new AxisFault(Messages.getMessage("cannotreset"));

        //NRM: NO! Doing this renders the operation client completely
        //   oc = null;

        HashMap mep = oc.getMessageContexts();

        if ( mep != null )

        completed = false;

View this message in context:
Sent from the Axis - Dev mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message