Thursday, September 6, 2012

Biztalk App As HTTP Post Receiver


Suppose you want to set up a Biztalk app that handles incoming HTTP recieve Posts. There are a few parts to setting up an HTTP Receeive location and Biztalk App. I outline them in order below:

1)Set up handler:
*Start up IIS and go to the server tab on the left(main root of the tree). 
*In the Features View, in the IIS section in the middle, click on Handler Mappings. 
*In the upper left click on Add Script Map; fill in as follows
*RequestPath:
BTSHTTPReceive.dll
*Executable:
C:\Program Files\Microsoft BizTalk Server 2010\HttpReceive\BTSHTTPReceive.dll
*Name:
BTSHTTPReceive




*Click on Request Restrictions button:
*In the Verbs tab, click All verbs. 
*In the Access tab click Script radio button.
*Click OK, and then click yes to add the ISAPI extension.

2)Set up IIS application:
*Add a new application, with Alias 'HttpReceive' and Physical Path 'C:\Program Files\Microsoft BizTalk Server 2010\HttpReceive' don't bother testing the connection. 
*Use an application pool with access to the Biztalk Message Box DB. I dont think the default app pool has sufficent perms for this. 
*In the IIS section of this application click on Authentication and disable everything but Anonymous.

3)Set up biz adapter:
*Create a Recieve Port and then a Location along with it, called whatever you like. 
*For Transport type click HTTP. I reccomend using pass through receive as the Receive Pipeline since these posts come through not as XML but as plain text. See http://enricoscipio.blogspot.com/2009/02/biztalk-http-adapters-and-get.html. You should not have this recieve location hand off to an orchestration since orchestrations will need xml.
*Click on Configure and fill out as you see:


I reccomend having a simple send adapter just pick anything up from this recieve location and dump it in a folder. 

4)Test with post.
*Open Fiddler, set it to POST;
*****
POST http://localhost/HttpReceive/BTSHTTPReceive.dll HTTP/1.1
Host: localhost
Connection: keep-alive
User-Agent: Fiddler
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Content-Length: 10

Name=Jason
*****
that last bit is in the body. 
*You can also try GET;

GET http://localhost/HttpReceive/BTSHTTPReceive.dll?Name=Jason HTTP/1.1
Host: localhost
Connection: keep-alive
User-Agent: Fiddler
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Content-Length: 0

No comments:

Post a Comment