Hi, My app is a general purposes app and not a specific one. This means that customer who bought the application can have a web service placed on the server on any given URL. I use the wsdl tool to create the service class, but the reference to the url is hard coded inside the class. What is the correct way to implement the web service with a parameterized URL address in such a way that end user of the app can define it? Example of my class where you can see the hard coded url: [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Web.Services.WebServiceBindingAttribute(Name="SolverServiceSoap", Namespace="http://localhost/SolverService/")] public class SolverService : System.Web.Services.Protocols.SoapHttpClientProtocol { /// <remarks/> public SolverService() { this.Url = http://localhost/SolverService/SolverService.asmx; } /// <remarks/> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/SolverService/Close, RequestNamespace="http://localhost/SolverService/", ResponseNamespace="http://localhost/SolverService/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public void Close() { this.Invoke("Close", new object[0]); } ..... Thanks in advance.
Thanks for answering. The problem here is that the methods of the web service class also maintains a reference to the url, like in this web method: /// <remarks/> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/MapSolverService/Close", RequestNamespace="http://localhost/MapSolverService/", ResponseNamespace="http://localhost/MapSolverService/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public void Close() { this.Invoke("Close", new object[0]); } So, how to change that ? Thanks "Yunus Emre ALPÖZEN [MCSD.NET]" <yemre> escribió en el mensaje news:%23HAbJ0R9FHA.1140@tk2msftngp13.phx.gbl... [quoted text, click to view] > If web service description remains same u can set web service url at run > time.. Here is a pseudo code example: > > SolverService sService = new SolverService (); > // and set sService.Url to URL what ever u want.. > > But be sure wsdl is same.. > -- > HTH > > Thanks, > Yunus Emre ALPÖZEN > BSc, MCSD.NET > > "Luis Arvayo" <amorenopalma@prodigy.net.mx> wrote in message > news:OIqjZhR9FHA.1420@TK2MSFTNGP09.phx.gbl... >> Hi, >> >> My app is a general purposes app and not a specific one. >> >> This means that customer who bought the application can have a web >> service placed on the server on any given URL. >> >> I use the wsdl tool to create the service class, but the reference to the >> url is hard coded inside the class. >> >> What is the correct way to implement the web service with a parameterized >> URL address in such a way that end user of the app can define it? >> >> >> >> Example of my class where you can see the hard coded url: >> >> [System.Diagnostics.DebuggerStepThroughAttribute()] >> [System.ComponentModel.DesignerCategoryAttribute("code")] >> [System.Web.Services.WebServiceBindingAttribute(Name="SolverServiceSoap", >> Namespace="http://localhost/SolverService/")] >> public class SolverService : >> System.Web.Services.Protocols.SoapHttpClientProtocol { >> /// <remarks/> >> public SolverService() { >> this.Url = http://localhost/SolverService/SolverService.asmx; >> } >> >> /// <remarks/> >> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/SolverService/Close, >> RequestNamespace="http://localhost/SolverService/", >> ResponseNamespace="http://localhost/SolverService/", >> Use=System.Web.Services.Description.SoapBindingUse.Literal, >> ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] >> public void Close() { >> this.Invoke("Close", new object[0]); >> } >> >> .... >> >> >> Thanks in advance. >> >> >> >> >> > >
If web service description remains same u can set web service url at run time.. Here is a pseudo code example: SolverService sService = new SolverService (); // and set sService.Url to URL what ever u want.. But be sure wsdl is same.. -- HTH Thanks, Yunus Emre ALPÖZEN BSc, MCSD.NET [quoted text, click to view] "Luis Arvayo" <amorenopalma@prodigy.net.mx> wrote in message news:OIqjZhR9FHA.1420@TK2MSFTNGP09.phx.gbl... > Hi, > > My app is a general purposes app and not a specific one. > > This means that customer who bought the application can have a web service > placed on the server on any given URL. > > I use the wsdl tool to create the service class, but the reference to the > url is hard coded inside the class. > > What is the correct way to implement the web service with a parameterized > URL address in such a way that end user of the app can define it? > > > > Example of my class where you can see the hard coded url: > > [System.Diagnostics.DebuggerStepThroughAttribute()] > [System.ComponentModel.DesignerCategoryAttribute("code")] > [System.Web.Services.WebServiceBindingAttribute(Name="SolverServiceSoap", > Namespace="http://localhost/SolverService/")] > public class SolverService : > System.Web.Services.Protocols.SoapHttpClientProtocol { > /// <remarks/> > public SolverService() { > this.Url = http://localhost/SolverService/SolverService.asmx; > } > > /// <remarks/> > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/SolverService/Close, > RequestNamespace="http://localhost/SolverService/", > ResponseNamespace="http://localhost/SolverService/", > Use=System.Web.Services.Description.SoapBindingUse.Literal, > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] > public void Close() { > this.Invoke("Close", new object[0]); > } > > .... > > > Thanks in advance. > > > > >
Hi again, U can change web service reference from static to dynamic.. Request and Response Namespace are not required to be "localhost".. Just give a generic name like "tempuri.org"... Change them and call your web service, and see what is going on... Using VS.NET, u can add a web reference.. But it is not an obligation. You can simply implement Web Service Proxy class. If u are using primitive data types, u can easily call it. Otherwise u must share your custom objects with callee applications. Also, u can mark your input and output parameters as XML serializable. Thus, would help u to call ws from different platforms.. -- HTH Thanks, Yunus Emre ALPÖZEN BSc, MCSD.NET [quoted text, click to view] "Luis Arvayo" <amorenopalma@prodigy.net.mx> wrote in message news:%23DxUenS9FHA.2640@tk2msftngp13.phx.gbl... > Thanks for answering. > > The problem here is that the methods of the web service class also > maintains a reference to the url, like in this web method: > > > > /// <remarks/> > > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/MapSolverService/Close", > RequestNamespace="http://localhost/MapSolverService/", > ResponseNamespace="http://localhost/MapSolverService/", > Use=System.Web.Services.Description.SoapBindingUse.Literal, > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] > public void Close() { > this.Invoke("Close", new object[0]); > } > > > > > So, how to change that ? > > Thanks > > > > > > > "Yunus Emre ALPÖZEN [MCSD.NET]" <yemre> escribió en el mensaje > news:%23HAbJ0R9FHA.1140@tk2msftngp13.phx.gbl... >> If web service description remains same u can set web service url at run >> time.. Here is a pseudo code example: >> >> SolverService sService = new SolverService (); >> // and set sService.Url to URL what ever u want.. >> >> But be sure wsdl is same.. >> -- >> HTH >> >> Thanks, >> Yunus Emre ALPÖZEN >> BSc, MCSD.NET >> >> "Luis Arvayo" <amorenopalma@prodigy.net.mx> wrote in message >> news:OIqjZhR9FHA.1420@TK2MSFTNGP09.phx.gbl... >>> Hi, >>> >>> My app is a general purposes app and not a specific one. >>> >>> This means that customer who bought the application can have a web >>> service placed on the server on any given URL. >>> >>> I use the wsdl tool to create the service class, but the reference to >>> the url is hard coded inside the class. >>> >>> What is the correct way to implement the web service with a >>> parameterized URL address in such a way that end user of the app can >>> define it? >>> >>> >>> >>> Example of my class where you can see the hard coded url: >>> >>> [System.Diagnostics.DebuggerStepThroughAttribute()] >>> [System.ComponentModel.DesignerCategoryAttribute("code")] >>> [System.Web.Services.WebServiceBindingAttribute(Name="SolverServiceSoap", >>> Namespace="http://localhost/SolverService/")] >>> public class SolverService : >>> System.Web.Services.Protocols.SoapHttpClientProtocol { >>> /// <remarks/> >>> public SolverService() { >>> this.Url = http://localhost/SolverService/SolverService.asmx; >>> } >>> >>> /// <remarks/> >>> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/SolverService/Close, >>> RequestNamespace="http://localhost/SolverService/", >>> ResponseNamespace="http://localhost/SolverService/", >>> Use=System.Web.Services.Description.SoapBindingUse.Literal, >>> ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] >>> public void Close() { >>> this.Invoke("Close", new object[0]); >>> } >>> >>> .... >>> >>> >>> Thanks in advance. >>> >>> >>> >>> >>> >> >> > >
By the way, this statement: [quoted text, click to view] >> The problem here is that the methods of the web service class also >> maintains a reference to the url, like in this web method:
indicates a misunderstanding of XML namespaces. Those strings you referred to in the generated proxy class: [quoted text, click to view] >> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/MapSolverService/Close", >> RequestNamespace="http://localhost/MapSolverService/", >> ResponseNamespace="http://localhost/MapSolverService/", >> Use=System.Web.Services.Description.SoapBindingUse.Literal, >> ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] >> public void Close() { >> this.Invoke("Close", new object[0]); >> } >>
Those strings beginning with http:// are not URLs associated to the webservice. they are URIs used for namespaces in the XML that is handed back and forth. they are URIs not URLs. And they are independent of the endpoint. They could just as easily be urn:this-is-my-request-namespace and urn:this-is-my-response-namespace-ha-ha-ha-ha-aint-it-grand -D -- -Dino D i n o . C h i e s a AT M i c r o s o f t . c o m [quoted text, click to view] "Yunus Emre ALPÖZEN [MCSD.NET]" <yemre> wrote in message news:ecpptKe9FHA.1224@TK2MSFTNGP12.phx.gbl... > Hi again, > U can change web service reference from static to dynamic.. Request and > Response Namespace are not required to be "localhost".. Just give a > generic name like "tempuri.org"... Change them and call your web service, > and see what is going on... > > Using VS.NET, u can add a web reference.. But it is not an obligation. You > can simply implement Web Service Proxy class. If u are using primitive > data types, u can easily call it. Otherwise u must share your custom > objects with callee applications. Also, u can mark your input and output > parameters as XML serializable. Thus, would help u to call ws from > different platforms.. > > -- > HTH > > Thanks, > Yunus Emre ALPÖZEN > BSc, MCSD.NET > > "Luis Arvayo" <amorenopalma@prodigy.net.mx> wrote in message > news:%23DxUenS9FHA.2640@tk2msftngp13.phx.gbl... >> Thanks for answering. >> >> The problem here is that the methods of the web service class also >> maintains a reference to the url, like in this web method: >> >> >> >> /// <remarks/> >> >> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/MapSolverService/Close", >> RequestNamespace="http://localhost/MapSolverService/", >> ResponseNamespace="http://localhost/MapSolverService/", >> Use=System.Web.Services.Description.SoapBindingUse.Literal, >> ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] >> public void Close() { >> this.Invoke("Close", new object[0]); >> } >> >> >> >> >> So, how to change that ? >> >> Thanks >> >> >> >> >> >> >> "Yunus Emre ALPÖZEN [MCSD.NET]" <yemre> escribió en el mensaje >> news:%23HAbJ0R9FHA.1140@tk2msftngp13.phx.gbl... >>> If web service description remains same u can set web service url at run >>> time.. Here is a pseudo code example: >>> >>> SolverService sService = new SolverService (); >>> // and set sService.Url to URL what ever u want.. >>> >>> But be sure wsdl is same.. >>> -- >>> HTH >>> >>> Thanks, >>> Yunus Emre ALPÖZEN >>> BSc, MCSD.NET >>> >>> "Luis Arvayo" <amorenopalma@prodigy.net.mx> wrote in message >>> news:OIqjZhR9FHA.1420@TK2MSFTNGP09.phx.gbl... >>>> Hi, >>>> >>>> My app is a general purposes app and not a specific one. >>>> >>>> This means that customer who bought the application can have a web >>>> service placed on the server on any given URL. >>>> >>>> I use the wsdl tool to create the service class, but the reference to >>>> the url is hard coded inside the class. >>>> >>>> What is the correct way to implement the web service with a >>>> parameterized URL address in such a way that end user of the app can >>>> define it? >>>> >>>> >>>> >>>> Example of my class where you can see the hard coded url: >>>> >>>> [System.Diagnostics.DebuggerStepThroughAttribute()] >>>> [System.ComponentModel.DesignerCategoryAttribute("code")] >>>> [System.Web.Services.WebServiceBindingAttribute(Name="SolverServiceSoap", >>>> Namespace="http://localhost/SolverService/")] >>>> public class SolverService : >>>> System.Web.Services.Protocols.SoapHttpClientProtocol { >>>> /// <remarks/> >>>> public SolverService() { >>>> this.Url = http://localhost/SolverService/SolverService.asmx; >>>> } >>>> >>>> /// <remarks/> >>>> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/SolverService/Close, >>>> RequestNamespace="http://localhost/SolverService/", >>>> ResponseNamespace="http://localhost/SolverService/", >>>> Use=System.Web.Services.Description.SoapBindingUse.Literal, >>>> ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] >>>> public void Close() { >>>> this.Invoke("Close", new object[0]); >>>> } >>>> >>>> .... >>>> >>>> >>>> Thanks in advance. >>>> >>>> >>>> >>>> >>>> >>> >>> >> >> > >
Don't see what you're looking for? Try a search.
|