Groups | Blog | Home
all groups > asp.net webservices > may 2006 >

asp.net webservices : Web method signature modified.


Raj
5/31/2006 6:03:02 AM
Hi,
We have set of web service method already consumed by out client. Now we
require to add few input parameters (int/string type) to existing web method.

How does this will affect existing consumer of the service??
Please take this as urgent query.
Thanks in advance
Raj
5/31/2006 10:26:01 PM
Hi Gaurav,

I tried with a test application with old proxy after modifying a web method
to add a new parameter. It is still serving the request. It is not crashing.

However I wish to know if it approved by MS to do?
Moreover can we have overloaded web method?
Thanks in advance
-rajesh

[quoted text, click to view]
Gaurav Vaish (www.EduJini.IN)
5/31/2006 11:30:40 PM
The existing clients will crash.

I'd rather suggest that you create another web-method if the number of
existing consumers is large.

--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://webservices.edujini.in
-------------------


[quoted text, click to view]

Raj
6/1/2006 10:37:01 PM
HI Gaurav,
Thanks for your reply first of all.
See I haven't removed any parameter instead I have added one. Min occurance
is 1 for int and 0 for string param and both I have tried and found it
working.

Only concern is whether this is suggest approach, as you're saying no, which
is why I think the existing set of web methods should not get disturbed.

Thanks once again
-rajesh

[quoted text, click to view]
Gaurav Vaish (www.EduJini.IN)
6/2/2006 12:00:00 AM
Hi Raj,

[quoted text, click to view]

Always welcome :-)

[quoted text, click to view]

What I meant was that for the new parameter is the minoccurs is 0 then
in that case the old proxy would not fail, because the parameter is
optional. The deserializer (SOAP Formatter) would give the paramter its
default value (null for reference types, 0 for numeric types etc)

[quoted text, click to view]

If you have made the new parameters with minoccurs=0 then no problems as
far as usage is concerened. However since the proxy is not with the latest
WSDL, it would not be recommended.

Infact, the recommended way is to be backward compatible. So, give the
new method (method with new parameters) a new name -- in "operations"
section.


--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://www.edujini.in
http://webservices.edujini.in
-------------------

Gaurav Vaish (www.EduJini.IN)
6/2/2006 12:00:00 AM
[quoted text, click to view]

Oops.. I meant the "operation" entry in "portType" in the WSDL must be with
a different name.


--
Happy Hacking,
Gaurav Vaish | http://www.mastergaurav.org
http://www.edujini.in | http://webservices.edujini.in
-------------------

Raj
6/2/2006 12:18:02 AM
Hi Gaurabh,
Thanks a lot for helping me out.
Only thing i didn't get out of mail is last statement.

You say "Infact, the recommended way is to be backward compatible. So, give
the
new method (method with new parameters) a new name -- in "operations"
section."

What do you mean my in "operations" section. can you pls explain in detail.
I ping you a lot for this. Just last help for now.
Thanks
-rajesh



[quoted text, click to view]
Gaurav Vaish (www.EduJini.IN)
6/2/2006 12:51:19 AM
Hi Rajesh,

[quoted text, click to view]

What's the new parameter?
Does it have a "minoccurs='0'"? If it is then the parameters can definitely
be omitted.
By default, the minoccurs=maxoccurs=1 in WSDL.

[quoted text, click to view]

Don't know about MS but I'd personally not like that.

[quoted text, click to view]

Yes. Well, techinically no.
But from programming perspective, yes, you can do that. All you need is to
give a different name to the new operation.
And this is what I would suggest.


--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://www.edujini.in
http://webservices.edujini.in
-------------------

Simon Hart
6/3/2006 10:11:48 PM
Hi Raj,

My advice would be to overload your existing Web Method by using the
MessageName property of the WebMethod attribute and refactor the other
original Web Method so you avoid duplicating code.

Simon.

[quoted text, click to view]

AddThis Social Bookmark Button