NPE thrown from OperationClient addMessageContext method after calling reset 
method
-----------------------------------------------------------------------------------

                 Key: AXIS2-3094
                 URL: https://issues.apache.org/jira/browse/AXIS2-3094
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: kernel
    Affects Versions: 1.2
            Reporter: Peter Tandara-Kuhns


The reset method of org.apache.axis2.client.OperationClient sets the 
OperationContext member variable (oc) to null. There doesn't appear to be any 
way to restore this member, and as a result subsequent OperationClient methods 
cause NullPointerExceptions to be thrown.

I am creating the OperationClient using the ServiceClient createClient method 
with a value of org.apache.axis2.client.ServiceClient.ANON_OUT_IN_OP.


Stack trace:

java.lang.NullPointerException
at 
org.apache.axis2.context.ConfigurationContext.registerOperationContext(ConfigurationContext.java:229)
at 
org.apache.axis2.description.AxisOperation.registerOperationContext(AxisOperation.java:396)
at 
org.apache.axis2.description.OutInAxisOperationClient.addMessageContext(OutInAxisOperation.java:122)


Code fragment:

// First attempt - success
org.apache.axis2.client.ServiceClient svcClient = new 
org.apache.axis2.client.ServiceClient();
org.apache.axis2.client.OperationClient opClient = 
svcClient.createClient(org.apache.axis2.client.ServiceClient.ANON_OUT_IN_OP);
org.apache.axis2.context.MessageContext msgContext = new 
org.apache.axis2.context.MessageContext();
msgContext.setEnvelope(createTestEnvelope());
org.apache.axis2.client.Options options = msgContext.getOptions();
options.setTo(new org.apache.axis2.addressing.EndpointReference(url));
opClient.addMessageContext(msgContext);
opClient.execute(true);
System.out.println("SOAP Response:\n" + 
opClient.getMessageContext("In").getEnvelope());

// Second attempt - fail, NullPointerException
opClient.reset();
opClient.addMessageContext(msgContext);
opClient.execute(true);
System.out.println("SOAP Response:\n" + 
opClient.getMessageContext("In").getEnvelope());


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to