Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add header to soap fault without interceptor
    text
    copied!<p>I'm trying to find a way to add header to soap fault with out using interceptor. Is there any alternative solution.</p> <p>Basically I've my soap request as follows.</p> <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://kp.web.com/schema/" xmlns:sch1="http://kp.web.com/Shared/schema/"&gt; &lt;soapenv:Header&gt; &lt;sch:clientHeader&gt; &lt;sch1:consumerId&gt;12&lt;/sch1:consumerId&gt; &lt;/sch:clientHeader&gt; &lt;/soapenv:Header&gt; &lt;soapenv:Body&gt; &lt;sch:addRequest&gt; &lt;sch:field1&gt;-3&lt;/sch:field1&gt; &lt;sch:field2&gt;-1&lt;/sch:field2&gt; &lt;/sch:addRequest&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; </code></pre> <p>Success message.</p> <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" &gt; &lt;soap:Header&gt; &lt;serverHeader xmlns:ns2="http://kp.web.com/schema/" xmlns="http://kp.web.com/Shared/schema/"&gt; &lt;ns2:consumerId&gt;12&lt;/ns2:consumerId&gt; &lt;ns2:completionCode&gt;100&lt;/ns2:completionCode&gt; &lt;/serverHeader&gt; &lt;/soap:Header&gt; &lt;soap:Body&gt; &lt;addResponse xmlns="http://kp.web.com/schema/" xmlns:ns2="http://kp.web.com/Shared/schema/"&gt; &lt;result&gt;-4&lt;/result&gt; &lt;/addResponse&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; </code></pre> <p>When fault occurs </p> <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;soap:Body&gt; &lt;soap:Fault&gt; &lt;faultcode&gt;soap:Server&lt;/faultcode&gt; &lt;faultstring&gt;Faulted you sent -1 and -1&lt;/faultstring&gt; &lt;detail&gt; &lt;faultResponse xmlns:ns2="http://kp.web.com/schema/" xmlns="http://kp.web.com/Shared/schema/"&gt;400&lt;/faultResponse&gt; &lt;/detail&gt; &lt;/soap:Fault&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; </code></pre> <p>I would expect fault response something like this.</p> <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://kp.web.com/schema/" xmlns:sch1="http://kp.web.com/Shared/schema/"&gt; &lt;soap:Header&gt; &lt;serverHeader&gt; &lt;ns2:consumerId&gt;12&lt;/ns2:consumerId&gt; &lt;ns2:completionCode&gt;100&lt;/ns2:completionCode&gt; &lt;/serverHeader&gt; &lt;/soap:Header&gt; &lt;soap:Body&gt; &lt;soap:Fault&gt; &lt;faultcode&gt;soap:Server&lt;/faultcode&gt; &lt;faultstring&gt;Faulted you sent -1 and -1&lt;/faultstring&gt; &lt;detail&gt; &lt;faultResponse xmlns:ns2="http://kp.web.com/schema/" xmlns="http://kp.web.com/Shared/schema/"&gt;400&lt;/faultResponse&gt; &lt;/detail&gt; &lt;/soap:Fault&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; </code></pre> <p>Can I use holder or is there any solution. I can't use interceptor because I need to send the consumer Id back. In interceptor I will not have request details.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload