Geeks With Blogs
Jasper Defesche a FreeIT Microsoft Specialist

The other day, I encountered a problem/feature in BizTalk 2006 R2 concerning calling a webservice, which methods only have primitive types, without using an orchestration. A webservice with a complextype as an argument, results in xsd being generated by the webservice proxy generator. With primitive types, no xsd is generated. As a result, no mapping can be used in sending messages out. Remember, the sample uses only CBR on send/receiveport names, every send/receive is done through the passthrough pipelines. Later, I will publish a solution for this! Please come back later...

Yesterday a business associate pointed me to this article: http://www.digitaldeposit.net/saravana/post/2007/05/31/BizTalk-2006-R2-consume-an-ASMX-webservice-using-WCF-BasicHttp-adapter.aspx. It explains the use of the WCF adapter framework. But also here an orchestration is used. But the nicest thing is, is that Visual Studio generates a XSD from a primitive typed webservice. This XSD can then be used in a mapping. After applying the correct soap-action in the WCF (http-binding) adapter config screen (check the service's wsdl for the exact value), the messages start flowing!

 

For the SOAP adapter, a little bit more tweaking is needed. It expects an IBaseMessage ofcourse, but it needs to consist of various messageparts. Each messagepart represents a primitive type parameter. For instance:

<?xml version="1.0"><string>your argument goes here</string>

So how can these messageparts be assembled? Well, for this purpose, pipeline components were invented! I have a created a custom assembler which transform an incoming message to the various messageparts. So, to give you an example:

 Let's say you have a webservice that takes two parameters: a string (called naam) and a datetime (called datum). First thing you do is create a schema with a single rootnode. This node should contain all primitive arguments as separate childnodes. Like so:

Next you are able to create an ordinary BizTalk map, transforming whatever input document to this schema. Then, you create a pipeline which in turn contains a custom pipeline component. This components takes each childnode in the document instance, looks up the appropriate schema for element typing, and generated an IBaseMessagePart for each element. Ofcourse, it copies the value of each node as well.

After assiging the pipeline and the map to the correct sendport, messages are sent to the webservice. And no orchestration is required!

Download the source here! It needs some additions, for instance when you want the process an answer with primitive types before handing it to a inbound map. Please leave comments or tips.

Posted on Wednesday, February 18, 2009 2:44 PM BizTalk | Back to top


Comments on this post: Calling a webservice with primitive types

# re: Calling a webservice with primitive types
Requesting Gravatar...
Hi, I think the source link is broken!
Can you fix it please?
Thanks
Left by Sergio on Mar 03, 2010 4:55 PM

# re: Calling a webservice with primitive types
Requesting Gravatar...
I'll check my local drive. Have a few days patience.
Left by Jasper on Mar 05, 2010 6:35 PM

Your comment:
 (will show your gravatar)


Copyright © Jasper Defesche | Powered by: GeeksWithBlogs.net | Join free