简体   繁体   English

从Ruby调用时,服务未对调用方进行身份验证?

[英]The caller was not authenticated by the service when calling from Ruby?

I need to consume a SOAP web service using the Savon Ruby client. 我需要使用Savon Ruby客户端使用SOAP Web服务。 I think the endpoint is written using the .NET framework, and, in fact, we currently have a .NET client library provided by the service team. 我认为端点是使用.NET框架编写的,实际上,我们目前有服务团队提供的.NET客户端库。

When using the client library, it works perfectly and data is retrieved sucessfully, but when using the Savon client, I'm getting: 使用客户端库时,它可以完美运行并且成功检索了数据,但是使用Savon客户端时,我得到:

(a:InvalidSecurity) The caller was not authenticated by the service. (Savon::SOAPFault)

The thing is, we already checked the SOAP requests, and both seem to be the same. 事实是,我们已经检查了SOAP请求,而且两个请求似乎相同。 The only difference is that one is done using Ruby and the other is done using .NET. 唯一的区别是,一个使用Ruby完成,另一个使用.NET完成。

Below are a couple examples of both requests: .NET client 下面是两个请求的两个示例:.NET客户端

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Identity xmlns="http://vauto.com/webservices/Haystak/1.0/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <AccessId>2A6B3F9FC49D1F4388AF7064045D964E</AccessId>
  <AccessStamp>2014-01-31T16:46:07.1597194-05:00</AccessStamp>
  <Signature>et0KyY1ZnjCM5z7BhQR9Q3Fj7V4=</Signature>
</Identity>
</s:Header>
<s:Body>
<GetVehicles xmlns="http://vauto.com/webservices/Haystak/1.0/">
  <request xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <EntityId>TEST01</EntityId>
  </request>
</GetVehicles>
</s:Body>
</s:Envelope>

Ruby client: Ruby客户端:

<?xml version="1.0" encoding="UTF-8"?>
  <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xmlns:wsdl="http://vauto.com/webservices/Haystak/1.0/" 
            xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Header>
    <Identity xmlns="http://vauto.com/webservices/Haystak/1.0/"
              xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
      <AccessId>2A6B3F9FC49D1F4388AF7064045D964E</AccessId>
      <AccessStamp>2014-02-03T10:24:50.3690365-05:00</AccessStamp>
      <Signature>ykKc5tWCyY9UVb+zw50hfAxOnSA=</Signature>
    </Identity>
</env:Header>
<env:Body>
  <wsdl:GetVehicles>        
    <request xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <EntityId>TEST01</EntityId>
  <EntityName i:nil="true" />
  <HaystakId i:nil="true" />
  <Vins i:nil="true"
          xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
    </request>
  </wsdl:GetVehicles>
</env:Body>

The WSDL for the web service is as follows: Web服务的WSDL如下:

在此处输入图片说明

Any help is greately appreciated. 非常感谢任何帮助。 I'm kind of lost and don't know what else to try in order to consume that web service. 我有点迷茫,不知道要使用该Web服务还要尝试什么。

A couple of things: 有两件事:

  • Your two SOAP requests are structurally very different, one is a <wsdl:GetVehicles> request (Savon) and the other is a <HelloWorld> (.NET). 您的两个SOAP请求在结构上截然不同,一个是<wsdl:GetVehicles>请求(Savon),另一个是<HelloWorld> (.NET)。
  • The order of the tags in your header is different. 标头中标签的顺序不同。 Ideally, this should not make a difference, but if the XML API on the server is retarded it can make things misbehave. 理想情况下,这应该没有什么区别,但是如果延迟服务器上的XML API,则可能会导致行为异常。
  • Your .NET identity block is namespaced but your Savon identity block is not. 您的.NET身份块已命名空间,但您的Savon身份块未命名空间。
  • Your Savon request has a namespace xmlns:wsdl="http://tempuri.org/" which looks invalid. 您的Savon请求具有一个名称空间xmlns:wsdl="http://tempuri.org/" ,该名称空间看起来无效。

SOAP is a misnomer, because it's not simple, and I've always thought that it is monumentally more difficult when you make calls between Microsoft and non-Microsoft ecosystems. SOAP用词不当,是因为它不简单,而且我一直认为,当您在Microsoft和非Microsoft生态系统之间进行调用时,SOAP变得更加困难。

First steps first, ensure you are generating the same request in both clients, and take it from there. 首先,请确保您在两个客户端中都生成相同的请求,然后从那里接受该请求。 Identical requests should elicit identical responses. 相同的请求应引起相同的响应。

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

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