Using WCF-WebHttp receive adapter for HTTP GET/POST / URL Rewrite.

This post is to demonstrate how we can use WCF-WebHttp receive adapter for HTTP GET/POST. This also include the re-direct of https to http.

Consider the below URL are used in an (legacy) application which send GET/Post request to any other Integration Systems. If we need to get this GET/POST request flowing into the BizTalk we needs to re-direct this request to BizTalk IIS service. This can be achieve by Proxy redirect, but in dev environment we do not have this facility. Also the below post describe how we can handle different pages coming into BizTalk which required different processing.

1- http://Test.co.nz/accp/p057_eportal/test1.cfm

2- https://Test.co.nz/accp/p057_eportal/test2.cfm

WCF Web Service:

1- Create WCF-WebHttp web service using BizTalk WCF-Service Publishing Wizard to receive request and send response.

image

2- Click Next to go to the next page. Select Adapter Name as “WCF-WebHttp”, tick “Create BizTalk receive locations in the following application”. Select the application from the drop down. Click Next

image

3- Click Next. We do not want to Add Service Bus endpoint, so keep this untick and click next.

image

4- Select “Create a Request-Response Receive Port”. Click Next.

image

5- Select “Allow anonymous access to WCF service”. Click Next.

image

6- Click “Create” to create the web service.

image

7-Click finish.

IIS Application:

1- Open IIS – Create a new application pool with the Identity as BizTalk isolated host user.

2- Change the application pool for the new created web service.

BizTalk Admin Console:

1- Open BizTalk Admin Console. Navigate to the application –> Receive location. There shall be new receive location created.

image

2- Click on configuration. Under “HTTP Method and URL Mapping” you need to add POST and GET method and the URL.

image

3- The “Page” variable is set in the variable mapping. I promoted the in coming URL post/get request page. In my case the the page is “test1.cfm” and “test2.cfm”. I have done this because they can subscribe and filtered to the individual orchestrations for different processing.

image

URL Re-Write :

Now I have a task to redirect the request http://Test.co.nz/accp/p057_eportal/test1.cfm to http://Test.co.nz/accp/p057_eportal.svc/test1.cfm.

1- Go to IIS. Application Web service.

2- Open URL Rewrite. Create the rules as per below

image

Below is the web.config file extract for the rules.
. . . . .

http://Test.co.nz/accp/{R:1}” />

. . . . .
URL Re-direct:

We need to re-direct https to http – to achieve this the above rules need to be created (as described in URL Re-write).

1. Update the HOST file in C:\Windows\System32\drivers\etc\host

27.0.0.1              Test.co.nz

2. Although we are redirecting from HTTPS to HTTP for the Authenticate request, we still need to setup SSL as SSL kicks in before the url redirect.

a. Use the Visual Studio Command and run the following two commands

makecert.exe -n “CN=Datacom Root CA,O=Datacom,OU=R&D,L=Auckland,S=UT,C=US” -pe -ss Root -sr LocalMachine -sky exchange -m 96 -a sha1 -len 2048 -r

makecert.exe -n “CN=Test.co.nz” -pe -ss My -sr LocalMachine -sky exchange -m 96 -in “Datacom Root CA” -is Root -ir LocalMachine -a sha1 -eku 1.3.6.1.5.5.7.3.1

b. Configure website bindings to use generated certificate.

image

Note:  If you have Microsoft forefront install – then you need to – Add an exception rule to Microsoft Forefront to ignore the HOST file, otherwise the changes we made to the HOST file will be ignored and the default HOST file is used.

image

Please let me know if some one is having different approach to this?

http://www.sharptalktech.com

Thank you.

Advertisements

One thought on “Using WCF-WebHttp receive adapter for HTTP GET/POST / URL Rewrite.

  1. Pingback: Getting Azure Service Bus Relays and the BizTalk WCF-WebHttp adapter to play nice with each other | Adventures inside the Message Box

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s