Accessing HTTP header from within Biztalk custom pipeline
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > BizTalk Server > BizTalk Server General > Accessing HTTP header from within Biztalk custom pipeline




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Accessing HTTP header from within Biztalk custom pipeline  
paul


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-20-04 10:48 PM

Hey all

Is it true that I can access an HTTP header from a custom pipeline while
using the BTSHTTPReceive.dll as the HTTP adapter?

I saw an extremely brief pseudo-code by Matt Milner that suggests the above
can be done as follows:
MyStringVar = MyinboundMessage(Http.InboundHttpHeaders);


If this is correct, what is the type of MyinboundMessage?  Is it
IBaseMessage?  Because I've tried it and it doesn't work.  Is there an
example somewehere out there on this????

Below is a paste of the original conversation regarding this issue:


 ========================================
====================================
=


See this hotfix for info on setting custom http headers:

http://support.microsoft.com/defaul...kb;en-us;841994

In order to retrieve headers, you can use the context property
(Http.InboundHttpHeaders) to get at them:

MyStringVar = MyinboundMessage(Http.InboundHttpHeaders);

.... do something with the string to get the header you want.

Matt


"Raj" <Raj@discussions.microsoft.com> wrote in message
news:B64E1966-BAFF-4115-A0D6-BDC8FAA395A4@microsoft.com...
> Is there a way to retain the HTTP headers in biztalk when receiving the
messages through the HTTP Adapter?
> Also can I add custom HTTP headers before sending the message?
> Thanks
> Raj
>







[ Post a follow-up to this message ]



    Re: Accessing HTTP header from within Biztalk custom pipeline  
paul


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-20-04 10:48 PM

Here's a link to the definition for InboundHttpHeaders:

http://msdn.microsoft.com/library/d...t_file_gvaa.asp

Still clueless... I hope someone can help me out here.







[ Post a follow-up to this message ]



    Re: Accessing HTTP header from within Biztalk custom pipeline  
Matt Milner


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-21-04 07:50 AM

That code is for an orchestration.  In a pipeline, access the context
properties of the IBaseMessage to get this value using the name and
namespace.  This should give you a string with all of the values as
described in the article.

matt


"paul" <boloh77@hotmail.com> wrote in message
news:efquFxr5EHA.3120@TK2MSFTNGP12.phx.gbl...
> Hey all
>
> Is it true that I can access an HTTP header from a custom pipeline while
> using the BTSHTTPReceive.dll as the HTTP adapter?
>
> I saw an extremely brief pseudo-code by Matt Milner that suggests the
> above can be done as follows:
> MyStringVar = MyinboundMessage(Http.InboundHttpHeaders);
>
>
> If this is correct, what is the type of MyinboundMessage?  Is it
> IBaseMessage?  Because I've tried it and it doesn't work.  Is there an
> example somewehere out there on this????
>
> Below is a paste of the original conversation regarding this issue:
>
>
>  ========================================
==================================
===
>
>
> See this hotfix for info on setting custom http headers:
>
> http://support.microsoft.com/defaul...kb;en-us;841994
>
> In order to retrieve headers, you can use the context property
> (Http.InboundHttpHeaders) to get at them:
>
> MyStringVar = MyinboundMessage(Http.InboundHttpHeaders);
>
> .... do something with the string to get the header you want.
>
> Matt
>
>
> "Raj" <Raj@discussions.microsoft.com> wrote in message
> news:B64E1966-BAFF-4115-A0D6-BDC8FAA395A4@microsoft.com... 
> messages through the HTTP Adapter? 
>
>







[ Post a follow-up to this message ]



    Re: Accessing HTTP header from within Biztalk custom pipeline  
paul


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-21-04 10:51 PM

Hi there

Thanks for the reply!  I've made some progress thanks to your advice.  There
is still one wrinkle left for me to iron out however.

On the CLIENT side, I added the following header info to my HTTPWebRequest:

HttpWebRequest request = (HttpWebRequest)
HttpWebRequest.Create(requestLocation);
request.Method = "POST";

NameValueCollection colHeader = new NameValueCollection();
colHeader.Add("myName", "My Name");
colHeader.Add("myTitle", "My Title");
colHeader.Add("mySource", "my.source.com");
colHeader.Add("myPort", "80");

int iCount = colHeader.Count;

for(int i=0; i<iCount; i++)
{
request.Headers.Add(colHeader.Keys[i], colHeader[i]);
}

request.ContentType="application/x-www-form-urlencoded";
request.ContentLength = xmlDocument.OuterXml.Length;


On the BIZTALK side inside the custom pipeline I have the following code to
access the header:

private IBaseMessage ExecuteInternal(IPipelineContext pContext, IBaseMessage
pInMsg)
{
..

IBaseMessageContext myContext = pInMsg.Context;
uint propCount = myContext.CountProperties;  // get the number of
properties

string[] propName = new string[propCount];
string[] propNamespace = new string[propCount];
object[] propObj = new Object[propCount];

// cycle through each context property and store the property's name and
values via LogEvent(...)
for(int i=0; i<myContext.CountProperties; i++)
{
myContext.ReadAt(i, out propName[i], out propNamespace[i]);
propObj[i] = myContext.Read(propName[i], propNamespace[i]);
}

..
}


Here's the thing, when I look at the content of the header through
probObj[i].ToString(), all I get is the following:
Connection: Keep-Alive
Content-Length: 12845
Content-Type: application/x-www-form-urlencoded
E

I don't see the additional information regarding myName, myTitle, mySource,
and myPort.  Anybody know why this is the case?  What am I missing?  (maybe
you know Matt?)

