none
Custom Http Header RRS feed

  • Question

  • Hello,

    Would it be possible to send HTTP header while calling a web service using WCF-Basic Adapter? If so could you explain me how to achieve this?

    I have tried Msg(WCF.OutboundCustomHeaders) but its adding SOAP headers. Is there any other property that i should be using? Or do i need to use custom behavior? 

    Thanks



    Tuesday, January 14, 2020 10:27 PM

Answers

  • If you don't want SOAP, don't use the WCF-BasicHttp adapter, as that is for SOAP.

    But if it has been working for years with that adapter, then it obviously is SOAP, and then adding the header as a SOAP header is the expected behavior.

    So if you want to customise with a HTTP header, you will have to use the WCF-Custom adapter with basicHttpBinding binding and reconfigure it, and then have a custom EndPointBehavior to add the custom headers.



    Thursday, January 16, 2020 2:46 AM

All replies

  • Are you sure you are using the correct bindings? 

    If you want REST rather than SOAP you need to use the WCF-WebHttp binding.  There you can add custom headers in the configuration if they are static and not sensitive, or add a EndPointBehaviour to add the HTTP headers for you.

    Tuesday, January 14, 2020 11:00 PM
  • This particular application is running for years ...now service providers asked us to send HTTP header with some key value. In soap UI, I was able to add header and everything works fine. Should I be using webHTTP adapter ? It’s not a rest service. Thank you

    Wednesday, January 15, 2020 12:29 AM
  • Sounds like you have the correct binding then.

    But what do you mean by "but its adding SOAP adapter." then?  Can you give an example of the payload being sent and the expected payload?

    If you want to use a End Point behavior with BasicHttpBinding, then you are going to need to change it to WCF-Custom with basicHttpBinding as the Binding Type, and re-configure it, as the WCF-BasicHttp doesn't allow you to add a end point behavior or add extra headers in the configuration.


    Wednesday, January 15, 2020 12:36 AM
  • I corrected my post. Its not SOAP adapter, its SOAP header.  Here is the Fiddler screenshot.  I need to populate USERNAME field in HTTP header. 
    Wednesday, January 15, 2020 3:20 PM
  • If you don't want SOAP, don't use the WCF-BasicHttp adapter, as that is for SOAP.

    But if it has been working for years with that adapter, then it obviously is SOAP, and then adding the header as a SOAP header is the expected behavior.

    So if you want to customise with a HTTP header, you will have to use the WCF-Custom adapter with basicHttpBinding binding and reconfigure it, and then have a custom EndPointBehavior to add the custom headers.



    Thursday, January 16, 2020 2:46 AM
  • Hi,

    Just to point out, SOAP Adapter is deprecated in BizTalk 2020. If you can, migrate your configuration to 'WCF-Basic Adapter'.

    https://docs.microsoft.com/en-us/biztalk/install-and-config-guides/whats-new-in-biztalk-server-2020#deprecated--removed-list

    Thanks,

    Samad Khan


    • Edited by Samad Khan Thursday, January 16, 2020 8:13 PM
    Thursday, January 16, 2020 8:12 PM