dynamically consume webservice in biztalk

Hi,

i need to consume web service in biztalk orchestration dynamically.

Whenever the orchestration starts we find the service url in xml node but how to implement this.

we are using BizTalk Server 2013.

Thanks


  • Edited by R... Raj Tuesday, December 24, 2013 5:30 AM
December 24th, 2013 8:22am

Hi Raj,

Following article shall help you to set the context properties required to call the web service dynamically. But this method requires you to add web refernce/create web port. But this gives you some direction;

http://msdn.microsoft.com/en-us/library/aa577429.aspx

And then this article shall guide to consume web service without webrefernce:

Consuming Web Services without web reference in BizTalk

Free Windows Admin Tool Kit Click here and download it now
December 24th, 2013 8:38am

Hi M.R.ASHWINPRABHU

thanks for ur reply.

I went through the 2nd link 

but in our case service url is in incoming xml node(we dont know the url before run time).

So im unable to genrate a proxy class.

Do u have any other way to do this.

i found a way by using c# class (Dynamic Discovery & Invocation of web services) but know whether it is the optimal solution or not.

Thanks for your support.

December 24th, 2013 9:47am

i m still not getting my answer

Scenario:

i have an incoming schema which contains service url in a node but all the services have the same method to call .

for consuming service i prefer 'add generated item" but in my case if i dont know the url before run time then then which url i used in MEX Endpoint to generate schema and web ports and HOW.

thanks

January 9th, 2014 1:03pm

So you get the URL to access the service at runtime, but you know the way the services needs to be called before that I suppose?

Otherwise how would you be able to call the service, if you don't know the way to communicate with it?

If it concerns a WCF service, you need to know the ABC (Address, Binding and Contract). Both address and binding can be determined and applied runtime (if the service supports the binding you try), but the contract needs to be available upfront. Otherwise you need to get the WSDL at runtime and dynamically extract the contract from it. This definitely is not a best practice. The dynamic discover and invocation of web services also rely on having the contract available, but you don't know where it is located upfront.

You really need to know what data the web service expects, for example by getting the WSDL from the service you need to call.

Free Windows Admin Tool Kit Click here and download it now
January 9th, 2014 1:51pm

The only way I'm aware you will be able to achieve this to use a Dynamic Send Port and then use SOAP as the protocol, you will have to build the COMPLETE SOAP MESSAGE as an XMLDocument and similarly parse the SOAP Response as an XMLDocument.

If however what you imply is the same Web Service but different instances then by all means, generate the schemas through the usual consume MEX endpoints and then use the Dynamic Port to assign the destination URI and build the send request. You will still use SOAP but the message buildup will be against published schemas, actions will be already defined only the value will be defined at runtime.

You cannot expect to do dynamic proxy class generation based on the URL even if it is possible using CODEDOM. Remember this is runtime, how will the associated message schemas get into BizTalk and current process context, how will the message serialization/de-serialization happen between the message and the generated proxy classes?

Regards.

  • Marked as answer by R... Raj Friday, January 10, 2014 3:22 PM
January 9th, 2014 2:31pm

Hi shanky,

first sorry for this delay responce.

i was following the same approch that u specified.

those web services which we are getting in the incoming xml node are from different servers but they have exposed same web methods. Now we used

1. "MEX endpoints" to generate the xml

2. creating a port but used "existing port" created as "ServiceSoap" and specify port binding as DYNAMIC.

3. receive incoming XML and transform it into request message.

4. In expression:

DynamicSendPort(Microsoft.XLANGs.BaseTypes.Address)=MessageIn.URL;

DynamicSendPort(Microsoft.XLANGs.BaseTypes.TransportType)="WCF-BasicHttp";

NOTE :it is working fine for that service which has only 1 exposed web method.and getting error in case if the service has more than 1 web method.(coz of multiple operatons in the service)

to resolve this i used this

5. in message assignment shape:

MessageOut(WCF.BindingType)="basicHttpBinding";
MessageOut(WCF.Action)="http://tempuri.org/InsertOperation";

but now i m getting error that "use of unconstructed message 'MessageOut'" and

"'MessageOut.parameters': message part has not been initialized in construct statement"

but i have checked that in construct message property box "message constructed = 'MessageOut'"

now kindly show me some directions to proceed.........

thanks


  • Edited by R... Raj Friday, January 10, 2014 2:07 PM
  • Marked as answer by R... Raj Friday, January 10, 2014 3:22 PM
  • Unmarked as answer by R... Raj Friday, January 10, 2014 3:22 PM
Free Windows Admin Tool Kit Click here and download it now
January 10th, 2014 5:04pm

Maybe this forum thread will help you:

http://social.msdn.microsoft.com/Forums/en-US/97b11c21-c5f2-41f7-b19d-47920dd1e1e7/hi-i-have-consumed-the-wcf-service-i-am-getting-the-below-error

It discusses the same issue.

January 10th, 2014 5:23pm

thank u soo much jean

n thanks to all

i read the link that jean specified and i got what i was doing wrong .....( such a sillly mistk)

thank u soo much once again

thanks

Free Windows Admin Tool Kit Click here and download it now
January 10th, 2014 6:22pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics