MADMap
MADMap

Reputation: 3192

Will a .NET Webservice break when I add a Property to a Parameter?

I have a .NET Webservice which hosts a Method called AddMyObject.

[WebMethod]
public void AddMyObject(MyObject[] objects){...}

Where MyObject is declared as

public class MyObject
{
    public string Pro1{get;set;}
    public string Pro2{get;set;}
}

If I now add a Property to MyObject, the Client creates a new Proxy from the new WSDL and uses this Property, will an old instance of the Webservice be able to handle it? Of course the new Property will be null, but will there be any Exception?

Upvotes: 2

Views: 248

Answers (3)

MADMap
MADMap

Reputation: 3192

Fortunately I just found the time to write a little test service for this issue.

What actually happens is, that if a property is added on client side, it's ignored on the old service.

Even when a Property is deleted on the client side, there is no Exception on the server: the Property is just null.

Upvotes: 1

Sergio
Sergio

Reputation: 8259

That is a good question, +1 for that.

I have never tried it, but I would say that it will probably work. Please tell us the results :)

Upvotes: 0

krosenvold
krosenvold

Reputation: 77201

Yes, in general it will fail. Not neccessarily on a .NET client (it's fairly lenient) but other clients will fail.

Upvotes: 0

Related Questions