webservice without objectmodel possible?

H

hvj

I am working on webservice wrapper for an application that returns xml
in the form of a large string. On a somewhat simplified level all I
want to do is put this xml in a proper soap envelope and return it to
the caller of the wrapper webservice.

However the standard ways of making a webservice in Visual Studio lets
me make an objectmodel that is serialized to xml. But I allready have
most of the xml and it seems such an unnecessary step to make an
objectrepresentation of it only in order to communicate this xml over
a webservice.

What I can think about is loading the xml into an XmlDocument and let
that be serialized again to xml by asp.net, but that feels a bit like
a workaround.

Is there an other way to make a webservice and just define the xml of
a respons directly?
 
J

John Saunders [MVP]

I am working on webservice wrapper for an application that returns xml
in the form of a large string. On a somewhat simplified level all I
want to do is put this xml in a proper soap envelope and return it to
the caller of the wrapper webservice.

However the standard ways of making a webservice in Visual Studio lets
me make an objectmodel that is serialized to xml. But I allready have
most of the xml and it seems such an unnecessary step to make an
objectrepresentation of it only in order to communicate this xml over
a webservice.

What I can think about is loading the xml into an XmlDocument and let
that be serialized again to xml by asp.net, but that feels a bit like
a workaround.

Is there an other way to make a webservice and just define the xml of
a respons directly?

Yes. See "The Power of XmlElement Parameters in ASP.NET Web Methods" at
http://msdn2.microsoft.com/en-us/library/aa480498.aspx.
 
H

hvj

Hi John,

Thanks for your reply. However, it seems to me that the described
method only allows you to have full access to the *requestmessage*,
but not to your responsmessage.

Henk
 
J

John Saunders [MVP]

Hi John,

Thanks for your reply. However, it seems to me that the described
method only allows you to have full access to the *requestmessage*,
but not to your responsmessage.

You can do the same thing with the return value. Just place "return:" before
the attributes, like:

[return: XmlAnyElement(...)]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top