I have a XMLHTTPRequest that contains SOAP message.
I want to add guid that will identified the message and will be consume by C# web service.
The GUID goal is to identified specific user and supposed to escort all user requests for authentication purpose on server, This GUID is created at user login, saved on server and then for every request the request guid checked by server.
Should I use XMLHTTPRequest header like this:
setRequestHeader("GUID", this.requestGUID);
Or use SOAP Header
<?xml version="1.0"?<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header>
<GUID>someGUID...</GUID>
</soap:Header>
...
...
</soap:Envelope>
Is there any advantages for one of them?
Thanks!
I think that the answer on your question is mostly a matter of taste. I personally would prefer to use
setRequestHeadermethod: it take less space in the message and is not SOAP dependent (I personally like JSON more as SOAP).If I would know more about the nature of the
GUIDvalue I would probably change my mind. If the GUID is the property of the data then the message body would be better choice. Having no more information as you posted in the question I stay bysetRequestHeaderchoice.