WebService proxy class naming

P

Paul

I have simple web method like the following:

[WebMethod(Description = "Gets an instance of the Person class.",
MessageName = "Person")]
public Person GetPerson()
{
return CreatePerson();
}

When I compile the web service, it generates the following WSDL snippet:


<s:element name="PersonResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" ref="s1:personResult" />
</s:sequence>
</s:complexType>
</s:element>

On the WS consumer side, WDSL.EXE generates a "PersonResult" instead of a
"Person" class. Is there a way to decorate my WS code so the class generated
is named "Person"?


Paul
 
P

Paul Wu

In your web service's xml attribute decoration, make sure you provide the root element name to be used by the XmlSerializer. For example:

[System.Xml.Serialization.XmlRootAttribute(Namespace="http://namespace", ElementName="Person")]
public class Person {}
 

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

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top