开发者

Dynamically change the namespace SoapTypeAttribute

开发者 https://www.devze.com 2023-04-03 03:42 出处:网络
I have a problem with service references visual studio. I have a client who gives me a WSDL file to work with php.

I have a problem with service references visual studio.

I have a client who gives me a WSDL file to work with php. I made a reference to the service of his ClassLibrary wsdl in my project. Below is a portion of the generated proxy code

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.SoapTypeAttribute(Namespace="http://127.0.0.1:88/webservices/wsdl")] public partial class loginReturn : object, 开发者_StackOverflow社区System.ComponentModel.INotifyPropertyChanged {

My problem is that wsdl is can be installed on another server to a second client. Thus the address of the wsdl is set in my app.config

I did a test by changing the server port error is encountered My problem is the namespace of SoapTypeAttribute

[System.Xml.Serialization.SoapTypeAttribute(Namespace="http://127.0.0.1:88/webservices/wsdl")]

How can change this attribute value according to the server address because i have this error

Error deserializing body of reply message for operation 'getlogin'..

for this method

loginReturn t =  service.Getlogin("username", "pwd");

Thank you for your help


The attribute is being cause by this "127.0.0.1:82/moodle/wspp/wsdl" namesspace in your wsdl file. This can be any value so long as it is unique, URLs are usually used. So long as this is the SAME on both servers, setting the URL on the proxy class for the web service should work. e.g.

MyMroxyClass.Url = ConfigurationManager.AppSettings["MyServiceURL"]


I solved the problem.

The problem was server side, not client side. My client regenerated the wsdl on each server, so the signature of the changed wsdl

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号