Search code examples
c#web-serviceswcfsoapws-addressing

Remove Action (mustUnderstand) from client request


I have a remote endpoint not under my control for which I have no WSDL but I have samples of SOAP messages. Since I really do not want to be playing with scissors and making soap envelopes by hand, my idea was to create service/data contracts that will (once used in WCF client) generate desired SOAP requests and parse responses. I immediately encountered a problem with the first method in the fact that each envelope seems to contain Action addressing in header:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">urn:IService1/Auth</Action>
  </s:Header>
  <s:Body>
    <Auth>
      <login xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        <Password i:nil="true" />
        <userName i:nil="true" />
      </login>
    </Auth>
  </s:Body>
</s:Envelope>

This messes up the callee which profusely objects to my message. I tried different configuration approaches (I use web.config to configure the mock service and client), but nothing seems to remove this annoying Action node. Any way to solve this without doing what I dont want to be doing (playing with XML by hand)


Solution

  • My problem is solved my moving XML serialized format, as described in Force parameter as Service contract attribute. When I switched to XML formater, the Action header stopped being generated. If someone, however, knows how to remove it in DataContract classes, feel free to show, I'm sure it will be useful.