Reputation: 105
I am using WSO2 Payload factory to create one soap request in which some information is sent to third party. This payload removes my soap header value. Can anyone please help me out in this. I can see only body is being passed and header is getting removed.
I have to use below request to get some token
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:oas="http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:sec="http://schemas.cdi.ltsa.govt.nz/SecurityService.xsd" xmlns:sec1="http://schemas.cdi.ltsa.govt.nz/SecurityService" xmlns:oas1="http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:acc="http://schemas.cdi.ltsa.govt.nz/Security/AccessControl/" xmlns:sec2="http://localhost/Schema/SecurityService">
<soapenv:Header>
<oas:Security>
<oas:UserNameToken>
<oas:UserName>XXXX</oas:UserName>
<oas:Password>XXXX</oas:Password>
</oas:UserNameToken>
</oas:Security>
</soapenv:Header>
<soapenv:Body>
<acc:AuthenticateClient>
<sec2:AuthenticateClientRequest>
<sec2:RequestBody></sec2:RequestBody>
</sec2:AuthenticateClientRequest>
</acc:AuthenticateClient>
</soapenv:Body>
</soapenv:Envelope>
<header name="SOAPAction" scope="transport" value="http://schemas.cdi.ltsa.govt.nz/Security/AccessControl/AuthenticateClient"/>
<script language="js"><![CDATA[var envelope = mc.getEnvelopeXML();
var oas = new Namespace('http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd');
mc.addHeader(false, <oas:Security xmlns:oas="http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<oas:UserNameToken>
<oas:UserName>XXXX</oas:UserName>
<oas:Password>XXXX</oas:Password>
</oas:UserNameToken>
</oas:Security>
);]]></script>
<payloadFactory media-type="xml">
<format>
<Body>
<AuthenticateClient>
<AuthenticateClientRequest>
<RequestBody/>
</AuthenticateClientRequest>
</AuthenticateClient>
</Body>
</format>
<args>
<arg evaluator="xml" expression="$ctx:UserName" xmlns:ns="http://org.apache.synapse/xsd"/>
<arg evaluator="xml" expression="$ctx:Password" xmlns:ns="http://org.apache.synapse/xsd"/>
</args>
</payloadFactory>
<log level="full"/>
<call>
<endpoint>
<address trace="disable" uri="http://XXXX:28080/services/XXXX"/>
</endpoint>
</call>
<respond/>
Logs:
wire << "POST /services/B2BProxyVechicle HTTP/1.1[\r][\n]"
[2017-09-18 16:38:12,230] DEBUG - wire << "SOAPAction: http://XXXXX/AccessControl/AuthenticateClient[\r][\n]"
[2017-09-18 16:38:12,225] DEBUG - SequenceMediator End : Sequence key=<Value {name ='null', keyValue ='PPSR_VehicleInfo_IN_SEQ'}>
[2017-09-18 16:38:12,245] DEBUG - SequenceMediator End : Sequence <anonymous>
[2017-09-18 16:38:12,238] DEBUG - wire << "Accept-Encoding: gzip,deflate[\r][\n]"
[2017-09-18 16:38:12,253] DEBUG - wire << "Content-Type: text/xml; charset=UTF-8[\r][\n]"
[2017-09-18 16:38:12,257] DEBUG - wire << "Transfer-Encoding: chunked[\r][\n]"
[2017-09-18 16:38:12,261] DEBUG - wire << "Host: 1r][\n]"
[2017-09-18 16:38:12,265] DEBUG - wire << "Connection: Keep-Alive[\r][\n]"
[2017-09-18 16:38:12,268] DEBUG - wire << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
[2017-09-18 16:38:12,273] DEBUG - wire << "[\r][\n]"
[2017-09-18 16:38:12,275] DEBUG - wire << "a3[\r][\n]"
[2017-09-18 16:38:12,278] DEBUG - wire << "<Body xmlns="http://ws.apache.org/ns/synapse"><AuthenticateClient><AuthenticateClientRequest><RequestBody/></AuthenticateClientRequest></AuthenticateClient></Body>[\r][\n]"
[2017-09-18 16:38:12,292] DEBUG - wire << "0[\r][\n]"
[2017-09-18 16:38:12,294] DEBUG - wire << "[\r][\n]"
[2017-09-18 16:38:12,305] DEBUG - wire >> "HTTP/1.1 200 OK[\r][\n]"
[2017-09-18 16:38:12,309] DEBUG - wire >> "Host: 3[\r][\n]"
[2017-09-18 16:38:12,313] DEBUG - wire >> "SOAPAction: "http://XXXXXX/AccessControl/AuthenticateClient"[\r][\n]"
[2017-09-18 16:38:12,321] DEBUG - wire >> "Accept-Encoding: gzip,deflate[\r][\n]"
[2017-09-18 16:38:12,325] DEBUG - wire >> "Content-Type: text/xml; charset=UTF-8[\r][\n]"
[2017-09-18 16:38:12,330] DEBUG - wire >> "Date: Mon, 18 Sep 2017 04:38:12 GMT[\r][\n]"
[2017-09-18 16:38:12,334] DEBUG - wire >> "Transfer-Encoding: chunked[\r][\n]"
[2017-09-18 16:38:12,337] DEBUG - wire >> "Connection: Keep-Alive[\r][\n]"
[2017-09-18 16:38:12,341] DEBUG - wire >> "[\r][\n]"
[2017-09-18 16:38:12,343] DEBUG - wire >> "94[\r][\n]"
[2017-09-18 16:38:12,346] DEBUG - wire >> "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body/></soapenv:Envelope>[\r][\n]"
[2017-09-18 16:38:12,360] DEBUG - wire >> "0[\r][\n]"
[2017-09-18 16:38:12,362] DEBUG - wire >> "[\r][\n]"
[2017-09-18 16:38:12,364] DEBUG - SynapseCallbackReceiver Callback removed for request message id : urn. Pending callbacks count : 0
[2017-09-18 16:38:12,375] DEBUG - SynapseCallbackReceiver Synapse received an asynchronous response message
Upvotes: 0
Views: 1116
Reputation: 676
Try to add the following properties.
<property name="PRESERVE_WS_ADDRESSING" value="true"/>
<property name="preserveProcessedHeaders" value="true" scope="default"/>
You can also add custom headers, like described here.
https://docs.wso2.com/display/ESB490/Custom+SOAP+Headers
Upvotes: 1