• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Is overloading a WebMethod OK?

Durbs

Contractor Among Contractors
Thanks received
0
Could do with overloading one of the methods on a .NET service i'm currently writing. I can define a seperate MessageName:="xxx" attribute for the methods but then .NET 3.5 throws "Service 'Durbs.WebService' does not conform to WS-I Basic Profile v1.1. Please examine each of the normative statement violations below..."

I can sort this by changing:

<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>

to

<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.None)>

And all seems happy when consumed via the browser and SoapUi.

But, it still shows warnings in the browser about this BasicProfile1_1 non-conformance

Is this going to cause me any problems with any particular consumers? Is there a reason why that WsiProfiles thing prohibits it? Can't see anything wrong with doing it (and i'm sure earllier .NET didnt complain), but for all I know, this is a big no-no in Java or something?
 
Last edited: 15:10
S'ok, sacked it off.

Turns out SoapUI moans too (Duplicate operation names in portType) during a WSI compliance test as .NET sticks duplicate entries in the WSDL file for PortType on an overloaded method. Method itself works fine though in both its forms.

I'll have 2 seperate methods, less hassle.
 
Just to confirm, you cannot overload a web method.

This is a limitation of the WS-I/WSDL spec, rather than a .net issue.

TM
 
You can sort of overload by specifying the MessageName property:

Link (about half way down the page)

It doesn't help much in that you still have to consume the name specified in MessageName, but might make you feel better! :smokin
 

Advertisers

Back
Top