Freigeben über


Consuming a web service in a non orchestration scenario

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:

 

image

 

#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 https://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
  1. Create a  c# .NET class library project,
  2. Delete de default Class1.cs file
  3. Add a reference to System.Web.Services (needed by the class)
  4. Add the proxy class generated on step #1#
  5. Sign the assembly with a strong name key file
  6. 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.

  1. Create a new Static solicit response port
  2. On transport section select SOAP Type and click con Configure
  3. On Soap Transport properties type the URL on the WebService URL textbox
  4. Click on Web Service Tab and select Use Web service proxy specified by the following settings
  5. Locate the .NET assembly already generated
  6. if you have several definition types select the desired one
  7. Choose the method name and click OK

You will have something like this:

 

image

 

#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!

 

 

Note

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.

 

Suggestion

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.

 

 

Enjoy!    :-)

Comments

  • Anonymous
    March 07, 2010
    Great illustration Agustin.How about expanding the example to include the WCF adapter? :)
  • Anonymous
    March 08, 2010
    Thanks  Zeeshan!Great Idea. I will woork on it. Hope to be finished by the end of the week.
  • Anonymous
    August 05, 2013
    Recieve Ports are not mentioned and i configured everything as mentioned above but output is not getting as expected.
  • Anonymous
    October 02, 2016
    Useful info. Fortunate me I discovered your website unintentionally, and I'm surprised why this accident didn't took place earlier! I bookmarked it.
    • Anonymous
      March 06, 2017
      Nice to see that worked for you!