Sandeep Kumar
Sandeep Kumar

Reputation: 249

hHow to print the XML request and response from Axis 1.4 stub

I want to print the request xml value(_call) and response xml value(_resp), please find the below code from my stub

 org.apache.axis.client.Call _call = createCall();
            _call.setOperation(_operations[0]);
            _call.setUseSOAPAction(true);
            _call.setSOAPActionURI("OTA");
            _call.setEncodingStyle(null);
            _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
            _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
            _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
            _call.setOperationName(new javax.xml.namespace.QName("", "SessionCreateRQ"));     
     setRequestHeaders(_call);
                setAttachments(_call);

         try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {header.value, header2.value, body});

Upvotes: 1

Views: 3552

Answers (1)

Sandeep Kumar
Sandeep Kumar

Reputation: 249

After _call.invoke method call use below methods for printing the request and response xml. Note:- below methods can be only used after _call.invoke method call, otherwisse it will give NullPointerException.

_call.getMessageContext().getRequestMessage().getSOAPPartAsString()
_call.getMessageContext().getResponseMessage().getSOAPPartAsString()

Upvotes: 3

Related Questions