|
Home > Archive > BizTalk Server General > May 2004 > Converting a Schema message to a string message and vice-versa
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Converting a Schema message to a string message and vice-versa
|
|
| Paul Hutchinson 2004-05-25, 4:37 pm |
| Hi,
I have a web service with the signature:
[WebMethod(Description="Process Batch XML string.",
EnableSession=true)]
public string Process(string strXml)
Within this method I validate the XML string passed in against a
schema, process it in some way and send a response string that also
conforms to a schema.
In Biztalk 2004 I simply want to have a receive location folder to
drop an xml file into, and Biztalk pass this xml to the web method
above and then pass the xml string response to an output folder in the
form of an xml file.
I setup a Receive port and Receive object that accepts an xml file as
per the schema defined by my web service and a Send port and Send
object to output an xml file of the response schema format defined for
my web service.
I have the configured port that links with my web service and the
related messages to send/receive with it.
How do I map my schema'd receive biztalk message to a biztalk web
service message of type string?
Thanks,
P
| |
| Andres Felipe Arguello 2004-05-25, 4:37 pm |
| The idea of the web service call is the generation of the SOAP XML, this
includes the string that you need to pass, when you open call the webmethod,
biztalk generate the SOAP message, the only thing you need to pass is teh
XML, this can be done with some functoid, or if you can't make this with a
fucntiod, script a functoid, pass the root of the XML and send
message.outerXML.
"Paul Hutchinson" <pshutchinson@hotmail.com> wrote in message
news:a58e8e3b.0405250723.6d834ee8@posting.google.com...
> Hi,
>
> I have a web service with the signature:
>
> [WebMethod(Description="Process Batch XML string.",
> EnableSession=true)]
> public string Process(string strXml)
>
> Within this method I validate the XML string passed in against a
> schema, process it in some way and send a response string that also
> conforms to a schema.
>
> In Biztalk 2004 I simply want to have a receive location folder to
> drop an xml file into, and Biztalk pass this xml to the web method
> above and then pass the xml string response to an output folder in the
> form of an xml file.
>
> I setup a Receive port and Receive object that accepts an xml file as
> per the schema defined by my web service and a Send port and Send
> object to output an xml file of the response schema format defined for
> my web service.
>
> I have the configured port that links with my web service and the
> related messages to send/receive with it.
>
> How do I map my schema'd receive biztalk message to a biztalk web
> service message of type string?
>
> Thanks,
>
> P
| |
| Todd Sussman 2004-05-30, 10:46 am |
| We do the same thing in my company. When you make a reference to the Web
Service, it will create a schema for you. The resulting schema should be
expecting a string. It will look a little like this;
<WebServiceRequest>
<String></String>
<WebServiceRequest>
<WebServiceResponse>
<String></String>
<WebServiceResponse>
Create a variable with an XxlDocument type.
Now, to put a string in to the tag, use an expression shape with code like
this;
XmlDocument = BizTalkMsg;
WebServiceRequest.String = XmlDocument.OuterXml;
And vice-a-versa for the response
XmlDocument.LoadXML(WebServiceResponse.String);
BiztalkMsg = XmlDocument;
Good Luck
--
Todd Sussman
My opinion is neither copyrighted nor trademarked, and it's price
competitive. If you like, I'll trade for one of yours.
Remove The REMOVE! to reply.
"Paul Hutchinson" <pshutchinson@hotmail.com> wrote in message
news:a58e8e3b.0405250723.6d834ee8@posting.google.com...
> Hi,
>
> I have a web service with the signature:
>
> [WebMethod(Description="Process Batch XML string.",
> EnableSession=true)]
> public string Process(string strXml)
>
> Within this method I validate the XML string passed in against a
> schema, process it in some way and send a response string that also
> conforms to a schema.
>
> In Biztalk 2004 I simply want to have a receive location folder to
> drop an xml file into, and Biztalk pass this xml to the web method
> above and then pass the xml string response to an output folder in the
> form of an xml file.
>
> I setup a Receive port and Receive object that accepts an xml file as
> per the schema defined by my web service and a Send port and Send
> object to output an xml file of the response schema format defined for
> my web service.
>
> I have the configured port that links with my web service and the
> related messages to send/receive with it.
>
> How do I map my schema'd receive biztalk message to a biztalk web
> service message of type string?
>
> Thanks,
>
> P
| |
| Paul Hutchinson 2004-05-30, 10:46 am |
| Thanks for you replies - have got a bit further;
Todd - have followed your approach and found that I could not put both lines of the code in an expression object and had to create a 'ConstructMessage' object with a 'MessageAssignment' object in it for the line of code containing the code to assign the m
essage property.
However, this all seems to look fine and not give me any red exclamation marks on the objects but when I attempt to build the orchestration I get:
"a non-serializable object type 'System.Xml.XmlDocument xmlDoc' can only be decalred within an atomic scope or service"
Where am I going wrong here - do I have to set the orchestration to be inside a transaction or something?
Your help is much appreciated!
Paul
| |
| Paul Hutchinson 2004-05-30, 10:46 am |
| Managed to solve this - put the 'Expression' and 'MessaqeAssignment' objects into Atomic Scope objects and declared the XmlDocument variables local to the scope and now builds fine.
Thanks for everyones help!
|
|
|
|
|