views:

203

answers:

1

I've created a web service that uses a generic type Response<TCode, TData> and so I'm ending up with elements like

  • ResponseOfResponseCodeUserData
  • ResponseOfResponseCodeArrayOfRightData

etc.

Functionally works just fine but I'm wondering if there's a way to name these particular elements?

EDIT:

Here's an example.

[return: XmlElement("AuthenticationResponse")]
[WebMethod]
public Response<ResponseCode, AuthenticationData> AuthenticateProcess(string ProcessName, string Password)
{
   // ... Code ...
}

Still returns

<ResponseOfResponseCodeAuthenticationData (...) >

Any ideas?

+2  A: 

It might help if you were to show some code.

Still, look at the [XmlElementAttribute] attribute, which allows you to specify the element name. If your issue is with return values, then you will need to use

[return: XmlRoot("ReturnElementName")]
[WebMethod]
public int MyWebMethod() { ... }
John Saunders
Ah, the attribute is XmlRoot. Updated appropriately.
Spencer Ruport