Biztalk, need to consume a web service - biztalk

What I need to do to send a request and to receive answer from the Web Service that I want to consume.
What i have done:
I have done the "add web Reference"
I added a Send Shape and a Receive Shape and a I configured a port that sent and received with web Type, the port binding Specify later and I connect with the Request and response to the Send and Receive shape.
I believe I am missing something ?

From your description I am guessing you might be missing -
A definition of the request and
response messages; you need to
ensure you have a request and
response message defined, with their
types being the generated web types.
Select the correct message for both
the send and receive shape. send
shape uses the request message,
receive shape uses the response
message.
Construct the request message using a construct and a transform or assignment shape before the send shape. the easiest way to get started is to use a map in a transform shape to create the request from whatever message triggered your process, but the exact implementation detail will, of course, depend on your scenario
This should be enough to call the service I would have thought
There are many blog posts on the subject, here's one I found with a quick search that shows all the pieces needed

I'm currently working my way through a project using Biztalk to consume a web service. I think you may have a error when compiling similar to :
"Use of unreconstructed message"
If this is the problem, add a construct message shape to the orchestration before the send to the web service port.
I'm stuck with creating the message syntax but this should get you moving.

Related

ESB Toolkit - No response from web service when using Orchestration Extender

I have the following itinerary:
A one way receive location passes a message to an orchestration where an inner message is extracted (unable to do this in a map).
The returned message from the orchestration is then mapped and the
result of that map, mapped again. Using the Microsoft.Practices.ESB.Services.Transform service.
This is then passed to a web service, via the Microsoft.Practices.ESB.Services.Routing service, which fires fine but I am not receiving the expected response which I want to write to file. The message that does get written to the file is the message passed to the web service rather than the expected response. Testing the web service using a simpler itinerary i.e. one without orchestration extenders shows that the web service works as expected.
The OffRamp is from the GlobalBank.ESB example application.
How can I get the required response from the web service?
So finally managed to find a solution to this for which I have to give full credit to this guy
The problem is Microsoft.Practices.ESB.Services.Routing Service only provides one way operation, so even if you mark your resolver with two-way message exchange pattern it wont work.
If you check Microsoft.Practices.ESB application in BizTalk Admin console, it has one one way dynamic send port Microsoft.Practices.ESB.Agents_2.1.0.0_Microsoft.Practices.ESB.Agents.Delivery_DeliveryPort_31bf3856ad364e35 which is bound to orchestration Microsoft.Practices.ESB.Agents.Delivery. When you use Orchestration extender and use Microsoft.Practices.ESB.Services.Routing service, this port is used to send any call and because this is one way port, you do not get response.
You need to use a Two-way orchestration in callwebservice shape. A sample Two-way orchestration is in MultipleWebServices ESB Sample. If you deploy that orchestration and register it as itinerary service and use it in callwebservice shape, it will work.
and it more or less did :) Deploy the orchestration and register it to the ESB as an itinerary service by adding an entry to the esb config between the itineraryServices node:
<itineraryService id="04BD6120-06E4-43D3-A56F-2FF061D59862" name="ESB.MultipleWebServices.Orchestrations.TwoWayRouting" type="ESB.MultipleWebServices.Orchestrations.TwoWayRouting, Biztalk.EsbGeneric.Orchestrations, Version=1.0.0.0, Culture=neutral, PublicKeyToken=140bc5dcbb9afcea" scope="Orchestration" stage="None"/>
Create an id using guidgen, the type is made up of the name and assembly of the orchestraiton (comma seperated) in the Admin Console and will vary depending on the application that you have deployed to. scope and stage are as shown above.
Initially I had an error on the send port Biztalk.HoopleEsbGeneric.Orchestrations_1.0.0.0_ESB.MultipleWebServices.Orchestrations.TwoWayRouting_RoutingPort_140bc5dcbb9afcea but changing the send and receive pipelines to PassThruTransmit and PassThruReceive respectively solved this.

How do I retrieve version information from a WCF Web Service?

I want to log the assembly version information into a log file each time my WCF web service is called. I know that in an application the My object has an Application object which has the Info structure, that contains the Version string that I can use. How can I get the version information for the WCF service to a log?
You will need to create either a separate service method GetServiceVersionInfo() that you can call when needed, or you could include the service's version info in some headers that travel along with the message.
If you want to add header to each and every message, the best way to go is create an extension called a MessageInspector. This is a small chunk of code that intercepts every message (in your case: every message going out of the server) and adds some header (or manipulates the actual message).
Read up on Message inspectors in this blog post showing how to write a message inspector, or read the MSDN docs on the topic to get started.

Calling Web Service with primitive types within Orchestration - Can't map request message

I'm running into this problem when trying to call a SOAP Web Service from within a Biztalk orchestration.
The Web Service is an abapi exposed by SAP as a SOAP Web Service, and the signature of the web method I want to call is something like this:
Operation(param1 as System.String, param2 as System.String, param3 ArrayOfSomeClass)
When I see the schemas generated I noticed that only 'ArrayOfSomeClass' and 'SomeClass' were generated. But I don't see any schema that represents the whole request.
I also noticed that a web port type was generated, and the request message is represented as a multi-part message. The parts of this message contains all the scalar parameters (param1, param2) and also the array.
I know I can just use the assignment shape and fill the message by code, but this is not what I want because I would like to map another message to the web service request.
Is this possible? Any one had a similar issue?
Thanks in advance!
You observation is correct, schemas won't be generated for simple types and its clearly documented here and explains how you should work with such types.
http://msdn.microsoft.com/en-us/library/aa561724(BTS.20).aspx
XSD will not contain nodes for simple parameter types
When you add a Web reference and the Web method has a parameter that is a simple type, the generated XSD will not contain nodes for that parameter. Instead, the multipart message that is generated will contain a part that is of the simple type. The orchestration should handle this message part appropriately. If it is a part of the request to the Web service, manually assign the value to that part with a message assignment shape. If it is a part of the response from the Web service, manually access that part in an expression shape to see the value.
I didn't get your second point
I would like to map another message to
the web service request.

Property promotion not happening in Wcf receive location

I have an "enevelope" schema and a body schema and I have setup the correct properties on the "envelope" to point to the body.
I also have a property schema for promoting a value in the body message so that i can route on it.
I set up a File drop receive location and two send ports. Each send port subscribing on a different value of the promoted property. The receive location uses XmlReceive and the send ports both use XmlTransmit.
When i drop one envelope message at the Rcv location, Bts picks it up, splits it, promotes the property and my send ports pick up the relevant messages and do their thing.
File drop was fine for testing, but the real scenario is slightly different.
I want clients to submit "envelope" schemas containing multiple document elements via Wcf
So i published the envelope schema as a Wcf endpoint using the publishing wizard. Let it create the new Receive location. Wired up a Wcf client to talk to this endpoint and submitted a message.
Without changing anything on the Send ports in BizTalk I expected the same result;
However I now get a routing failure.
If i remove the extra filter in the Send port that filters on the promoted property it works, no routing failure.
So ... it would appear that the promoting of my property is not happening on the Wcf receive location.
I have checked; the Wcf receive location is using XmlReceive.
What gives?
How do i fix this?
I would guess that the namespace of your incoming message has changed as a result of changing it to use WCF.
This can cause the property promotion to no longer match the incoming message.
You can view the property promotions in the tracked messages in the BizTalk server admin tools.

Can I check if a SOAP web service supports a certain WebMethod?

Our web services are distributed across different servers for various reasons (such as decreasing latency to the client), and they're not always all up-to-date. Rather than throwing an exception when a method doesn't exist because the particular web service is too old, it would be nicer if we could have the client check if the service responds to a given method before calling it, and otherwise disable the feature (or work around it).
Is there a way to do that?
Get the WSDL (append ?wsdl to the URL) - you can parse that any way you like.
Unit test the web service to ensure its signatures don't break. When you write code that breaks the method signature, you'll know and can adjust the other applications accordingly.
Or just don't break the web services and publish them in a way that enable syou to version them. As in http://services.domain.com/MyService/V1.1/Service.asmx (for .NET) so that way your applications that use v1.1 won't break when you publish v1.2 and make breaking changes.
I would also check out using an internal UDDI server if it's really that big of a hasle to manage your web services. Using the Green Pages of UDDI will tell you what you want to know about the service.
When you are making a SOAP request you are just sending an HTTP request to a server. If the server understands it, it will respond with an HTTP 200 and some XML back, if it doesn't it will send you some error HTTP code (404, 500, ...)
There is no general way to ask for the existance of a "method" exposed by a web service. Try to use the WSDL exposed if it is automatic, or just try to use the "method" and check for an error in the response (you don't have to send an exception to the user...)
Also, I don't know if I understood you well, but you are thinking of quering the server twice, once to check if the method exists, and second to make the actual call it if it does? I would just check for the error if it doesn't, and proceed normally if it does.

Resources