SOAP Adapter and BizTalk Web Publishing Wizard - things you need to know.

Posted at: 8/17/2007 at 4:42 AM by saravana

Exposing an Orchestration as Web Service:

This is the safest option you can choose, when you want to expose your business process as an industry standard web service, which can later be consumed by a client (consumer) either using a web service proxy or HTTP post of correctly formatted SOAP message.

There is a very good article in MSDN http://msdn2.microsoft.com/en-US/library/ms935219.aspx explaining how you can expose your orchestration as web service.

Let's assume you have exposed your orchestration as web service, bound the inbound logical port to the auto-generated SOAP receive port (created by the wizard) and enlisted-started the Orchestration. Now, when you look at the activation subscription details for the Orchestration it will look something similar to the one shown below:

 

SNIPPET #1

http://schemas.microsoft.com/BizTalk/2003/system-properties.ReceivePortID == {73684F88-8D5C-4659-9E8F-F1B5E6E9A780} And

http://schemas.microsoft.com/BizTalk/2003/system-properties.MessageType == http://www.digitaldeposit.net/samples/schema/1.0#personRequest And

http://schemas.microsoft.com/BizTalk/2003/system-properties.InboundTransportType != SOAP

Or

http://schemas.microsoft.com/BizTalk/2003/system-properties.ReceivePortID == {73684F88-8D5C-4659-9E8F-F1B5E6E9A780} And

http://schemas.microsoft.com/BizTalk/2003/soap-properties.MethodName == GetPersonDetail

 

When you are receiving the messages via the auto-generated SOAP receive port the properties MethodName and ReceivePortID will get promoted by the SOAP adapter and the orchestration will get the message due to second subscription condition. (MethodName will equate to the Operation name you defined inside the logical port within your Orchestration)

If you inspect the first condition carefully, you'll see "if MessageType property is present then the receive adapter should NOT be SOAP". Also, the auto-generated SOAP ReceiveLocation uses PassThru pipeline, which results in MessageType property not being promoted.

