我目前正在开发一个基于c#的webapp,它调用了一些web服务.我已将三个不同的WSDL从提供程序导入到我的WebApplication3项目中(引用 - >添加Web引用).在类查看器中,它们显示为:
WebApplication3.com.provider.webservices1
WebApplication3.com.provider.webservices2
WebApplication3.Properties
显然第一个和第二个WSDL具有重复的功能(是正确的名称吗?)
如果我添加到我的Default.aspx .cs以下使用:
using WebApplication3.com.sabre.webservices1;
使用WebApplication3.com.sabre.webservices2;
使用WebApplication3.Properties;
然后尝试使用:
MessageHeader msgHeader = new MessageHeader();
在我WebApplication3命名空间中,我得到的错误
"WebApplication3.com.provider.webservices1和WebApplication3.com.provider.webservices2之间的暧昧参考"
我想这是因为它在两个WSDL声明?我该如何解决这个问题,以便我可以使用它?
谢谢,对不起,如果问题是愚蠢的!
尝试使用其完整命名空间引用MessageHeader.例如.
WebApplication3.com.provider.webservices1.MessageHeader msgHeader = new
WebApplication3.com.provider.webservices1.MessageHeader()
Run Code Online (Sandbox Code Playgroud)
为简洁起见,你可以试试
using MessageHeader = WebApplication3.com.provider.webservices1.MessageHeader
Run Code Online (Sandbox Code Playgroud)
哪个会让你使用
MessageHeader msgHeader = new MessageHeader()
Run Code Online (Sandbox Code Playgroud)
其中MessageHeader来自webservices1名称空间