Groups | Blog | Home
all groups > dotnet web services > february 2008 >

dotnet web services : Dynamically change the SoapDocumentMethodAttribute


SG
2/4/2008 12:22:03 PM
Question:
Is it possible to dynamically change the SoapDocumentMethodAttribute?

Scenario:
We have a number of clients, each with their own web service. The web method
name is the same in each web service. I can dynamically change the URL at
runtime by referencing the URL property.

I have generated a proxy class and am using this rather than a web reference.

My problem is that the namespaces in each of the web services and my proxy
class is different.

Is it possible to change the 'Action', 'RequestNameSpace', and
'ResponseNameSpace' in the SoapDocumentMethodAttribute declaration in order
to get this to work?

John Saunders [MVP]
2/4/2008 5:34:25 PM
[quoted text, click to view]

I'm not sure what you mean. Which namespaces are different? Can you give an
example?
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer

SG
2/6/2008 6:48:00 AM
Basically what I am trying to do is use the same proxy class for different
clients since the web method is going to be the same for all clients. The url
differs for each of the client's web service which I dynamically populate.

The web method in my proxy class has the following:
<System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/MyMethod",
RequestNamespace:="http://tempuri.org/",
ResponseNamespace:="http://tempuri.org/>

But when I make a call the method, I get a namespace mismatch error
returned. This is because the client has a different namespace than what is
being used in my proxy.

My question is can I dynamically change SoapDocumentMethodAttribute to have
the same namespace as in the client specs.

Thanks,

[quoted text, click to view]
John Saunders [MVP]
2/6/2008 11:37:11 AM
[quoted text, click to view]

Why does the client have a different namespace? The namespace is defined by
the server, not by the client, and should be the same for all clients using
any instance of the same service.
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer

AddThis Social Bookmark Button