This design introduces two potential problems

 (LISTING #1)

  1.  
    1. Configuring MAP(S) on the auto-generated SOAP receive port will be ignored.
    2. Properties (distinguished and promoted) defined in the schema wont get into the context.

Maps will be ignored on the auto-generated SOAP Receive Port:

Usage of PassThru pipeline inside the auto-generated SOAP ReceiveLocation is bit contrary when you are using Orchestrations and dealing with XML messages. Majority of the time Orchestration subscriptions will be based on MessageType you specified on the Activation receive shape and you'll be using XmlReceive pipeline on your ReceiveLocation, so that MessageType and other property promotions (both distinguished and promoted properties defined in the schema) gets into the context. Since the MessageType property is NOT promoted anywhere in the ReceivePort (mainly due to the usage of PassThru pipeline), any MAP you configure on the ReceivePort will be ignored.

Due to the configuration of PassThru pipeline by default, any properties (both distinguished and promoted) defined in your schema won't get into to the context, which creates potential problem if you want to use content based routing.

We can fix these problems easily, by modifying the auto-generated SOAP ReceiveLocation to use XmlReceive pipeline instead of PassThru. As I mentioned in the beginning "Exposing orchestration as web-service" is the safest option, it doesn't introduce too much head aches. The problem really starts when you just want to expose your schemas as web services as explained in next topic.

Exposing schemas as web services:

The MSDN article http://msdn2.microsoft.com/en-US/library/ms935219.aspx got clear explanation of exposing schemas as web services.

After exposing your schemas as web-services using "BizTalk Web Publishing" wizard, you can create an Orchestration to consume the messages published by the auto-generated SOAP ReceivePort. The important thing to note here is the name of the "Operation" you define inside the logical port, make sure it matches the WebMethod name you have specified while generating the web-service. As shown in the below figure:

image

When you bind the logical orchestration port to physical auto-generated SOAP ReceivePort and start (enlist) the orchestration, the subscription for the orchestration will look identical to the one shown in SNIPPET #1 (earlier).

We'll hit the same problems (explained in detail earlier) outlined under "Exposing an Orchestration as web service"

  1. Map won't get applied
  2. Properties (distinguished and promoted) won't get into context

Due to the fact, the auto-generated SOAP ReceiveLocation uses PassThru pipeline by default.

If you modify the auto-generated SOAP ReceiveLocation to use XmlReceive pipeline instead of PassThru (hoping its going to fix all the problems, as we did with "Exposing an Orchestration as web service") the run-time will generate the following exception when it receives the message:

There was a failure executing the receive pipeline: "Microsoft.BizTalk.DefaultPipelines.XMLReceive, Microsoft.BizTalk.DefaultPipelines, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Source: "XML disassembler" Receive Port: "WebPort_SK.ws.viaSchemas.1_0/WebService1" URI: "/SK.ws.viaSchemas.1_0/WebService1.asmx" Reason: The type SK.Schemas.Person_1_0 is not a valid part type for a message. This invalid type may be from a property schema.

The exception is mainly raised because SOAP adapter puts the wrong DocumentSpecName property in the message context and hands over the message to the pipeline. PassThru pipeline (DEFAULT Configuration on auto-generated SOAP ReceiveLocation) doesn't do any processing, so whatever value present in the property DocumentSpecName is ignored. On the other hand if you configure XmlReceive pipeline which uses XmlDisassembler, it will utilizes the "DocumentSpecName" property to resolve the schema.

Behavior of XmlDissambler inside the XmlReceive pipeline:

Having the DocumentSpecName property in the context, will force XmlDissambler pipeline component to use it, to locate your schema. If DocumentSpecName is NOT present then XmlDissambler pipeline component will go through dynamic schema resolution mechanisms to get the correct schema. Since DocumentSpecName is present with wrong value, XmlDissambler throws the exception and it clearly states "This invalid type may be from a property schema".

There are few ways you can get away from this problem

Solution #1: Use PassThru pipeline and Orchestration (DEFAULT config):

If you don't have any inbound maps to be applied on the port level and you are not dependant on promoted properties (distinguished and promoted) defined in the schema outside the orchestration, then you can use PassThru pipeline (configured by default by auto-generated SOAP receive location). The Orchestration gets the message by other subscription conditions (ex: MethodName) without the need for MessageType.

  1. You can get away from the MAP problem by applying it inside your orchestration, and
  2. You automatically get away from property promotion problem. Because when the orchestration receives a message the IBaseMessage (from adapter/pipeline) is converted into a XLANG message, which results in the process of new message construction (since messages are immutable in BizTalk server). During this step all the distinguished and promoted properties gets into the context. [This is my own prediction of how distinguished fields and promoted properties gets into the context automatically within Orchestration even though we used PassThru pipeline, I couldn't find clear documentation explaining it] and available within the Orchestration.

Solution #2: Modify the generated .asmx.cs code. Passing null instead of bodyTypeAssemblyQualifiedName:

By passing the value “null” instead of bodyTypeAssemblyQualifiedName both the problems defined in Listing #1 can be solved

//Original Code

string bodyTypeAssemblyQualifiedName = "SK.Schemas.Person_2_0, SK.Schemas, Version=1.0.0.0, Culture=neutral, PublicKeyTok" +

"en=c2b0cafd9314ef3e";

// BizTalk invocation

object[] invokeResults = this.Invoke("GetPersonDetail", invokeParams, inParamInfos, outParamInfos, 0, bodyTypeAssemblyQualifiedName, inHeaders, inoutHeaders, out inoutHeaderResponses, out outHeaderResponses, null, null, null, out unknownHeaderResponses, false, false);

//Modified Code

// BizTalk invocation

object[] invokeResults = this.Invoke("GetPersonDetail", invokeParams, inParamInfos, outParamInfos, 0, null, inHeaders, inoutHeaders, out inoutHeaderResponses, out outHeaderResponses, null, null, null, out unknownHeaderResponses, false, false);

If the value null is passed instead of bodyTypeAssemblyQualifiedName, SOAP adapter won't add the DocumentSpecName property to the context. Now, when we configure our auto-generated SOAP ReceiveLocation to use XmlReceive pipeline, the XmlDisassembler component inside XmlReceive will go through the process of automatic dynamic schema resolution mechanism, pick up the correct schema and promotes all the required properties (distinguished and promoted) defined in the schema and it also promotes the MessageType property.

Solution #3: Modify the generated .asmx.cs code. Change bodyTypeAssemblyQualifiedName property to include the schema root node.

We are going to follow a similar approach here, but instead of passing null”for bodyTypeAssemblyQualifiedName, we are actually going to pass the correct value.

//Original Code

string bodyTypeAssemblyQualifiedName = "SK.Schemas.Person_2_0, SK.Schemas, Version=1.0.0.0, Culture=neutral, PublicKeyTok" +

"en=c2b0cafd9314ef3e";

//Modified Code

string bodyTypeAssemblyQualifiedName = "SK.Schemas.Person_2_0+personRequest, SK.Schemas, Version=1.0.0.0, Culture=neutral, PublicKeyTok" +

"en=c2b0cafd9314ef3e";

The only difference is we are appending the schema root element name to the schema Type Name. You can see the correct DocumentSpecName name by

  1. Add a Receive Pipeline to your project (or to a dummy project),
  2. Drag-Drop a XmlDisassembler component
  3. Select XmlDisassembler and in the properties window, click on button next to the "Document Schemas" property. You’ll see "Schema collection property editor" window as shown in the below figure, which clearly shows the expected "DocumentSpecName" name.

image

When you expose your Orchestration as web service the auto generated code will look similar to our modified code.

NOTE: You need to be careful with Solution #2 and #3, because regenerating the web-service code will result in losing the manual changes you performed.

You can download the ZIP file containing all the sample projects I used for this research.

Nandri!

Saravana

Tags: | | |  Categories: BizTalk General
Actions: Email this article Email | Kick it! | DZone it! | Save to del.icio.us | Technorati Links
Post Information: Permanent LinkPermalink | CommentsComments(58) | Comments RSS

Comments

Friday, August 24, 2007 4:27 PM
zoeh
This posting was a lifesaver. I am exposing some schemas as web services. I was not able to use PassThruPipeline because my orchestration subscription relied on a promoted field - so knowing that the fields were promoted later in the orchestration didn't help me. But I successfully implemented your Solution #2, modifying the generated web service code to send null for DocuemntSpecName and configuring the receive port for XMLReceive. It works great - a huge relief after days of fruitless debug. Thanks!
Friday, September 07, 2007 7:32 PM
Anonymous
Anonymous
Sarvana, this is great post..thanks !!!!

I tried the solution#2 (for exposing schema as webservice) and used xmlRcvPipeline and xmlTransitpipeline.

I got an error when sending the response back from orchestration.

"This Assembler cannot retrieve a document specification using this type: "http://TestDime.TestResFile#ResponseWS"."

Sending request to orchestration works fine but the prob is when orchestration sends response back.
Wednesday, January 23, 2008 9:49 AM
Richard Hallgren
Excellent post. Thanks!
Tuesday, February 12, 2008 11:07 AM
U3
U3
Sarvana great post , but I need to know when to expose the Schemas as a web service and when to expose the orchesteration as a web service !!! could you please give us an example the need of each one !!!

Another Ques : Do you think that the "Professional BizTalk Server 2006 " will help to pass the MCTS ?
Wednesday, April 30, 2008 4:35 PM
Anonymous
Anonymous
Hi,

Thanks for the post. I've one query, it would be great if you can help me in it. I have an orch which is exposed as webservice and accepts a msg say Msg1. How when the client consumes it, the operation exposed will have input param of Msg1. What i want to achieve is exposed Msg1 as parameter but it receive port transform it to Msg2 and use that Msg2 in my orch which is exposed as webservice. Can i use map in receive port of webservice and transform it to Msg2. But still my receive shape will have Msg1 as msgtype. How can i get Msg2 in my orch.
Wednesday, April 30, 2008 4:38 PM
Saravana Kumar
Why can't you just receive MSG1 into orchestration and then do a transformation inside the Orchestration to MSG2?
Wednesday, April 30, 2008 4:55 PM
Anonymous
Anonymous
Thanks Saravana for the quick response. I can do the transform of MSG1 to MSG2 in orchestration. But my only concern is i want to avoid doing the transformation in orchestration and see if i can use the same thing in web receive port. I have done transformation in pipeline but the endpoints are MSMQ/FILE... but how can i do for webservice. If there is no alternative i have to do it in orch, but just want to avoid it.

Any ideas...

-Thanks
Tuesday, May 27, 2008 2:13 PM
Vijay Modi
Really very nice blog.

Vijay Modi
http://vijaymodi.wordpress.com/
Friday, September 05, 2008 10:54 AM
saravana
When you say, "you receive 2 messages to the orchestration", are you getting 2 messages published to the message box by the SOAP adapter (Receive pipeline)?  
Wednesday, November 12, 2008 12:53 PM
pingback
Pingback from richardhallgren.com

  Handle the "bodyTypeAssemblyQualifiedName" SOAP Adapter bug in MSBuild as a RegEx ninja by .RICHARD
Tuesday, January 27, 2009 10:37 AM
Karthik United Kingdom
Karthik
Hi Saravana,
I have design query please let me know this is feasible.I made schema as webservice .The webmethods is request - response webmethods .The schema is now published as a webservice and 1 receive location is created.

Issues.The schema webservice webmethods will be invoked by .netwebservice and sends a request.The biztalk receive location is succesfully able to receive the message and i map this message in send port .The mapped message will be going to SAP as request and it sends back the response synchronous.Now how i can send back the response back to the caller i mean .NetWebservice.
Saturday, January 31, 2009 9:09 AM
saravana
Hi Karthik,

Have a look at this article www.digitaldeposit.net/.../...-based-Routing).aspx parts of it may be useful for your case.

Regards,
Saravana
Wednesday, July 14, 2010 12:49 PM
quick money loan
Speak what you think to-day in words as hard as cannon-balls and to-morrow speak what to-morrow thinks in hard words again, though it contradict every thing you said to-day.
Saturday, July 17, 2010 6:52 AM
data cleansing software
I am a huge lover of your blog! Look at my website, You can submit your blog there!
Monday, July 19, 2010 10:01 AM
pay day loans
Pretend that every single person you meet has a sign around his or her neck that says, Make Me Feel Important. Not only will you succeed in sales, you will succeed in life.
Sunday, July 25, 2010 12:35 PM
spelletjesspelletjes.com
Good points in your write-up, you have a fun website here. Thanks for the ideas.
Sunday, July 25, 2010 11:00 PM
http://www.gamescosmos.com
wow this is Impressive! This is the first time I have visited your website and like it.
Monday, August 02, 2010 12:25 AM
lenen
Over de voor- en nadelen van het afsluiten van een lening zonder BKR-toetsing.
Thursday, August 05, 2010 1:45 AM
Seattle Limos
I didn't see a link anywhere but do you have advertising? I have several blogs in the same niche and I'd like to add my banner somwhere on your site. This site seems to have a lot of discussion and visitors.
Saturday, August 07, 2010 4:50 AM
Timberland Boots sale
I had just finished reading your articles,and this is very good! timberland boots uk Being a comprehensive trade solution provider offering sale services with free shipping to international buyers who are interested in shopping online.The products here are timberland boots outlet, timberland roll top boots and men timberland boots. As an online business platform mainly retailing, waterproof boots we provide our buyers with an efficient and manageable procurement process covering every phase of the international supply chain and streamlining trade channels. Also welcome wholesaling, feedback now!www.timberlandshoesonline.com
Saturday, August 07, 2010 3:52 PM
Nude Cam
I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post
Saturday, August 07, 2010 4:19 PM
Cam Girls
Your post really made me think, have you any further reading you would recommend?
Tuesday, August 10, 2010 12:21 AM
hypotheek
Bereken zelf uw hypotheek. Hypotheek berekenen? Maak snel een indicatieve berekening van het maximale leenbedrag van uw hypotheek.
Friday, August 13, 2010 1:41 AM
AJF 20
All of us have hobbies. And our hobbies are changing all the time. I used to listen to music. Because I thought it could make me relaxed and happy. But now I don't enjoy it. I am interested in collecting stamps. These old stamps, some of them are of great value. I think it's very interesting.
http://www.cheapjordans.cc/nike-jordan-ajf20-37/
Friday, August 13, 2010 2:58 AM
Jordan 11
Rumor is the most primitive way of spreading stories—by passing them on from mouth to mouth. Pessimistic rumors about defeat and disasters show that the people who repeat them are worried and anxious. Optimistic rumors about production record or peace bring about confidence---and often overconfidence.
http://www.airjordan.cc/air-jordan-11-44/
Friday, August 13, 2010 2:59 AM
Jordan 11
Rumor is the most primitive way of spreading stories—by passing them on from mouth to mouth. Pessimistic rumors about defeat and disasters show that the people who repeat them are worried and anxious. Optimistic rumors about production record or peace bring about confidence---and often overconfidence.
http://www.airjordan.cc/air-jordan-11-44/
Friday, August 13, 2010 9:25 AM
Supra Vaider High
Good page. It's useful to study your blog. The information of your site is precisely excellent, and your blog design is Simple good.
Tuesday, August 17, 2010 3:30 PM
Prada Shoes
little bit of a long read, but very informative and well written. Thanks.
Friday, August 20, 2010 7:23 AM
Supra Skytop
Good blog, I enjoy to post information since it gives bloggers for being more engaged and for the possibility to perhaps study from each other. It's a good chance for me. I will crazy the chance to improve my ability. Thanks for your sharing.
Friday, August 20, 2010 9:33 AM
Blova Accutron
Hold yourself responsible for a higher standard than anyone else expects of you. Never excuse yourself. Thank You. . .
Said by <a href="http://www.obwatches.com/">Breitling Watches</a>.<br>
Friday, August 20, 2010 9:53 AM
Blova Accutron
Hold yourself responsible for a higher standard than anyone else expects of you. Never excuse yourself. Thank You. . .
Said by <a href="http://www.obwatches.com/">Breitling Watches</a>.<br>
Saturday, August 21, 2010 8:51 AM
bangkok flowers
Really like this website, this really helps and very useful.I love flowers...I am also interested to send flowers all over the world....
Monday, August 23, 2010 2:36 AM
air force ones
Your publish are so excellent, I noticed a great number of exciting things within your weblog in particular its discussion. maintain up the wonderful function.
Wednesday, August 25, 2010 8:31 AM
Master Key
Post is very informative,It helped me with great information so I really believe you will do much better in the future.
Wednesday, August 25, 2010 8:33 AM
crm software in
I wanted to thank you for this great read. Your blog is one of the finest blog . Thanks for posting this informative article.
Wednesday, August 25, 2010 8:37 AM
desktop virtualization
I like reading your articles. I absolutely enjoyed every little bit of it. I have you bookmark your blog to check out the new stuff in future.
Wednesday, August 25, 2010 4:46 PM
Forex
Great post! I'm just starting out in community management/marketing media and trying to discover how to do it nicely - resources like this post are incredibly useful. As our company is dependent in the US, it?s all a bit new to us. The example above is something that I worry about as well, how to show your personal genuine enthusiasm and share the truth that your item is helpful in that case.
Monday, August 30, 2010 10:09 AM
article writing Dubai
Nicely presented information in this post, I prefer to read this kind of stuff. The quality of content is fine and the conclusion is good. Thanks for the post.
Tuesday, August 31, 2010 10:50 PM
reasons for procrastination
Have you considered adding some relevant links to the article? I think it might enhance everyone's understanding.
Tuesday, August 31, 2010 11:09 PM
web reputation management management}
When are you going to post again? You really inform  a lot of people!
Tuesday, August 31, 2010 11:47 PM
acer ferrari
Amazing article, thank you, I will bookmark you later.
Wednesday, September 01, 2010 12:50 AM
resturants in the woodlands
Brilliant, thank you, I will bookmark you now!
Wednesday, September 01, 2010 7:41 AM
Dubai Apartments
I have been reading your posts regularly. I need to say that you are doing a fantastic job. Please keep up the great work.
Wednesday, September 01, 2010 2:56 PM
buy my house
Good informative post. I will visit your site often to keep updated.
Wednesday, September 01, 2010 2:56 PM
we buy houses
great and interessting post
Wednesday, September 01, 2010 2:56 PM
sell my house
i bookmarked your blog, keep posting good stuff Smile
Wednesday, September 01, 2010 5:06 PM
Eugene
This really solved my problem, thank you!
Wednesday, September 01, 2010 5:22 PM
How Much Does Christina Hendricks Weigh?
When are you going to post again? You really entertain  a lot of people!
Wednesday, September 01, 2010 5:22 PM
Eugene
Cool post ! Thank you for, writing on my blog page dude. I will message you some time! I didn't know that!
Wednesday, September 01, 2010 5:51 PM
plus size lingerie
Oh man. This blog site is cool! How did you  make it look this good !
Wednesday, September 01, 2010 5:57 PM
Fort Irwin CA
Brilliant, thank you, I will visit again later.
Wednesday, September 01, 2010 6:06 PM
starcraft 2 guide
Just discovered this site thru Bing, what a way to brighten up my month!
Wednesday, September 01, 2010 6:15 PM
warcraft leveling
Brilliant, thanks, I will visit again now.
Wednesday, September 01, 2010 7:55 PM
Ask the Doctor
How do you make this blog site look this sick. Email me if you want and share your wisdom. I'd appreciate it!
Wednesday, September 01, 2010 7:56 PM
Free Stock Picks
How did you make a blog site look this awesome. Email me if you want and share your wisdom. I'd be thankful!
Wednesday, September 01, 2010 7:57 PM
money making tips
Wow! This website is cool! How can I  make it look this good .
Wednesday, September 01, 2010 8:18 PM
life insurance settlement
I like that website layout . How did you make it!? It is rather sweet!
Thursday, September 02, 2010 12:57 PM
Dubai Apartments
I really love your weblog, Its great to find not absolutely everyone is just posting a ton of rubbish these days!

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading