[英]Change WSDL service url at runtime
I added the reference from Visual Studio, with Add service reference -> Advanced -> Add Web Reference, set the Url Behoviour to dynamic, but when i try to change the url it give me 我从Visual Studio中添加了引用,添加服务引用->高级->添加Web引用,将Url行为设置为动态,但是当我尝试更改URL时,它给了我
{"Cannot assign object of type System.Xml.XmlNode[] to an object of type ServiceAccessor.ServiceReference1.DataObject."}
I noticed that the SoapRpcMethodAttribute inside reference.vb is hardcoded SoapRpcMethodAttribute("//server/Service/Action", RequestNamespace:="urn:ServiceWSDL", ResponseNamespace:="urn:ServiceWSDL")> 我注意到reference.vb中的SoapRpcMethodAttribute是硬编码的SoapRpcMethodAttribute(“ // server / Service / Action”,RequestNamespace:=“ urn:ServiceWSDL”,ResponseNamespace:=“ urn:ServiceWSDL”)>
Dim service = New ServiceWSDL()
service.Timeout = 10000
service.Url = "https://differentServer/Service"
I also noticed that if i change the mentioned SoapRpcMethodAttribute to "//differentServer/Service/Action" then it works with "//differentServer/Service" url but then it won't work with "//server/Service" url 我还注意到,如果我将提到的SoapRpcMethodAttribute更改为“ // differentServer / Service / Action”,则它可以与“ // differentServer / Service” URL一起使用,但不适用于“ // server / Service” URL
If i add it as a service reference and change it's endpoint address i get the same error 如果我将其添加为服务引用并更改其端点地址,则会遇到相同的错误
Dim service1 = New ServiceWSDL()
service1.Endpoint.Address = New EndpointAddress("//differentServer/Service")
PS i added the c# tag because i also work with c# so code in that language would also help me PS我添加了c#标签,因为我也使用c#,因此使用该语言编写的代码也将对我有所帮助
与有权访问服务器和System.Xml.Serialization.SoapTypeAttribute([Namespace]:="server")
的命名空间的家伙交谈
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.