|
Home > Archive > BizTalk Server General > May 2005 > Dataset - How to Obtain From Message
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 |
Dataset - How to Obtain From Message
|
|
| Steve Harclerode 2005-05-13, 2:54 am |
| I've been writing software for a long time, but am new to BizTalk.
I have an orchestration that needs to call a web service. One of the methods
that I need to call accepts a Dataset parameter. I'm able to write code in a
dotnet app that does the conversion from a Web service to a dataset, but I
need to be able to do it in BizTalk in an assignment shape.
The problem is that I can't seem to access the StringWriter & StringReader
types from within BizTalk. When declare a variable, and then I browse to
where the type should be under System.IO, it isn't there!
I'm including code below from my C# app that does the conversion I'm
attempting to implement:
StringWriter sw = new StringWriter();
XmlTextWriter xw = new XmlTextWriter(sw);
xmlDoc.WriteTo(xw);
string s = sw.ToString();
DataSet ds = new DataSet();
StringReader sr = new StringReader( s );
ds.ReadXml ( sr );
Thanks in advance. If you have suggestions for how to make this code a bit
more compact, I welcome that kind of feedback also.
- Steve
| |
| Steve Harclerode 2005-05-13, 2:54 am |
| Sorry, I forgot to mention that inside of BizTalk, I can create the
XmlDocument variable below by simple assignment from the message that I wish
to send.
- Steve
"Steve Harclerode" <sharclerode_REMOVE_THIS@ebisolutions.net> wrote in
message news:%23VEkRD2VFHA.1508@tk2msftngp13.phx.gbl...
> I've been writing software for a long time, but am new to BizTalk.
>
> I have an orchestration that needs to call a web service. One of the
> methods that I need to call accepts a Dataset parameter. I'm able to write
> code in a dotnet app that does the conversion from a Web service to a
> dataset, but I need to be able to do it in BizTalk in an assignment shape.
>
> The problem is that I can't seem to access the StringWriter & StringReader
> types from within BizTalk. When declare a variable, and then I browse to
> where the type should be under System.IO, it isn't there!
>
> I'm including code below from my C# app that does the conversion I'm
> attempting to implement:
>
> StringWriter sw = new StringWriter();
> XmlTextWriter xw = new XmlTextWriter(sw);
> xmlDoc.WriteTo(xw);
> string s = sw.ToString();
> DataSet ds = new DataSet();
> StringReader sr = new StringReader( s );
> ds.ReadXml ( sr );
>
> Thanks in advance. If you have suggestions for how to make this code a bit
> more compact, I welcome that kind of feedback also.
>
> - Steve
>
>
| |
| Yossi Dahan 2005-05-13, 2:54 am |
| There may be other solution if you post more details on what it is you're
trying to do, but as a general rule -
If you need to run c# code in an orchestration that is not supported in the
expression shape use a helper class -
Write a class that does the work and call it from the orchestration
Yossi Dahan
"Steve Harclerode" <sharclerode_REMOVE_THIS@ebisolutions.net> wrote in
message news:%23VEkRD2VFHA.1508@tk2msftngp13.phx.gbl...
> I've been writing software for a long time, but am new to BizTalk.
>
> I have an orchestration that needs to call a web service. One of the
> methods that I need to call accepts a Dataset parameter. I'm able to write
> code in a dotnet app that does the conversion from a Web service to a
> dataset, but I need to be able to do it in BizTalk in an assignment shape.
>
> The problem is that I can't seem to access the StringWriter & StringReader
> types from within BizTalk. When declare a variable, and then I browse to
> where the type should be under System.IO, it isn't there!
>
> I'm including code below from my C# app that does the conversion I'm
> attempting to implement:
>
> StringWriter sw = new StringWriter();
> XmlTextWriter xw = new XmlTextWriter(sw);
> xmlDoc.WriteTo(xw);
> string s = sw.ToString();
> DataSet ds = new DataSet();
> StringReader sr = new StringReader( s );
> ds.ReadXml ( sr );
>
> Thanks in advance. If you have suggestions for how to make this code a bit
> more compact, I welcome that kind of feedback also.
>
> - Steve
>
>
| |
| Scott Colestock 2005-05-13, 7:56 am |
| Give something like this a try instead (I haven't tested this):
xmlDoc = Message_1; // or whatever the msg is
dataset.ReadXml(new System.Xml.XmlNodeReader(xmlDoc));
Scott Colestock
www.traceofthought.net
"Steve Harclerode" <sharclerode_REMOVE_THIS@ebisolutions.net> wrote in
message news:u0JI8H2VFHA.2128@TK2MSFTNGP14.phx.gbl...
> Sorry, I forgot to mention that inside of BizTalk, I can create the
> XmlDocument variable below by simple assignment from the message that I
> wish to send.
>
> - Steve
>
> "Steve Harclerode" <sharclerode_REMOVE_THIS@ebisolutions.net> wrote in
> message news:%23VEkRD2VFHA.1508@tk2msftngp13.phx.gbl...
>
>
| |
| Steve Harclerode 2005-05-14, 1:16 pm |
| Thanks for the reply Yossi,
Which details are missing? What I want to accomplish is to convert a message
into a dataset type, and then call a web service method which accepts a
dataset type. My boss wants me to avoid what you're suggesting below (he
only wants to use BizTalk without external classes), although he might be
"out of luck".
Thanks,
Steve
"Yossi Dahan" <yossidahan@hotmail.com> wrote in message
news:OHVRQ94VFHA.3636@TK2MSFTNGP14.phx.gbl...
> There may be other solution if you post more details on what it is you're
> trying to do, but as a general rule -
> If you need to run c# code in an orchestration that is not supported in
> the expression shape use a helper class -
>
> Write a class that does the work and call it from the orchestration
>
> Yossi Dahan
>
>
| |
| Scott Colestock 2005-05-14, 1:16 pm |
| Give something like this a try instead (I haven't tested this):
xmlDoc = Message_1; // or whatever the msg is
dataset.ReadXml(new System.Xml.XmlNodeReader(xmlDoc));
Scott Colestock
www.traceofthought.net
"Steve Harclerode" <Camel.Software.Co@hot.mail.com> wrote in message
news:%23P$EOE9VFHA.4076@TK2MSFTNGP14.phx.gbl...
> Thanks for the reply Yossi,
>
> Which details are missing? What I want to accomplish is to convert a
> message into a dataset type, and then call a web service method which
> accepts a dataset type. My boss wants me to avoid what you're suggesting
> below (he only wants to use BizTalk without external classes), although he
> might be "out of luck".
>
> Thanks,
> Steve
>
> "Yossi Dahan" <yossidahan@hotmail.com> wrote in message
> news:OHVRQ94VFHA.3636@TK2MSFTNGP14.phx.gbl...
>
>
| |
| Steve Harclerode 2005-05-14, 1:16 pm |
| What you have below worked, after adding "dataset = new
System.Data.DataSet()".
I tried to declare a variable of type XmlNodeReader, but got a complaint
because it's non serializable. But instantiating it in place, as you do
below, works fine.
Thanks very much!
- Steve
"Scott Colestock" <scolestock@nospam_usa.net> wrote in message
news:OBp0mv7VFHA.3572@TK2MSFTNGP12.phx.gbl...
> Give something like this a try instead (I haven't tested this):
>
> xmlDoc = Message_1; // or whatever the msg is
> dataset.ReadXml(new System.Xml.XmlNodeReader(xmlDoc));
>
> Scott Colestock
> www.traceofthought.net
>
>
|
|
|
|
|