Publishing and Consuming webservice with Biztalk

About:
Publishing and Consuming web-service with Biztalk 2009 Soap Adapter

Agenda:
1. requirements
2. publishing an Orchestration as a Web-service with Biztalk web-service Publishing
3. consuming a web-service in Biztalk
4. conclusion

1. requirements

IIS7 should be installed.
The compatibility modul for IIS6 and ASP.net modul should be installed in your IIS7.

2. publishing an Orchestration as a Webservice with Biztalk Webservice Publishing

First of all I created a project called “webservice” and an Orchestration with single message receive and message send shape.

Note: it is important that you created your port as a public port (default internal), otherwise you will not able to publish your port as a webservice later on.


The Transformation is very simple. The incoming IID is mapped to outgoing IID. It is just a string. The IContent is replaced with a “Hallo There”. I used a script functoid with inline C#, which just return a string “Hallo There”.

  • Make sure everything is saved and than compile the source in visio studio 2008.
  • Make sure there is no error durching the compilation and then deployed project to the biztalk host. After the compilation a webservice.dll data is saved in \bin\Debug\
  • Call the webservice publishing assistant in your start menu.
  • Choose publishing a BizTalk Orchestration as a webservice
  • Browse the \bin\Debug\webservice.dll file
  • Choose the port you want to publish and choose all port in summarised page.
  • Give a target name space to the webservice for e.g. “http://biztalkwebservice.com”
  • Define your receive location for the webservice for e.g. “http://localhost/Webservice_Proxy”. Choose overwrite the exist project, allow anonym access and choose the application “webservice” to save the receive location.
  • Configurate the application webservice in your biztalk admin console with automatically generated receive location and start the application.

Make a new application pool in your IIS and change the Identity of this application pool from “ApplicationPoolIdentity” to your biztalk admin user. Otherwise the soap process in IIS will not be able to create messages in your BizTalkMsgBoxDb.

Assign the webservice page to your new application pool and call your webservice page in your blowse to test: In my case is the url “http://localhost/Webservice_Proxy/Webservice_BackendService_Port_1.asmx” and this URL is also your Endpoint URI.

your can reach your WSDL with
“http://localhost/Webservice_Proxy/Webservice_BackendService_Port_1.asmx?WSDL”

Make a quick test with eclipse webservice browser/webservice explorer.
Quick guide to eclipse webservice explorer: http://www.eclipse.org/webtools/jst/components/ws/M4/tutorials/WebServiceExplorer.html

I created the following value for test in eclipse webservice explorer:

As response i get IContent “Hallo There” back, everything is working fine. The Webservice is published successfully.

3. Consuming a Webservice in Biztalk

We are now going to comsuming the published Webservice for our further biztalk orchestration.
Remember the webservice endpoint we published: “http://localhost/Webservice_Proxy/Webservice_BackendService_Port_1.asmx”

  • First of all i created a new project “webserviceMain”.
  • The Second step is to add a webreference to this new project. In my German Version of Visio Studio I need to open the menu over the project and choose “Dienstverweis hinzufügen” -> “Erweitet” -> “Webverweis hinzufügen”
  • Enter the Webservice Endpoint and give a name to this service.

After webservice reference is added in your project you can see additional web port type and web message type in your Orchestration view.

Now you can create an Orchestration with web messages and web port from web port type. For more information about Adding Web References, you can check the links here: http://msdn.microsoft.com/en-us/library/ee253894(v=bts.10).aspx


The port 1 and port3 are receive ports, the port2 is a web port with request and response. For all these 3 Ports I chose“bind later”, port 1 and port 3 will be bound to file adaptor later on in biztalk admin console, and port 2 will be bound to a soap adaptor with endpoint: “http://localhost/Webservice_Proxy/Webservice_BackendService_Port_1.asmx”.

Note: it is important to create the Webport for consuming webservice later on. For more information about create webport , check this Link: http://msdn.microsoft.com/en-us/library/ee268132(v=bts.10).aspx

I used two transformations to configurating the Web Messages for the Web Port. Since the xsd for web messages and receive messages almost indentical. I just mapped the IID and IContent in my map.


This is the map of the first transformation; I mapped the Incoming message to the web message, which will be forwarded to the external webservice.

Now I can compile my project and deploy it to my biztalk host. Bind the port1 and port3 in the biztalk administration console to file adaptor with XML Receive and XML transmitter pipeline. For the webport “port2” i chose to use the “passthrough” pipeline with endpoint URI: http://localhost/Webservice_Proxy/Webservice_BackendService_Port_1.asmx

After the configuration, you can start the WebserviceMain application. Test the application with dropping the appropriate xml file (incoming.xml) in the file adapter receive location.

4. Conclusion:

The biztalk Soap adaptor has a lot of know errors, it cause also performance error in IIS. For more information about known errors, check this Link: http://msdn.microsoft.com/en-us/library/aa577833(v=bts.70).aspx

Microsoft recommended using wcp_wshttp adaptor for soap webservice communication.

Advertisements

Microsoft Robotics Developer Studio

I am starting to use Microsoft Robotics Developer Studio to controlling my Wowwee Rovio.

Microsoft Robotics Developer Studio (MRDS) is a freeware. The current version is R3, it can be downloaded from the microsoft web: http://www.microsoft.com/robotics/ . For the installation a visio studio c# express edition and the .net 3.5 are needed.

MRDS contains a bunch of services, codes and samples. Unfortunatly there are no prebuilt Services for controling Rovios movement. I am going to start at this point to build a rovio customer service in MRDS.

There are shared Rovio API und Wrapper code written in .net and C# available in CodePlex Web . I am going to start of these code base, it is not necessary to start everything new.