By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,133 Members | 1,092 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,133 IT Pros & Developers. It's quick & easy.

Passing XML data as parameter of web service

P: n/a
What's the best way to pass xml data to a web service: as XmlDocument,
or as a string, or....? (the xml data is structured by XSD)

Thanks,
kind regards,

--
Ludwig
http://www.coders-lab.be
May 11 '07 #1
Share this Question
Share on Google+
15 Replies


P: n/a
Ludwig,

Does the XML data conform to a schema? If so, you should be able to
create a managed type which represents the schema and then expose that.

If you are looking to send any arbitrary XML data, then expose the
XmlDocument, and it will be exposed in the WSDL as allowing any element.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Ludwig" <ludwig.stuyck(remove)@telenet.bewrote in message
news:bh********************************@4ax.com...
What's the best way to pass xml data to a web service: as XmlDocument,
or as a string, or....? (the xml data is structured by XSD)

Thanks,
kind regards,

--
Ludwig
http://www.coders-lab.be

May 11 '07 #2

P: n/a
On Fri, 11 May 2007 10:02:45 -0400, "Nicholas Paldino [.NET/C# MVP]"
<mv*@spam.guard.caspershouse.comwrote:
>Ludwig,

Does the XML data conform to a schema? If so, you should be able to
create a managed type which represents the schema and then expose that.

If you are looking to send any arbitrary XML data, then expose the
XmlDocument, and it will be exposed in the WSDL as allowing any element.
Hi,

yes it conforms to an XSD. What do you mean with 'create a managed
type' ? (communication goes from a company to another company)

Thanks,
Ludwig

--
Ludwig
http://www.coders-lab.be
May 11 '07 #3

P: n/a
Ludwig,

I am curious, if another company is exposing the web service, do they
have a WSDL document that you can use? If so the VS.NET (or wsdl.exe if you
want to work from the command line) should develop the appropriate types
that you can use (instead of an arbitrary XmlDocument).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ludwig" <ludwig.stuyck(remove)@telenet.bewrote in message
news:86********************************@4ax.com...
On Fri, 11 May 2007 10:02:45 -0400, "Nicholas Paldino [.NET/C# MVP]"
<mv*@spam.guard.caspershouse.comwrote:
>>Ludwig,

Does the XML data conform to a schema? If so, you should be able to
create a managed type which represents the schema and then expose that.

If you are looking to send any arbitrary XML data, then expose the
XmlDocument, and it will be exposed in the WSDL as allowing any element.

Hi,

yes it conforms to an XSD. What do you mean with 'create a managed
type' ? (communication goes from a company to another company)

Thanks,
Ludwig

--
Ludwig
http://www.coders-lab.be

May 11 '07 #4

P: n/a
Ludwig,
ASP.NET webservices can serialize / deserialize and accept an XmlDocument
instance as an input parameter to a WebMethod. Internally this materializes
as an XmlNodeList I believe.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Ludwig" wrote:
On Fri, 11 May 2007 10:02:45 -0400, "Nicholas Paldino [.NET/C# MVP]"
<mv*@spam.guard.caspershouse.comwrote:
Ludwig,

Does the XML data conform to a schema? If so, you should be able to
create a managed type which represents the schema and then expose that.

If you are looking to send any arbitrary XML data, then expose the
XmlDocument, and it will be exposed in the WSDL as allowing any element.

Hi,

yes it conforms to an XSD. What do you mean with 'create a managed
type' ? (communication goes from a company to another company)

Thanks,
Ludwig

--
Ludwig
http://www.coders-lab.be
May 11 '07 #5

P: n/a
On Fri, 11 May 2007 10:18:35 -0400, "Nicholas Paldino [.NET/C# MVP]"
<mv*@spam.guard.caspershouse.comwrote:
>Ludwig,

I am curious, if another company is exposing the web service, do they
have a WSDL document that you can use? If so the VS.NET (or wsdl.exe if you
want to work from the command line) should develop the appropriate types
that you can use (instead of an arbitrary XmlDocument).
Well, they sent us the XSD, that's it...

--
Ludwig
http://www.coders-lab.be
May 11 '07 #6

