Hello,
I need to implement a webservice based on an XSD, so I'm stuck with
the names someone else thought up. I wanted to implement this
webservice in WCF to maximize our options should we wish to change
stuff or add stuff.
The problem I run into is that I need to give the element that
contains the result of a function a certain name, but I can't find out
how.
I have a function Bar() and it returns a class called Foo. Foo
contains just a string called Message. So this should be:
class Foo{ public string Message; }
Foo Bar();
So far I got the resulting SOAP XML to be:
<BarResponse>
<BarResult>
<Message/>
</BarResult>
</BarResponse>
But I need it to be:
<BarResponse>
<MyFooBarResult>
<Message/>
</MyFooBarResult>
</BarResponse>
Because of other problems with the correct nesting of array elements
I'm using the XmlSerializer in stead of the ObjectSerializer on my
webservice. So I figured I could just tack an attribute on the
webservice like I could in ASMX webservices: [return:
XmlElement("MyFooBarResult")], but that doesn't seem to work.
I also already added an [XmlRoot(ElementName = "MyFooBarResult")]
attribute to the Foo class, but that also doesn't seem to make a
difference.
Any ideas?
Thanks.
Jeroen-bart Engelen