none
Authorization Basic Username:Password - BizTalk HTTPS webservice requests RRS feed

  • Question

  • Hi all,
    I had a webservice endpoint which is hosted on Apache and uses the HTTPS transport which I need to authenticate against. The software solutions provide has informed me that I need to use the following header in the message: Authentication Basic Username:Password - My challenge is trying to include this in the header whilst sending a HTTPS request. Has anyone any experience of passing unencrypted message headers via HTTPS to a web service?

    Any advice would be gratefully received... I've tried what feels like every combination of Transport Types and Binding Types but to no avail (many of which don't even allow https endpoints). I have been able to create the message payload but unable to generate the correct message header.

    Regards,

    Steven.

     
    Wednesday, February 11, 2015 3:53 PM

Answers

  • "passing unencrypted message headers via HTTPS to a web service" - message header is part of the SOAP/payload which is encrypted when you use HTTPS. You cannot send "unencrypted message header" via HTTPS.HTTPS encrypts the entire payload.

    Generally credentials can be set in the header and passed over HTTPs where the entire message is encrypted. While constructing the message with soap header, you need to populate the "WCF.OutboundCustomHeaders" context and use "TransportWithMessageCredential" in the security section of your port to support HTTPS.



    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

    • Marked as answer by Angie Xu Tuesday, February 17, 2015 8:26 AM
    Wednesday, February 11, 2015 4:44 PM
  • This issue is due the way the WCF Header is being constructed. Your error stack says that error comes while add the WCF header and xmlheader is not in correct format. - "at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfUtils.AddHeaders(Message message, String xmlHeaders)".

    Check the format of the header you're constructing.


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

    • Marked as answer by Angie Xu Tuesday, February 17, 2015 8:26 AM
    Thursday, February 12, 2015 2:55 PM

All replies

  • The thing is, you can't pass unencrypted http headers with SSL since the whole conversation is encrypted.

    For clarity, while SSL (TLS now) and HTTP are often seen together, they're not actually related.  The HTTP conversation looks the same with or without TLS/SSL.

    Anyway, you shouldn't have a problem using basic authentication over SSL, that's perfectly fine.

    Having said that, the specific binding elements you will need is, sorry, a completely different story.  The pre-built bindings are hit-or-miss.  I usually start with the customBinding, httpTransport or httpsTransport, textMessageEncoding binding elements. Then set the authenticatinScheme of the http element to basic.

    Go from there.  Good luck!

    Wednesday, February 11, 2015 4:26 PM
    Moderator
  • "passing unencrypted message headers via HTTPS to a web service" - message header is part of the SOAP/payload which is encrypted when you use HTTPS. You cannot send "unencrypted message header" via HTTPS.HTTPS encrypts the entire payload.

    Generally credentials can be set in the header and passed over HTTPs where the entire message is encrypted. While constructing the message with soap header, you need to populate the "WCF.OutboundCustomHeaders" context and use "TransportWithMessageCredential" in the security section of your port to support HTTPS.



    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

    • Marked as answer by Angie Xu Tuesday, February 17, 2015 8:26 AM
    Wednesday, February 11, 2015 4:44 PM
  • Hi both,

    Thanks for replying to my BizTalk query.

    As suggested I've worked through the port configuration and set the context within the "message assignment" shape which seems to have resolved the security issue.. however I'm now receiving the follow error with the BizTalk send port:

    System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
       at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
       at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
       at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
       at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
       at System.Xml.XmlDocument.Load(XmlReader reader)
       at System.Xml.XmlDocument.LoadXml(String xml)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfUtils.AddHeaders(Message message, String xmlHeaders)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfMarshaller.CreateWcfMessage(CreateWcfMessageSettings settings, TLConfig tlConfig, RLConfig rlConfig)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendRequestMessage(IBaseMessage bizTalkMessage, IRequestChannel channel)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendMessage(IBaseMessage bizTalkMessage)

    I've checked both the input and output messages but I cannot see any error here and the messages valid when I test them against the schemas and maps.

    Any thoughts?

    Thanks,

    Steven.

    Thursday, February 12, 2015 11:44 AM
  • This issue is due the way the WCF Header is being constructed. Your error stack says that error comes while add the WCF header and xmlheader is not in correct format. - "at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfUtils.AddHeaders(Message message, String xmlHeaders)".

    Check the format of the header you're constructing.


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

    • Marked as answer by Angie Xu Tuesday, February 17, 2015 8:26 AM
    Thursday, February 12, 2015 2:55 PM
  • Hi both,

    Thanks for replying to my BizTalk query.

    As suggested I've worked through the port configuration and set the context within the "message assignment" shape which seems to have resolved the security issue.. however I'm now receiving the follow error with the BizTalk send port:

    System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
       at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
       at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
       at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
       at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
       at System.Xml.XmlDocument.Load(XmlReader reader)
       at System.Xml.XmlDocument.LoadXml(String xml)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfUtils.AddHeaders(Message message, String xmlHeaders)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfMarshaller.CreateWcfMessage(CreateWcfMessageSettings settings, TLConfig tlConfig, RLConfig rlConfig)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendRequestMessage(IBaseMessage bizTalkMessage, IRequestChannel channel)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendMessage(IBaseMessage bizTalkMessage)

    I've checked both the input and output messages but I cannot see any error here and the messages valid when I test them against the schemas and maps.

    Any thoughts?

    Thanks,

    Steven.

    Hi Steven,

    Your WCF Header have to be surround with a <headers> tag.

    <headers></headers>

    This will result in the WCF adapter serializing a SOAP envelope with SOAP headers that contains the value you give between the <headers> tag.

    Rachit


    Please mark as answer or vote as helpful if my reply does


    Thursday, February 12, 2015 3:06 PM
    Moderator