Guys, I'm developing an handle. It is located at the postdispatch phase.
Actually, I copy the Messagecontext on a local static variable
everytime the handler's "init" method is called. On this handle, I may need
to to invoke another webservice operation. But, as I need to keep the
MessageContext's "To" parameter in order to send the new invocation respone
to the same client, I'm trying to use the Axis API.

Here's the code I'm trying:

Creating the Envelope to be sent:

public SOAPEnvelope creatSOAPEnvelop() {
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope envelope = fac.getDefaultEnvelope();
        OMNamespace omNs = fac.createOMNamespace(
        "http://ws.apache.org/axis2";, "ns1");
        OMElement method = fac.createOMElement("urn:createSession", omNs);
        OMElement value = fac.createOMElement("urn:createSession", omNs);
        value.setText("Hello");
        method.addChild(value);
        envelope.getBody().addChild(method);
        return envelope;
     }

Here I try to use the LocalTransportSender:

LocalTransportSender sender = new LocalTransportSender();
ByteArrayOutputStream envelope = new ByteArrayOutputStream();
creatSOAPEnvelop().serialize(envelope);
sender.finalizeSendWithToAddress(contextomensagem, envelope);

"contextomensagem" is the variable I keep the MessageContext, it keeps the
"To" parameter. When I try this I receive java.lang.NullPointerException. Is
there something missing? Shouldn't the "SOAPMessageBodyBasedDispatcher" find
the action on the Envelope's body first element? Is there something else I
can do in order to fix it?

Thanks in advance,

Igor Nogueira Santos

Reply via email to