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

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top