Adding Header Keys to a webrequest

Hi All,

I have a webservice that I have to communicate to with Biztalk. The webservice has no wsdl file available, so I have to do the communication using WCF-basichttp adapter.

In Biztalk I have added a schema for the request and I can send the request to the webservice.

But I get an error as result, this has to do with the fact I have to add an authorization key to the header of the request.

In C# code I am able to create the request and get the proper result.

In C# I add the Header key with next code

Code Snippet

request.Headers.Set("Authorization", "Basic ************");

The * present a public key that is used for authentication.

I have a username and password that should be used authorise, but that doesn't work neither.

Does anyone have idea's how to inject this key in the header of my request?

Thanks in advance,

October 27th, 2008 8:47pm

What is the class of the request object used in your code snippet above. With a web service you can have Http headers and Soap headers.

Is the username/password used at the Http level or is this used in WS-Security Soap header?

Free Windows Admin Tool Kit Click here and download it now
October 28th, 2008 12:32pm

Thnks for your reply Greg,

The class I'm using in my code snippet is that of HttpWebRequest.

And the Header I'm setting is the http header.

I have sniffed the request that is sent by by my sample app and that of the biztalk request.

With my sample app I get the (authorization: basic *************)Line, in the header but Biztalk doesn't add anything in the http header and in biztalk I'm setting the security settings on transportCredentialsOnly and pasisng also the password and username.

I was wondering If I could set the http header in my orchestration, while using the WCF-basicHTTP adapter.

This is the HTTPheader that is sent with biztalk:

POST /soap/servlet/rpcrouter HTTP/1.1

Content-Type: text/xml; charset=utf-8

Host: 11.142.7.39:8282

Content-Length: 423

Expect: 100-continue

Connection: Keep-Alive

and this is sent by my Sample app:

POST /soap/servlet/rpcrouter HTTP/1.1

Content-Type: text/xml

Authorization: Basic GHGFhsgdgstwt

Host: 11.142.7.39:8282

Content-Length: 423

Connection: Keep-Alive

thanks in advance.

October 29th, 2008 3:07pm

I also faced the same problem. I needed to pass a http header value from BizTalk 2010 solution.

After trying all possible options and from the link below it was clear that its not possible from BizTalk 2010 adapters:

http://www.codit.eu/blog/2013/04/30/using-httpheaders-with-wcf-webhttp-adapter-on-biztalk-2013/

So I wrote a method in a helper class and called it from my orch by passing message in xmlDoc and other required strings. And it worked !!

Free Windows Admin Tool Kit Click here and download it now
February 4th, 2015 7:59am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics