Accessing WebSphere MQ message properties in Biztalk orchestration - biztalk

I need to read Websphere queue name from my orchestration. The queue is configured with MQSC transport.
Can anyone supply a code example for accessing some MQ properties of incoming message? Do I need to reference a special DLL for this or is it available out-of-the-box?

If you have installed the adapter all then you will be able to access the
MQSeries Context Properties and don't need to specifically reference the DLL.
For the queue name you will probably want the MQXQH_RemoteQName context property.
To use the property in an BizTalk shape (expression, decision) you would have something like
Message_Name(MQSeries.MQXQH_RemoteQName)
Where Message_Name is the name of your message in the Orchestration.

Related

Configure UDDI 3 to resolve SAP Endpoint in BizTalk ESB

I am looking a tutorial or step wise document that explains how to create and configure UDDI 3 to resolve SAP and SQL endpoints in BizTalk ESB solution.
My scenario is i need to send a request to SAP and receive response dynamically based on Content message type.
Thanks
HOLD ON! Do not even try to use UDDI.
UDDI has been deprecated in the BizTalk Product and beyond that, no one, literally, every used it. No one, ever.
For Sql adapter, you can refer to post at http://geekswithblogs.net/paulp/archive/2011/09/28/147087.aspx
Once you have SQL adapter working with STATIC resolver, simply use resolver connection string from itinerary XML to populate same key value pairs in UDDI. Next test resolver on designer surface to ensure that you are getting same name value pairs. Yes, UDDI 3 is unfortunately deprecated, so you may consider either BRE or implement SQL resolver.

How does the BizTalk Batching Service work?

I am working on a BizTalk EDI project and now was struggling with BizTalk Batching service cannot subscribe my published message in message box
I have created the party and agreement, in the batch config, I set the filter as something like:
EDI.ToBeBatched==True
and BTS.MessageType == MyMessageType
But BizTalk kept complaining that my message does not have a subscriber.
When I query the Subscription in Hub, I can find 2 instance subscription related with my batch, but none of these 2 have my customized filter condition.
Could someone show me how the batching service work? i.e.: when a message published in message box, how does the BizTalk batching service know it is belongs to which batch?
So, the documentation on this is pretty complete: http://msdn.microsoft.com/en-us/library/bb226413.aspx
It explains what that Filter is for and how to route messages to the Batching instance.
Your filter should NOT have the "EDI.ToBeBatched" property set to true. Biztalk will set this to true for you in the EDI Receive pipeline when your specified filter conditions (at the party level) are met.
To be more specific, the "BatchMarker" component of the EDIReceive pipeline will set subscription conditions necessary for the special batching orchestration instance (running in the Biztalk EDI Application) to subscribe to, batch and deliver your EDI Messages.

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.

BizTalk: terminate messages

If I need to build a specialized web app to be able to terminate messages processed by specific send ports, WMI is one option. Are there others? and are there pros/cons to each approach?
You should be able to terminate messages programmatically by referencing the Microsoft.BizTalk.Operations.dll assembly. That will allow you to use the TerminateInstance method of the BizTalkOperations Class, which allows you to reference a remote BizTalk instance (using this constructor) without enabling remote WMI administrative access.
You may also need to reference Microsoft.BizTalk.Pipeline.dll in Visual Studio to get IntelliSense to work.
The BizTalk SDK includes a sample app that you can review, as well, to see how to look up a message instance, which you'll need for the parameter to the TerminateInstance method:
http://msdn.microsoft.com/en-us/library/gg163868
For example:
BizTalkOperations _operations = new BizTalkOperations()
IEnumerable messages = _operations.GetMessages();
foreach (BizTalkMessage msg in messages)
…
Have you considered the "/null" Send Port Adapter? This allows you to send messages to a "null" port, where they effectively disappear. Source code can be found here, although it hasn't been updated since BizTalk 2006 R2.
If this isn't relevant to what you are trying to achieve, maybe some additional information regarding the use case would help.

Creating a custom SOAP adapter for BizTalk ESB Toolkit 2.0

Using the BizTalk ESB Toolkit 2.0
We are working on a project where we need to call a proxy to a web service which is a DLL. We have no problems doing this via an orchestration since you can use a static port and configure it to use the SOAP adapter with the web service setting pointing at the assembly in the BizTalk Admin interface. In the itinerary though there doesn't seem to be an obvious way to do this since dynamic ports don't have the option to use the SOAP adapter.
There is a good reason why we want to do this, don't worry.
Following on from this, we implemented a custom adaptor provider but are having problems getting it to work.
We followed an (old) example shown here:
The custom adaptor provider inherits from BaseAdapterProvider and overrides the SetEndPoint(Dictionary, IBaseMessageContext) method.
The method extracts the assembly name, type name, and method name that are passed in via the resolver dictionary and then writes them to the pipeline context:
pipelineContext.Write("TypeName",
"http://schemas.microsoft.com/BizTalk/2003/soap-properties", typeName);
pipelineContext.Write("MethodName",
"http://schemas.microsoft.com/BizTalk/2003/soap-properties", action);
pipelineContext.Write("AssemblyName",
"http://schemas.microsoft.com/BizTalk/2003/soap-properties", assembly);
and sets the transport type to soap:
pipelineContext.Write("TransportType",
"http://schemas.microsoft.biztalk.practices.esb.com/itinerary", "SOAP");
In all other respects the adapter provider is nearly identical to the example shown in the link above, except for the obvious change from SMTP to SOAP.
The adapter provider assembly is signed, GACed, and added to the esb.config.
The adapter provider is called from an itinerary that only calls the service and then returns the response. We are testing the itinerary from the Itinerary Test Client that is shipped with the toolkit. Event logging within the custom adapter shows that the adapter code is being called. The problem is that the message is not being routed to the service proxy. The event viewer gives the following error:
The Messaging engine failed to process
a message submitted by adapter:SOAP
Source
URL:/ESB.ItineraryServices.Response/ProcessItinerary.asmx.
Details:The published message could
not be routed because no subscribers
were found. This error occurs if the
subscribing orchestration or send port
has not been enlisted, or if some of
the message properties necessary for
subscription evaluation have not been
promoted. Please use the Biztalk
Administration console to troubleshoot
this failure.
Investigating the suspended service instamces in Group Overview shows two things:
The values for assembly name, type name, and method name are being set correctly.
The message body is missing.
We have tried configuring the send and receive pipelines on the send port to be both XMLTransmit/XMLReceive and ItinerarySendPassthrough/PassthroughReceive and it makes no difference.
Is there something obvious we might have missed? Do you have to explicitly pass the message body through? If so how?
EDIT:
Following a request from the BizTalk ESB Toolkit forum I am posting screen shots of the itinerary, context and send port filters.
Itinerary,
Context,
Port filters.
Many thanks, Nigel.
first of all I'll say you are trying to over engineer the solution. Adapter development is not trivial and there are various things you need to take in to consideration. Developing and Deploying adapters are categorized as platform changes, which effects your whole environment, so if you are not familiar then your shouldn't do it. I would recommend you taking some other route. At this point I personally don't have enough insight into ESB internals, so won't be able to comment on it. At worst case you may be better off using the .NET proxy dll directly inside your orchestration (expression or message shape) rather than building an adapter. Even though its not recommended approach, still I feel its better than custom adapter approach.
Semantically, I don't see why a solution that involves a WCF-BasicHtpp adapter would not work in your scenario. In any case, I would definitely try to see what happens with a WCF-BasicHttp adapter, and once I got a working solution, I would switch to a custom SOAP adapter if that is really necessary.
Currently, your solution is weird - in the sense that you have an On-Ramp directly connected to an Off-Ramp. I've never seen that in any of my itineraries. You might need to create an intermediate messaging or orchestration Itinerary service in betweeen.
Otherwise, the message effectively gets published to the message box and obviously there is no subscribers for it, hence the error you encounter.

Resources