I am using
idhttp.Request.CustomHeaders.AddValue(x,y);
This is working fine for me, but now I have come across a different header and am not sure how to add it or what value, string to use.
In the past, I have used
'SOAPACTION','http://url/action'
But what would I need to do for the mustUnderstand
part, or in the ReplyTo
and Address
parts?
How would I AddValue(x,y)
them?
I have tried
...AddValue('SOAPACTION','http://URL/Action');
...AddValue('mustUnderstand','1');
But I am getting errors, and the host IT says that my headers are not correct.
<s:Header>
<a:Action s:mustUnderstand="1">http://URL/Action</a:Action>
<a:MessageID>A Valid GUIID</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">URL STRING</a:To>
</s:Header>
Previous simple headers have worked, but I am not sure how to add these headers.
SOAPAction
is a valid HTTP header for SOAP messaging, but mustUnderstand
and ReplyTo
are not HTTP headers, so DO NOT add them with TIdHTTP.Request.CustomHeaders.AddValue()
at all. They are components of the <Header>
element inside of a SOAP <Envelope>
message, so they belong inside the XML data that you post to the server via TIdHTTP
(as per the example XML that you showed). You are confusing HTTP headers and SOAP headers. They are two different things.
If the webserver IT is telling you that your HTTP or SOAP headers are wrong, it should also be telling you what exactly is wrong with them so you can fix it.
This is not an Indy issue. You are simply not preparing your SOAP message the way the webserver is expecting. But we don't have those details to advise you with. The webserver IT does.