Search code examples
cweb-serviceshttphttp-headersgsoap

Adding From Header Field HTTP POST Header in Gsoap


I am using g-soap-2.8 to send a post request to a web service. But the problem is that the web service requires From (Http Header Field) must be present in Header. But gsoap has no context related to From header field.

Can anyone explain how to add this particular header field-value pair in gsoap.


Solution

  • The soap.http_extra_header string can be used for this:

    soap->http_extra_header = "SomeField: SomeValue(s)";
    

    You can add multiple extra HTTP headers by separating them with \r\n in the string. Set this string before making the call. The string will be reset to NULL when the call completes, so the extra headers do no accidentally bleed into the next calls.