Overriding GetWebRequest and accessing the Headers works just fine. Now I need to set an attribute. My goal looks like
<soapenv:Envelope xmlns:urn="urn:company:sap:ds:sales" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<messageId xmlns="http://www.company.com/foo/bar/soap/features/messageId/">urn:uuid:123c155c-3ab4-19ca-a045-02003b1bb7f5</messageId>
</soapenv:Header>
<soapenv:Body>
...
</soapenv:Body>
</soapenv:Envelope>
The problem is how to generate the xmlns="http://www.company.com/foo/bar/soap/features/messageId" attribute in the Header. I just spent a few hours reading documentation, and it seems there simply is no way to set an attribute in the header.
Could I simply quote the quotes and write
request.Headers["messageID xmlns=""http://www.company.com/foo/bar/soap/features/messageId"""] = "urn:uuid:123c155c-3ab4-19ca-a045-02003b1bb7f5";
But this feels somehow wrong to me..