none
Consuming web service with a class and method that is a keyword RRS feed

  • Question

  • Hi,

    I'm consuming a webservice (axis2 webservice), and there's a class and method called "lock".  When visual studio generates the reference it names the class and method "@lock" so not to be confused with a lock statement.

    Is there a way that I can rename the class and method that VS creates or am I stuck with that?

    Oddly out all the web service methods that require that class seem to give me a System.ServiceModel.FaultException: NullPointerExceptionwhen I call it.  It might just be coincedence, but when I use soapui to the webservice it is successful.

    Any help would be appreciated

    Thanks.

    Thursday, April 11, 2013 7:38 PM

Answers

  • Yes.  The proxy definition generated either as a service reference (WCF) or web reference (.net 2.0) can be edited post generation. 

    A common task will be to change annoying names, like the issue you have, or to combine objects that are shared between services (as each proxy using namespaces to avoid any name collisions).

    The important thing to remember is to avoid modifying the Serialization related attributes (re., XmlElementAttribute).  Changing these will break your contract with the service and cause a failure when messages are exchanged.


    Jeff

    • Proposed as answer by chilberto Thursday, April 11, 2013 10:36 PM
    • Marked as answer by Octane Chicken Friday, April 12, 2013 4:21 PM
    Thursday, April 11, 2013 10:36 PM