Re: Convert String data from Web Service to XML




1. Are you using Xlang or external .net assembly to load xml?
-- Xlang is straight-forward for your case and have less dependency.

2. you can also check if the xml string can be validated by the Msg_2
schema. I suspect that namespace or some little thing might screw up the
message assignment.

good luck.

"Avinash" wrote:

On Feb 15, 1:05 pm, linda <li...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I don't know what exactly happened, but it might be related to the syntax:
XmlDocument temp2 =
(XmlDocument)Convert.ChangeType(temp1,typeof(XmlDocument));

why not use temp instead of temp2, doesn't temp serve your need? To me these
2 lines are not necessary, only complicate things:
temp1 = temp.DocumentElement.OuterXml; ( temp1 is exactly
equivalent to the pass-in parameter: VertexResponse.)
XmlDocument temp2 =
(XmlDocument)Convert.ChangeType(temp1,typeof(XmlDocument));



"Avinash" wrote:
On Feb 14, 2:26 pm, linda <li...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I am a little confused.

If you need assign this VertexResponse to a message(e.g Msg_1 which
associated with a schema), you can just assign temp to this message in a
message consturct shape.

XmlDocument xmlDoc=VertexResponse(VertexResponse);
Msg_1=xmlDoc;

Then later you can use the Msg_1 in a map.

Otherwise, if you only need to assign the VertexResponse string to a node of
a message, why would you bother to load VertexResponse into a xml document?

Linda

"Avinash" wrote:
On Feb 13, 4:20 pm, linda <li...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Hi Avinash,

why not return temp directly? the way i see would work is:

public XmlDocument VertexResponse(string VertexResponse)
{
XmlDocument temp= new XmlDocument();
temp.LoadXml(VertexResponse);
return temp;
}

"Avinash" wrote:
On Feb 12, 6:48 pm, Mark <mcole...@xxxxxxxxxxx> wrote:
On 12 Feb, 16:05, Avinash <avinashd...@xxxxxxxxx> wrote:

Hi
I am trying to Convert String data from Web Service to XML
My String data looks like
<String>My XML is inside this string tag </String>
I want to extract the XML inside the string tag in Orchestration, How
do i do it ??
Any help is appreciated.

Thanks-
Avinash

You could load it into a DOM using System.Xml.XmlDocument. If it is a
small piece of XML this shouldn't be too much of an overhead. If it's
a large amount of data this is not recommended as it will consume lots
of memory. Another option is to use an XmlTextReader (also in the
System.Xml namespace) to parse the document and use the
ReadElementContentAsString method to retrieve the value. Another quick
and dirty method is string parsing.
Thanks for the reply,

I tried using this method below and return an Xml document type back
to Orchestration, when i go thru the Orchestration Debugger it stops
at where it actually calls this method and gives me an error saying

Inner exception: Invalid cast from 'System.String' to
'System.Xml.XmlDocument'.
I double checked my variables and messages every thing is assigned
right and builds the project, but in run time in throws the above
error.

public XmlDocument VertexResponse(string VertexResponse)
{
XmlDocument temp= new XmlDocument();
string temp1;
temp.LoadXml(VertexResponse);
temp1= temp.DocumentElement.OuterXml;
XmlDocument temp2 = (XmlDocument)Convert.ChangeType(temp1,
typeof(XmlDocument));
return temp2;
}- Hide quoted text -

- Show quoted text -

You are right, but i need to Assign this OuterXml which is a string
type to a Schema in my project so that i can do some mapping.- Hide quoted text -

- Show quoted text -

Hi Linda,
Thanks for that response that helped, but the problem now is
here are the steps that i am following

1)Capture the xml from the String Response from web service, using
xmldocument & outerxml
2) Once i get the outerxml, since that's a string type i convert tha
again to xmldocument by using loadxml and assign to xmldocument
variable
3) assign the xmldocument to a msg_1 (where msg_1 is my Schema type)

the issue is when i go thru orchestration debugger i can see the outer
xml, but i see null assigned to xmldocument variable and msg_1

why would that happen.?? Any ideas- Hide quoted text -

- Show quoted text -

All the code that i used earlier is gone, I am not using that any
more, I am just following steps that you recommended me, that builds
fine only problem is it's having null when i return the xmldocument
variable and msg_1.



.



Relevant Pages

  • RE: using myXslDoc.Transform
    ... One potential option for dynamically loading an XmlDocument from the ... retrieved as a string. ... Retrieve the XML content from the database ... Dim strXml As String ...
    (microsoft.public.dotnet.xml)
  • Re: Convert String data from Web Service to XML
    ... associated with a schema), you can just assign temp to this message in a ... why would you bother to load VertexResponse into a xml document? ... I am trying to Convert String data from Web Service to XML ... xmldocument & outerxml ...
    (microsoft.public.biztalk.general)
  • Re: Convert String data from Web Service to XML
    ... if you only need to assign the VertexResponse string to a node of ... I am trying to Convert String data from Web Service to XML ... again to xmldocument by using loadxml and assign to xmldocument ...
    (microsoft.public.biztalk.general)
  • Re: Serialize XML is broken?
    ... The XmlDocument was supposed to be created to make it easier to insert into ... Then load it as xml when it is needed. ... the schema and .net class for NewsArticle: ... private string bodyField; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Convert String data from Web Service to XML
    ... if you only need to assign the VertexResponse string to a node of ... why not return temp directly? ... public XmlDocument VertexResponse ... I am trying to Convert String data from Web Service to XML ...
    (microsoft.public.biztalk.general)