使用服务引用调用 WebService

Calling WebService with Service Reference

我正在尝试调用我创建的 Web 服务。我已将其发布到网站,并将其作为服务参考添加到我的解决方案中。所有的电话都在那里,所有的 classes 也在那里。但是当我尝试调用它时,我得到一个无效的 class.

异常

Cannot convert from 'GoS.GoSubmitWS.consent' to 'GoS.GoS.GoGetWS.consent'

代码

GoSubmitWS.consent consent = Database.DBConsent.GetConsentInfo(mjE.mj_message);

if (consent == null)
    return;

GoSubmitWS.GoSubmit_WebServiceClient wsClient = new GoSubmitWS.GoSubmit_WebServiceClient();

wsClient.ConsentInformation(Settings.Entity, mjE.mj_message, consent);

感谢您的帮助。

我通过生成的服务引用文件并删除了 GoS.GoSubmitWS.consent 中的名称空间引用设法解决了这个问题。GoSubmitWS.consent。