How to add namespace in soap envelope of request in c#

1.8k views Asked by At

I have created a proxy class using wsdl.exe. It is sending a soap envelope as listed below which does not work since the other end of the router is expecting a different set of namespaces inside it

<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<sayHelloWorld xmlns="http://example.com/hro/benefits/helloworld/xsd/">
  <brokerHeader>
    <brokerUserId xmlns="http://my.com/hro/benefits/cm/xsd/v2_0">test</brokerUserId>
    <clientId xmlns="http://my.com/hro/benefits/cm/xsd/v2_0">010666</clientId>
    <callerRefId xmlns="http://my.com/hro/benefits/cm/xsd/v2_0">01066633934717</callerRefId>
  </brokerHeader>
  <greeting>Hello</greeting>
  <sleep>0</sleep>
</sayHelloWorld>
</soap:Body>
</soap:Envelope>

This does not work as the router can only work if I have the following values in soap envelope

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
  xmlns:v2="http://my.com/hro/benefits/cm/xsd/v2_0" 
  xmlns:xsd="http://my.com/hro/benefits/helloworld/xsd/">

The question is how I can change the proxy class to send the desired envelope.

0

There are 0 answers