Typically, in an orchestration scenario, a web service is consumed by adding a web reference to the project (of course we can do it without to as well) and linking send and receive shapes to the operation port (web method) it means, a proxy class is being generated for us allowing to consume the WS.
BUT, Sometimes we want to consume a web service without the need to do it in an orchestration scenario (performance requirement, to simplify scenarios, …)
Briefly, this is the way we are going to:
#1# A receive port will pick up the xml file (needed by the web service as input parameters)
#2# a Solicit Response port is subscribed to this receive port and will send everything coming from here to the desired web service.
#3# The final send port will send everything coming form the solicit-response subscribed port.
How to do it
#1# Generating the proxy class
The tricky thing resides in how to create a proxy without the need to add a web reference. Well it is a really straightforward : Just by calling the wsdl.exe tool included in visual studio will works:
(run it on the Visual Studio command prompt)
wsdl.exe /out:WS_Proxy.cs http://localhost/TestWebService_Proxy/TestWebService_OrcTestWebService_Port_1.asmx?WSDL
Running the wsdl command will generate the cs file based on what is detailed in the wsdl file.
#2# Compile it into a .NET Assembly
- Create a c# .NET class library project,
- Delete de default Class1.cs file
- Add a reference to System.Web.Services (needed by the class)
- Add the proxy class generated on step #1#
- Sign the assembly with a strong name key file
- Compile it and install it into the GAC.
#3# Creating BizTalk Artifacts
I Will assume you are ready for creating the rest of the ports so i will focus on the request-response port.
- Create a new Static solicit response port
- On transport section select SOAP Type and click con Configure
- On Soap Transport properties type the URL on the WebService URL textbox
- Click on Web Service Tab and select Use Web service proxy specified by the following settings
- Locate the .NET assembly already generated
- if you have several definition types select the desired one
- Choose the method name and click OK
You will have something like this:
#4# The rest of the ports
You now must create the receive port, create the filter subscriptions on the solicit-response port and on the final send port and you will done!
Be aware is possible to transform the first receive message to the format the web service is expecting just using mapping at port level . The same applies to the last send folder.
For the last send port, you need to create a filter subscription like this:
BTS.YourCustomPromotedProperty = “ValueYouKnow’”
where “YourCustomPromotedProperty” is a promoted property on the response message returned from the WS.