Thanks,
Paul







[ Post a follow-up to this message ]



    Re: Accessing HTTP header from within Biztalk custom pipeline  
paul


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-21-04 10:51 PM

Please ignore the LogEvent(...) mention I made




"paul" <boloh77@hotmail.com> wrote in message
news:e5hUVE45EHA.3648@TK2MSFTNGP11.phx.gbl...
> Hi there
>
> Thanks for the reply!  I've made some progress thanks to your advice.
> There is still one wrinkle left for me to iron out however.
>
> On the CLIENT side, I added the following header info to my
> HTTPWebRequest:
>
> HttpWebRequest request = (HttpWebRequest)
> HttpWebRequest.Create(requestLocation);
> request.Method = "POST";
>
> NameValueCollection colHeader = new NameValueCollection();
> colHeader.Add("myName", "My Name");
> colHeader.Add("myTitle", "My Title");
> colHeader.Add("mySource", "my.source.com");
> colHeader.Add("myPort", "80");
>
> int iCount = colHeader.Count;
>
> for(int i=0; i<iCount; i++)
> {
>     request.Headers.Add(colHeader.Keys[i], colHeader[i]);
> }
>
> request.ContentType="application/x-www-form-urlencoded";
> request.ContentLength = xmlDocument.OuterXml.Length;
>
>
> On the BIZTALK side inside the custom pipeline I have the following code
> to access the header:
>
> private IBaseMessage ExecuteInternal(IPipelineContext pContext,
> IBaseMessage pInMsg)
> {
>    ...
>
>    IBaseMessageContext myContext = pInMsg.Context;
>   uint propCount = myContext.CountProperties;  // get the number of
> properties
>
>   string[] propName = new string[propCount];
>   string[] propNamespace = new string[propCount];
>   object[] propObj = new Object[propCount];
>
>  // cycle through each context property and store the property's name and
> values via LogEvent(...)
>   for(int i=0; i<myContext.CountProperties; i++)
>   {
>        myContext.ReadAt(i, out propName[i], out propNamespace[i]);
>        propObj[i] = myContext.Read(propName[i], propNamespace[
i]);
>   }
>
>    ...
> }
>
>
> Here's the thing, when I look at the content of the header through
> probObj[i].ToString(), all I get is the following:
> Connection: Keep-Alive
> Content-Length: 12845
> Content-Type: application/x-www-form-urlencoded
> E
>
> I don't see the additional information regarding myName, myTitle,
> mySource, and myPort.  Anybody know why this is the case?  What am I
> missing?  (maybe you know Matt?)
>
> Thanks,
> Paul
>
>







[ Post a follow-up to this message ]



    Re: Accessing HTTP header from within Biztalk custom pipeline  
paul


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-21-04 10:51 PM

I am beginning to suspect that it is not possible to access custom header
information from within the Biztalk pipeline after all.

I took the same message I used for HTTP Post (with the additional custom
header info) and posted it to a standard .NET HTTP Server written in C#.  Lo
and behold, those custom header info got through to the HTTP server.

It seems rather silly that the Biztalk HTTP adapter does not allow custom
header information to be passed over into the message context.  I certainly
hope this isn't the case, becaues it seems like an overkill to write a
custom Biztalk HTTP adapter JUST so that I can access those custom header
information inside my custom pipeline.

Can someone please tell me whether this is the case or not?

Thanks,
Paul







[ Post a follow-up to this message ]



    Re: Accessing HTTP header from within Biztalk custom pipeline  
Matt Milner


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-23-04 07:46 AM

Did you apply the hotfix that allows you to get at these custom headers when
using the HTTP adpater?  I believe ther is a post out on the
support.microsoft.com site that has information on the download.  Sorry, I
thought you were referending that posting in your previous remarks, but I
think it was some other listing you were referring to.

Matt


"paul" <boloh77@hotmail.com> wrote in message
news:ec0Y1g65EHA.3612@TK2MSFTNGP14.phx.gbl...
>I am beginning to suspect that it is not possible to access custom header
>information from within the Biztalk pipeline after all.
>
> I took the same message I used for HTTP Post (with the additional custom
> header info) and posted it to a standard .NET HTTP Server written in C#.
> Lo and behold, those custom header info got through to the HTTP server.
>
> It seems rather silly that the Biztalk HTTP adapter does not allow custom
> header information to be passed over into the message context.  I
> certainly hope this isn't the case, becaues it seems like an overkill to
> write a custom Biztalk HTTP adapter JUST so that I can access those custom
> header information inside my custom pipeline.
>
> Can someone please tell me whether this is the case or not?
>
> Thanks,
> Paul
>







[ Post a follow-up to this message ]



    Re: Accessing HTTP header from within Biztalk custom pipeline  
paul


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-23-04 10:51 PM

Bingo!  That's exactly what I need.  Thanks Matt.


"Matt Milner" <matt.milner@m3technologypartners dot com> wrote in message
news:OU51G7K6EHA.1260@TK2MSFTNGP12.phx.gbl...
> Did you apply the hotfix that allows you to get at these custom headers
> when using the HTTP adpater?  I believe ther is a post out on the
> support.microsoft.com site that has information on the download.  Sorry, I
> thought you were referending that posting in your previous remarks, but I
> think it was some other listing you were referring to.
>
> Matt
>
>
> "paul" <boloh77@hotmail.com> wrote in message
> news:ec0Y1g65EHA.3612@TK2MSFTNGP14.phx.gbl... 
>
>







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 01:09 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register