P: n/a
On Fri, 11 May 2007 07:25:01 -0700, Peter Bromberg [C# MVP]
<pb*******@yahoo.yabbadabbadoo.comwrote:
>Ludwig,
ASP.NET webservices can serialize / deserialize and accept an XmlDocument
instance as an input parameter to a WebMethod. Internally this materializes
as an XmlNodeList I believe.
Peter
Yes, I've read that.... but I didn't know if this is the best way to
do it.......

--
Ludwig
http://www.coders-lab.be
May 11 '07 #7

P: n/a
Are you sure it isn't a WSDL document? Does the top look like this:

<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://tempuri.org/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://tempuri.org/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>

And so on...
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ludwig" <ludwig.stuyck(remove)@telenet.bewrote in message
news:1u********************************@4ax.com...
On Fri, 11 May 2007 10:18:35 -0400, "Nicholas Paldino [.NET/C# MVP]"
<mv*@spam.guard.caspershouse.comwrote:
>>Ludwig,

I am curious, if another company is exposing the web service, do they
have a WSDL document that you can use? If so the VS.NET (or wsdl.exe if
you
want to work from the command line) should develop the appropriate types
that you can use (instead of an arbitrary XmlDocument).

Well, they sent us the XSD, that's it...

--
Ludwig
http://www.coders-lab.be

May 11 '07 #8

P: n/a
On Fri, 11 May 2007 10:46:40 -0400, "Nicholas Paldino [.NET/C# MVP]"
<mv*@spam.guard.caspershouse.comwrote:
Are you sure it isn't a WSDL document? Does the top look like this:

<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://tempuri.org/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://tempuri.org/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>

And so on...
No, only XSD, but I can ask the WSDL I guess!

--
Ludwig
http://www.coders-lab.be
May 11 '07 #9

P: n/a
That's definitely the better option. If it is a web service and it
offers a WSDL file, then you can auto generate the proxies and be done with
it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ludwig" <ludwig.stuyck(remove)@telenet.bewrote in message
news:52********************************@4ax.com...
On Fri, 11 May 2007 10:46:40 -0400, "Nicholas Paldino [.NET/C# MVP]"
<mv*@spam.guard.caspershouse.comwrote:
> Are you sure it isn't a WSDL document? Does the top look like this:

<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://tempuri.org/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://tempuri.org/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>

And so on...

No, only XSD, but I can ask the WSDL I guess!

--
Ludwig
http://www.coders-lab.be

May 11 '07 #10

P: n/a
On Fri, 11 May 2007 11:06:11 -0400, "Nicholas Paldino [.NET/C# MVP]"
<mv*@spam.guard.caspershouse.comwrote:
That's definitely the better option. If it is a web service and it
offers a WSDL file, then you can auto generate the proxies and be done with
it.
Thanks for the help!

--
Ludwig
http://www.coders-lab.be
May 11 '07 #11

P: n/a
Why not? Surely a strongly typed object (that represents a well-formed Xml
Document) is better than a crummy old string?
:-)
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Ludwig" wrote:
On Fri, 11 May 2007 07:25:01 -0700, Peter Bromberg [C# MVP]
<pb*******@yahoo.yabbadabbadoo.comwrote:
Ludwig,
ASP.NET webservices can serialize / deserialize and accept an XmlDocument
instance as an input parameter to a WebMethod. Internally this materializes
as an XmlNodeList I believe.
Peter

Yes, I've read that.... but I didn't know if this is the best way to
do it.......

--
Ludwig
http://www.coders-lab.be
May 11 '07 #12

P: n/a
On Fri, 11 May 2007 13:13:02 -0700, Peter Bromberg [C# MVP]
<pb*******@yahoo.yabbadabbadoo.comwrote:
>Why not? Surely a strongly typed object (that represents a well-formed Xml
Document) is better than a crummy old string?
:-)
Yes.... but I want it to be 'open' and platform independent, and I was
not sure whether I should use a .NET framework class like XmlDocument.
If I would use this and send it to another company that does not use
..NET, can they still parse the XML with java for example?

--
Ludwig
http://www.coders-lab.be
May 12 '07 #13

P: n/a
The "Xml" has to go over the wire in string form inside an XML SOAP Envelope.
All SOAP Messages are essentially "strings" - even binary data is
"string-ified". You can check with other vendors' platforms to see how they
treat a complete XML Document as being the payload or a parameter.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Ludwig" wrote:
On Fri, 11 May 2007 13:13:02 -0700, Peter Bromberg [C# MVP]
<pb*******@yahoo.yabbadabbadoo.comwrote:
Why not? Surely a strongly typed object (that represents a well-formed Xml
Document) is better than a crummy old string?
:-)

Yes.... but I want it to be 'open' and platform independent, and I was
not sure whether I should use a .NET framework class like XmlDocument.
If I would use this and send it to another company that does not use
..NET, can they still parse the XML with java for example?

--
Ludwig
http://www.coders-lab.be
May 12 '07 #14

P: n/a
When an XmlDocument is exposed as a parameter or return value of a web
service in ASP.NET, the WSDL produces a schema for that parameter/return
value of a complex type with a single element which allows any element. So
basically, the content is open-ended. I can't imagine another platform that
doesn't handle this in some manner.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Peter Bromberg [C# MVP]" <pb*******@yahoo.yabbadabbadoo.comwrote in
message news:29**********************************@microsof t.com...
The "Xml" has to go over the wire in string form inside an XML SOAP
Envelope.
All SOAP Messages are essentially "strings" - even binary data is
"string-ified". You can check with other vendors' platforms to see how
they
treat a complete XML Document as being the payload or a parameter.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Ludwig" wrote:
>On Fri, 11 May 2007 13:13:02 -0700, Peter Bromberg [C# MVP]
<pb*******@yahoo.yabbadabbadoo.comwrote:
>Why not? Surely a strongly typed object (that represents a well-formed
Xml
Document) is better than a crummy old string?
:-)

Yes.... but I want it to be 'open' and platform independent, and I was
not sure whether I should use a .NET framework class like XmlDocument.
If I would use this and send it to another company that does not use
..NET, can they still parse the XML with java for example?

--
Ludwig
http://www.coders-lab.be

May 12 '07 #15

P: n/a
Ludwig wrote:
What's the best way to pass xml data to a web service: as XmlDocument,
or as a string, or....? (the xml data is structured by XSD)
Use string.

I am pretty sure that a web service using XmlDocument will
not be usable from non-.NET languages.

Arne
May 19 '07 #16

This discussion thread is closed

Replies have been disabled for this discussion.