Friday, February 09, 2007

Exposing Orchestration as Web Service

Created a very simple orchestration and then deploy it as a web service. Inside the orchestration, on the message assignment calculate the age of the customer based on a distinguished property (BirthYear). Then place this calculated field back into the message for the Age element.

Here is the schema being used:

This is the simple orchestration to test this

On the construct shape, this is the code inside the assignment shape:
outMsg = InMsg;
iAge = System.DateTime.Now.Year - InMsg.BirthYear ;
outMsg.Age = iAge;

Configuration basic:

The port is setup as a One-Way port with Public - no limit for the access restrictions.

On the IIS manager, removed all of the restrictions

when publishing the orchestration, select the following settings:

the Namespace in here is the same namespace than the schema used inside the orchestration. However this is not a requirement for the Orchestration to work.

Once this orchestration is published. Trying to call it from a GUI client (web studio, Windows forms, etc...) you might get several distinct errors on the Application Event Log.

a. Isolated Host
When trying to call it, if you get this error in the Event Log:

The Messaging Engine failed to register the adapter for "SOAP" for the receive location "/SimpleWeb_Proxy/SimpleWeb_Main_IncomingPort.asmx". Please verify that the receive location exists, and that the isolated adapter runs under an account that has access to the BizTalk databases.

This error, tells you that you have not configure the isolated host correctly. The account used, is not part of the Isolated Host User Group.

b. Routing Failure
Event Type: Error
Event Source: BizTalk Server 2006
Event Category: BizTalk Server 2006
Event ID: 5778
Date: 2/11/2007
Time: 1:04:37 PM
User: N/A
Computer: QSI_TEST
The Messaging engine failed to process a message submitted by adapter:SOAP Source URL:/SimpleWeb_Proxy/SimpleWeb_Main_IncomingPort.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.

For more information, see Help and Support Center at

The message will be suspended. Looking at the Hub Group you can see why this message is being suspended: 0xC0C01B4e(Routing Failure Report).

Right click on the Routing Failure Entry, and then select Troubleshoot Routing Failure, then select Find failed service instance.

If you look at the service details of the message, you can see that the Message Type is empty.

When the message type is empty or not defined, it might be because the pipeline define in the receive location was not set to be an XML pipeline. Change the pipeline and it should work.


Si said...

After changing my pipeline to XML Receive, still no MessageType property is promoted. Even with a custom XML Disassembler component set to the specific document schema :(

Si said...

Never mind, i discovered why - i had renamed the web service class and the webmethod from the obscure names that the wizard had generated. Although the web service still ran exactly as expected, and passed through a message on the correct port, the MessageType property was not promoted.

Re-running the wizard and leaving everything with the default, somewhat ugly names fixed the issue.

Arnulfo Wing said...

Good. Sorry I just saw your post. BTW, you can actually change those long names that the wizard creates. If you take a look at the code generated you can see where the wizard generates those LONG names. Then you can use partial classes to move your static code to a separate file. [I will write a blog post on this soon... ;)


Anonymous said...

I made sure my account is set up properly i.e is part of the Isolated Host User Group,

but still get the error
The Messaging Engine failed to register the adapter for "SOAP" for the receive location "/MyWebServices/MyService.asmx". Please verify that the receive location exists, and that the isolated adapter runs under an account that has access to the BizTalk databases.

Any ideas?

Arnulfo Wing said...

BizTalk is not very good at putting out meaningful messages. One thing that you can try is to see if IIS is rendering the page. Go to the IIS manager, select your site and right click on the asmx. Select browse from it and see if it renders the wsdl from it. The next step is to check the application pool. One more thing is: are you running IIS 6? or IIS 7?

Friends said...

I followed same as this post. However it is not working for me. I am not sure what i did wrong.
created request-response port with public - no limit in orchestration.
Then run the BizTalk web services publishing wizard. I selected the following:

Publish biztalk orchestration as web services.
Then selected the project assemply dll. It selected port for me(i have only
one publis-no limit port).
My input schema doesn't have target namespace. Since i can not leave target
name space blank in web service properties, I put http://samplexmlpoweb.
I left the location as default, selected allow anonymous access to web
service and create biztalk receive location in the following application - to
my project application.

Binded ports and started the orch. I wrote a sample vb scrip to post xml to
above web service using xmlhttp post. When i run the script it looks like it
is not working. Eeven i couldnt get to the web service from explorer using
http://localhost/samplexmlpo_proxy/web_service_Name.asmx. I even browse the
web service from IIS/default web site/. It is not working. I am getting "the
page connot be displayed".

What did i do wrong here? Do i need listen shape or something in
orchestration? How can i test orch-web service?

Thank you in advance,

Si said...

If you cannot browse to the web service, then it's pretty unlikely that it will work from within BizTalk.

Inernet Explorer by default hides certain error messages, which is why you are getting "Page cannot be displayed" - to enable the display of these messages, go to Tools -> Internet Options -> Advanced -> Browsing and unchech "Show friendly HTTP error messages." Refresh the page, and you should be able to see the error message being generated by the web service.

Arnulfo Wing said...

Friends, I think it might be your IIS configuration not rendering the page correctly.  One tool that use a lot when testing my Web Services is the Web Service Studio.  Now if you have .NET 3.x you can use the WCF Test client tool . Another tool that you can use to test your web service is InfoPath.  If you can get your input/output correctly from one of these tools, then you know it might be something related to your security or your IIS.

Arnulfo Wing said...

Thanks Si. Your help tips are very much appreciate.!

Friends said...

Hi Guys,thank you for helping out. I am getting following message when I browse the orchestration web service from IIS. "%1 is not a valid Win32 application. "
Do i have to put biztalk solution and orchestration web service solution under same folder? My biztalk project is under D:/samplexmlpo and orches web service under C:/inetpub/wwwroot/samplexmlpoweb

Si said...

From that error message it looks like you're running on 64 bit so can't really offer a lot of help, have you tried setting the worker processes to run in 32 bit mode?

Friends said...

Thank you for helping on this issue Si,
I am running BTS 64 bit on win 2003 r2.
I am not sure what is "tried setting the worker processes to run in 32 bit mode?
" Could you tell me how to do this?

Arnulfo Wing said...

Friends, I am running Vista x64, and to get BizTalk to work with it, I've created an In-Process host type and under the options for it, you can select it to be 32-bit only.  Check on your Platform Settings | Hosts.  Double-click on your host entry and under the General area, there is an Options frame where you can specify this host to run under 32-bit only.  Hope this helps.

Friends said...

Hi Arnulfo,
Yes, my biztalk host in-process running under the "32-bit only".
Do i need to check any set up or anything?

Friends said...

Hi guys,
I think i fixed the issue. My ASP.NET installation was messed up. I just reinstall it and i could view the web serivce.
Can I do nomal http post on this web service? something like
set xmlhttp = createObject("Msxml2.XMLHTTP")
xmlhttp.Open "POST", "http://localhost/samplexmlpoWeb/samplexmlpo_orch1_port1_samplexmlpo_webservice.asmx", false
xmlhttp.setRequestHeader "Content-Type", "text/xml"
xmlhttp.Send s

where s is xml file path

It looks like i can not use orchestration as web service for normal http post.
Client want to send http post without any soap header. Would it be possible to make a .aspx or web service page to accept response, invoke orchestration and return response?

Rajasekhar said...

It is really Usefull..