all groups > asp.net webservices > july 2006 >
You're in the

asp.net webservices

group:

WebService proxy class naming


WebService proxy class naming Paul
7/31/2006 4:48:04 PM
asp.net webservices:
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

Re: WebService proxy class naming Paul Wu
7/31/2006 11:47:11 PM
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=3D"http://namespace"=
, ElementName=3D"Person")]
public class Person {}


-------------------------------------=20
Paul Wu
paul.wu@biztalkdev.com




[quoted text, click to view]
AddThis Social Bookmark Button