+ All Categories
Home > Technology > Consuming REST Services in BizTalk 2010

Consuming REST Services in BizTalk 2010

Date post: 14-Dec-2014
Category:
Upload: daniel-toomey
View: 1,650 times
Download: 2 times
Share this document with a friend
Description:
How to integrate with REST Services in BizTalk Server 2010 or earlier. Based on article by BizTalk CCxG Team on TechNet: http://social.technet.microsoft.com/wiki/contents/articles/invoke-restful-web-services-with-biztalk-server-2010.aspx
14
BizTalk Server 2010 Invoking ReSTful Services Daniel Toomey, Mexia Consulting Senior Integration Specialist
Transcript
Page 1: Consuming REST Services in BizTalk 2010

BizTalk Server 2010Invoking ReSTful Services

Daniel Toomey, Mexia ConsultingSenior Integration Specialist

Page 2: Consuming REST Services in BizTalk 2010

Acknowlegements

• BizTalk CCxG Team contributors:– Rupert Benbrook, Senior Consultant, BizTalk Server– Delbert Murphy, TSP, BizTalk Server– Anand Bheemrajaiah, BizTalk Server Product Team– Ankit Raizada, BizTalk Server Product Team– Shailesh Agre, BizTalk Server PSS

• Full article on TechNet:– http://social.technet.microsoft.com/wiki/contents/articles/

invoke-restful-web-services-with-biztalk-server-2010.aspx

Page 3: Consuming REST Services in BizTalk 2010

What is ReST?

• Representational State Transfer• Web applications architecture over HTTP• Uses simple HTTP verbs to support CRUD

operations:

HTTP CRUD

PUT CREATE

GET RETRIEVE

POST UPDATE

DELETE DELETE

Page 4: Consuming REST Services in BizTalk 2010

What is ReST?

• Every unique entity is an identifiable resource. • URLs identify unique resources.

http://www.contoso.com/Customer/Details/9999

<?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope " soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding ">  <soap:body pb="http://www.contoso.com/customer ">   <GetDetails>    <ID>9999</ID>   </GetDetails>  </soap:Body> </soap:Envelope>

http://www.contoso.com/Customer/Details?firstName=John&lastName=Smith

Page 5: Consuming REST Services in BizTalk 2010

BizTalk Server 2010 and ReST

• Exchange non-SOAP messages– HTTP adapter– webHttpBinding (WCF-Custom adapter)

• Support GET, PUT, POST, DELETE methods– HTTP adapter POST only– webHttpBinding No way to specify HTTP verb

• No OOTB support for ReST

5

Page 6: Consuming REST Services in BizTalk 2010

BizTalk Server 2010 and ReST

• Customisation of the webHttpBinding:– Specify HTTP method in the request message– URL path & query string template– Encoding request / Decoding response

• WCF 4.0 Extensions– Message Inspectors

– Extension to client runtime via custom behavior configuration– Must be registered in the machine.config file

– More on “Extending WCF with Custom Behaviors”:– http://msdn.microsoft.com/en-us/magazine/cc163302.aspx

6

Page 7: Consuming REST Services in BizTalk 2010

WCF Runtime Architecture

• From http://msdn.microsoft.com/en-us/magazine/cc163302.aspx

7

Page 8: Consuming REST Services in BizTalk 2010

Proxy (client) Extensions

• From http://msdn.microsoft.com/en-us/magazine/cc163302.aspx

8

Page 9: Consuming REST Services in BizTalk 2010

BizTalk Server 2010 and ReST

1. Create a request message that has all the required attributes such as HTTP verb, any parameters required to frame the URL, etc.

2. Create a message inspector to alter the request message using the attributes specified in the request message.

3. Create an endpoint behavior to apply the message inspector to the client endpoint.

4. Create a behavior extension element to enable configuration of the endpoint behavior.

9

Page 10: Consuming REST Services in BizTalk 2010

Scenario

1. Submit a message to the BizTalk MessageBox database.2. A WCF-Custom send port with webHttpBinding

consumes the request message from the MessageBox database. The request message contains the URI template and the method that is used to configure the HTTP transport, in a manner similar to webHttpBinding.

3. The custom endpoint behavior extension attached to the WCF-Custom send port invokes the message inspector that uses the ReSTful configuration from the request message, configures the HTTP transport, and sends just the REST message body.

4. The receive port tied to the request-response WCF-Custom send port receives the response from the ReSTful service.

10

Page 11: Consuming REST Services in BizTalk 2010

Demo: Twitter_BTS

• In this demonstration, you will see how to…– Use BizTalk to invoke the Twitter ReST API– Extract public timeline:

http://dev.twitter.com/doc/get/statuses/public_timeline– Extract user-specific timeline:

http://dev.twitter.com/doc/get/statuses/user_timeline

– All sample code available at MSDN Code Gallery:

http://code.msdn.microsoft.com/Invoking-ReSTful-Web-with-776ceb78

Page 12: Consuming REST Services in BizTalk 2010

Demo

Twiiter_BTS

Page 13: Consuming REST Services in BizTalk 2010

Resources

• RESTFul Web Services: The Basicshttp://www.ibm.com/developerworks/webservices/library/ws-restful/

• REST Web Serviceshttp://www.predic8.com/rest-webservices.htm

• Learn REST: A Tutorialhttp://rest.elkstein.org/

• Extending WCF with Custom Behaviorshttp://msdn.microsoft.com/en-us/magazine/cc163302.aspx

• A ReSTful API for BizTalk Server Business Ruleshttp://weblogs.asp.net/gsusx/archive/2011/02/08/tellago-devlabs-a-restful-api-

for-biztalk-server-business-rules.aspx • Business Activity Monitoring in Depth for

Developers   (look at the section "Building a BAM RESTful API")http://www.microsoft.com/downloads/en/details.aspx?FamilyID=FF6E4498-B1FF-4932-BA6B-1B53AC6FB3B2&displaylang=en

• A ReSTful API for BizTalk Server Business Rules http://weblogs.asp.net/gsusx/archive/2011/02/08/tellago-devlabs-a-restful-api-for-biztalk-server-business-rules.aspx

13

Page 14: Consuming REST Services in BizTalk 2010

Brisbane BizTalk User Group

14

www.briztalk.org


Recommended