Exposing BizTalk Schemas as a SOAP-RPC/Encoded webservice

By vincent
January 12, 2010

Yesterday I had to connect a Delphi back-end system to the BizTalk 2006 R2 environment of my customer. Since this Delphi system could only call webservices exposed as SOAP-RPC/Encoded, I had to expose the needed schemas as such.

While searching on this subject I found a good post of Tomas Restrepo on consuming SOAP-RPC/Encoded webservices: http://winterdom.com/2005/07/consumingrpcencodedwebservicesfrombiztalk.

This explains how you have to work with multipart messagetypes to call a SOAP-RPC/Encoded webservice. At first I figured I would have to do something alike to expose my schemas as a SOAP-RPC/Encoded webservice. However, this is actually very easy.

With the .Net framework you can easily expose a webservice as SOAP-RPC/Encoded by setting the correct attribute on the webmethod. To achieve this you should do the following to the generated webservice code after exposing your schemas as a webservice using the default BizTalk Web Services Publishing Wizard:

  1. Comment out (or delete) the SoapDocumentMethodAttribute on the WebMethod and the SoapDocumentServiceAttribute on the class that are set by default by the wizard.
  2. Set the SoapRpcMethod attribute on the WebMethod and the SoapRpcService attribute on the class.
  3. You can set parameters on both new attributes to change the behaviour and settings of the SOAP-RPC/Encoded service

That’s it. Since the .Net Framework creates an object based on your schema of the webrequest and uses this to call BizTalk, you don’t have to change anything on the BizTalk side to expose your schema’s as a SOAP-RPC/Encoded webservice. Now that is easy!

While on the subject of exposing schemas as a webservice: the generated webservice has ‘ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Default‘ set on the SoapDocumentMethodAttribute by default. This causes an extra node in the envelope body named like the WebMethod’s name. If you don’t want this extra node, you can set the ‘ParameterStyle’ to ‘System.Web.Services.Protocols.SoapParameterStyle.Bare‘ and the extra node is not used anymore.

Comments: 0

Leave a Reply

Your email address will not be published. Required fields are marked *