简体   繁体   English

消耗Web服务-设置混乱

[英]Consuming Web Services - Confusion on Setup

I recently added a remote WSDL file for a web service to my app_webreferences folder. 我最近在我的app_webreferences文件夹中添加了用于Web服务的远程WSDL文件。

I can see all the objects in that WSDL file - however, the problem is that the company that i'm integrating with sent me two urls. 我可以看到该WSDL文件中的所有对象-但是,问题是与我集成的公司向我发送了两个URL。

  1. a wsdl: https://website.com/SOAP/Queue?wsdl wsdl: https ://website.com/SOAP/Queue wsdl
  2. an endpoint: https://website.com/SOAP/Queue?api_key=xxxxxx 端点: https//website.com/SOAP/Queue?api_key = xxxxxx

So - when I added the app_webreference I used the first url - it worked, added it to project. 所以-当我添加app_webreference时,我使用了第一个网址-它起作用了,将其添加到项目中。

I then proceeded to setup my bindings as such: 然后,我像这样设置绑定:

<wsHttpBinding>
  <binding name="QueueWebServiceBinding">
    <security mode="TransportWithMessageCredential">
      <message clientCredentialType="UserName" />
    </security>
  </binding>
</wsHttpBinding>

My client endpoint looks like this: 我的客户端端点如下所示:

  <endpoint address="https://website.com/SOAP/Queue?wsdl"
    binding="wsHttpBinding" bindingConfiguration="QueueWebServiceBinding"
    contract="MyWebService" name="QueueWebServicePort" />
</client>

The thing is, I cannot for the life of me get this to work. 问题是,我无法一辈子让它工作。 I'm not sure where I should use the endpoint url (#2) in any of this. 我不确定在任何情况下都应在哪里使用端点URL(#2)。 It seems that when I switch it out in the endpoint address (#2) above I receive a response of: 看来,当我在上面的端点地址(#2)中将其切换出时,收到以下响应:

...<env:Fault..... does not contain operation meta data for ... </env:Fault>...

I'm really confused on how to set this all up. 我真的很困惑如何设置所有这一切。

Another thing to note, they do require authentication... so my actual code looks something like this... 要注意的另一件事是,它们确实需要身份验证...所以我的实际代码看起来像这样...

MyWebServiceClient client = new MyWebServiceClient();
client.ClientCredentials.UserName.UserName = "username";
client.ClientCredentials.UserName.Password = "password";

var t = client.doSomething();

I've been googling/searching stackoverflow for the past few hours but have had little success figuring out the right way to set this all up. 在过去的几个小时中,我一直在搜索/搜索stackoverflow,但是在找出正确的方法进行设置方面几乎没有成功。

Appreciate any help. 感谢任何帮助。

The first endpoint is for the WSDL. 第一个端点用于WSDL。 The second endpoint is for the actual service itself. 第二个端点用于实际服务本身。 So you need to change your endpoint in your config file as follows: 因此,您需要按如下所示在配置文件中更改端点:

<client>
  <endpoint address="https://website.com/SOAP/Queue?api_key=xxxxxx"
            binding="wsHttpBinding" 
            bindingConfiguration="QueueWebServiceBinding"
            contract="MyWebService" name="QueueWebServicePort" />
</client>

Since you've already tried switching out the endpoint, try using the second endpoint to add the service reference and see if that works (if you haven't already). 由于您已经尝试切换出端点,因此请尝试使用第二个端点添加服务引用,并查看该引用是否有效(如果尚未使用)。

If neither of those work, then I'd suggest talking to the vendor's support staff to see if they can help, since they should know everything you need to do to access the service. 如果这些都不起作用,那么我建议与供应商的支持人员联系,以查看他们是否可以提供帮助,因为他们应该知道访问该服务所需的一切。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM