views:

605

answers:

2

Hi!

I published an orchestration in Biztalk as a webservice. Does anyone know how I can use XML serialization or something to load XML from a file and "convert" it to the messagetype the webservice expects? How do people usually use this webservices? I try to avoid using untyped messages since I use both XML and flatfile, and have read that it could mean trouble.

A: 

Well, I guess generally the idea of web services is that you add a web reference to them, which would generate a set of proxy classes you could use to interact with the web service.

You don't normally have to worry about serialising xml files to and from the web service formats, the generated code will do it for you.

If you do wish to, however, to work of XML, you could use .net serialisation to deserialise an xml file into the generated proxy type (as well as serialise any response you're getting).

Here's a basic example of how to deserialise xml into a class instance, you can then pass this instance into the method in the generated proxy.

            System.Xml.Serialization.XmlSerializer xser = new System.Xml.Serialization.XmlSerializer(typeof(<generated request type here>));
        xser.UnknownAttribute += new System.Xml.Serialization.XmlAttributeEventHandler(xser_UnknownAttribute);
        xser.UnknownElement += new System.Xml.Serialization.XmlElementEventHandler(xser_UnknownElement);
        xser.UnknownNode += new System.Xml.Serialization.XmlNodeEventHandler(xser_UnknownNode);
        xser.UnreferencedObject += new System.Xml.Serialization.UnreferencedObjectEventHandler(xser_UnreferencedObject);
        <generated request type here> request = (<generated request type here>)xser.Deserialize(<xml stream here>);

I hope that makes sense

Yossi Dahan
A: 

Hi Estranda,

You question is bit confusing. You started off with saying you published an orchestration as web service, but raised the question about consuming it.

If you are talking about published web service: The web service generated by BizTalk Web service Wizard is not different from a web service you would have written in .NET. Based on the message type you orchestration is expecting and how your structured the operation in the wizard. The Wizard would have auto generated a webservice for you with WSDL and schemas (there will be some BizTalk specific bits inside, but you don't need to worry about the implementation).

You consumers (independant of platform) should be able to consume that web service without any major issues.

If you are trying to consume a web service from Orchestration Have a look at this paper http://msdn.microsoft.com/en-us/library/ms935219(BTS.10).aspx

Saravana Kumar