0

I can send the Basic Authentication request within the xml itself without even writing something like

request.headers.add("");

and adding like this

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <Authentication xmlns="http://tempuri.org/">
      <Password>string</Password>
      <UserName>string</UserName>
    </Authentication>
  </soap:Header>
  <soap:Body>
    <HelloWorld xmlns="http://tempuri.org/" />
  </soap:Body>
</soap:Envelope>

Similarly I want to set the SOAPAction within the header xml itself instead of writing

request.headers.add("SOAPAction","someAction");

Somewhat like this

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
  <SOAPAction>http://abc/xyz/test</SOAPAction>
    <Authentication xmlns="http://tempuri.org/">
      <Password>string</Password>
      <UserName>string</UserName>
    </Authentication>
  </soap:Header>
  <soap:Body>
    <HelloWorld xmlns="http://tempuri.org/" />
  </soap:Body>
</soap:Envelope>

Please guide me that How it can be achieved?

user4259788
  • 117
  • 7
  • I don't think you can do that. The server must read the header to know what soap action to execute. – Crowcoder Feb 24 '17 at 14:21
  • Possible duplicate of [Creating and exposing a SOAP service and its WSDL dynamically in C# (with a custom TCP listener!)](https://stackoverflow.com/questions/11549498/creating-and-exposing-a-soap-service-and-its-wsdl-dynamically-in-c-sharp-with-a) – Paul Sweatte Sep 12 '17 at 03:58

0 Answers0