Hi all,

I'm doing some tests and I get the following exception:

Exception in thread "pool-1-thread-1" java.lang.NullPointerException
        at org.apache.axis2.handlers.addressing.AddressingOutHandler
$WSAHeaderWriter.<init>(AddressingOutHandler.java:138)
        at
org.apache.axis2.handlers.addressing.AddressingOutHandler.invoke(AddressingOutHandler.java:106)
        at org.apache.axis2.engine.Phase.invoke(Phase.java:292)
        at
org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:212)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:377)
        at
org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:265)
        at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
        at service.ExecutorTask.failure3(ExecutorTask.java:246)
        at service.ExecutorTask.run(ExecutorTask.java:335)
        at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:885)
        at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:907)
        at java.lang.Thread.run(Thread.java:619)


This is the received message

<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:wsa="http://www.w3.org/2005/08/addressing";>

<soapenv:Header>
<wsa:To>http://localhost:8080/axis2/services/EchoService</wsa:To>
<wsa:ReplyTo>
<wsa:Address>http://172.16.98.1:6060/axis2/services/anonService1</wsa:Address>
</wsa:ReplyTo>
<wsa:MessageID>urn:uuid:8D44973B7B588AB6BC1196938157366</wsa:MessageID>
<wsa:Action>urn:echo</wsa:Action>
</soapenv:Header>

<soapenv:Body>
<client:echo xmlns:client="http://org.ncl.ac.uk/qosp/clients/codestore";>
        <client:Text>QoSP Echo String</client:Text>
</client:echo>
</soapenv:Body>
</soapenv:Envelope>




while this is the chunk of code you can use to re-create the problem
(the problem occurs on mepClient.execute() while the fault is created
according to here [1]):


 void failure3(Request request) throws AxisFault {
        final MessageContext inMessageContext = request.context;

        SOAPFactory soapFactory;
        if (inMessageContext.isSOAP11()) {
            soapFactory = OMAbstractFactory.getSOAP11Factory();
        } else {
            soapFactory = OMAbstractFactory.getSOAP12Factory();
        }

        SOAPFaultCode soapFaultCode = soapFactory.createSOAPFaultCode();
        SOAPFaultValue soapFaultValue =
soapFactory.createSOAPFaultValue(soapFaultCode);
        soapFaultValue.setText(new QName("http://test.org";, "TestFault",
"test"));

        SOAPFaultReason soapFaultReason =
soapFactory.createSOAPFaultReason();
        SOAPFaultText soapFaultText =
soapFactory.createSOAPFaultText(soapFaultReason);
        soapFaultText.setText("This is some FaultReason");

        SOAPFaultDetail soapFaultDetail =
soapFactory.createSOAPFaultDetail();
        QName qName = new QName("http://someuri.org";, "FaultException");
        OMElement detail = soapFactory.createOMElement(qName,
soapFaultDetail);
        qName = new QName("http://someuri.org";, "ExceptionMessage");
        Throwable e = new Exception("This is a test Exception");
        OMElement exception = soapFactory.createOMElement(qName, null);
        exception.setText(e.getMessage());
        detail.addChild(exception);

        MessageContext outMessageContext = new MessageContext();

outMessageContext.setProperty(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME,
            soapFaultCode);

outMessageContext.setProperty(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME,
            soapFaultReason);

outMessageContext.setProperty(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME,
            soapFaultDetail);

        Options options = new Options();
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        options.setTo(inMessageContext.getReplyTo());

        // these statements are needed -- otherwise the server fails
        options.setAction("urn:echoResponse");
        options.setRelationships(new RelatesTo[] { new
RelatesTo(inMessageContext
                .getOptions().getMessageId(),

AddressingConstants.Submission.WSA_DEFAULT_RELATIONSHIP_TYPE) });
        sender.setOptions(options);

//        outMessageContext.setOptions(options);

        OperationClient mepClient =
sender.createClient(ServiceClient.ANON_OUT_ONLY_OP);
        mepClient.addMessageContext(outMessageContext);
        mepClient.execute(true);
        mepClient.complete(outMessageContext);
        
        sender.cleanupTransport();
    }


Please not that the operation is declared as in-oly and it's
asyncronous. If the above method is invoked by the received thread,
i.e.:

public class MyService {

        public void test(OMElement element) {
                failure3(new Request(element,
MessageContext.getCurrentMessageContext());
        }

}

then the client gets the following error:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:wsa="http://www.w3.org/2005/08/addressing";>
<soapenv:Header>
<wsa:To>http://172.16.98.1:6060/axis2/services/anonService1</wsa:To>
<wsa:ReplyTo><wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address>
</wsa:ReplyTo><wsa:MessageID>urn:uuid:A12892812A83FA63BF1196938602607</wsa:MessageID>
<wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</wsa:Action>
<wsa:RelatesTo>urn:uuid:803F7EBBC2742E8A9A1196938601951</wsa:RelatesTo>
</soapenv:Header>
<soapenv:Body>
<soapenv:Fault><faultcode>
soapenv:Server</faultcode>
<faultstring>unknown</faultstring>
<detail /><
/soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>


My idea, however, is to handle the request using a separate thread --
the receiver and the worker thread are connected via a queue. In this
scenario the same error occurs but the client is never notified -- it
keeps waiting until a timeout error occurs.


Any idea?

Michele

[1] http://wso2.org/library/171



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

Reply via email to