【问题标题】:eBay API SOAP request works in SoapUI but not from shelleBay API SOAP 请求在 SoapUI 中有效,但在 shell 中无效
【发布时间】:2013-12-27 05:39:25
【问题描述】:

以下内容在 SoapUI 中完美运行(这是我构建它的地方),但是当我复制确切的请求并尝试在 bash 命令行(实际上是 cygwin)中使用 cURL 执行时,它说:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"  xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <soapenv:Fault>
   <faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
   <faultstring>no SOAPAction header!</faultstring>
   <detail/>
  </soapenv:Fault>
  </soapenv:Body>

我使用的命令是:

curl -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAction:" -d "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ebay:apis:eBLBaseComponents"><soapenv:Header><urn:RequesterCredentials><urn:eBayAuthToken>AgA***GO</urn:eBayAuthToken></urn:RequesterCredentials></soapenv:Header><soapenv:Body><urn:GetMyeBaySellingRequest><urn:Version>793</urn:Version><urn:ActiveList><urn:Include>1</urn:Include><urn:IncludeNotes>0</urn:IncludeNotes></urn:ActiveList><urn:OutputSelector>ActiveList.ItemArray.Item.ItemID</urn:OutputSelector><urn:DetailLevel>ReturnAll</urn:DetailLevel><urn:HideVariations>1</urn:HideVariations></urn:GetMyeBaySellingRequest></soapenv:Body></soapenv:Envelope>" -X POST https://api.ebay.com/wsapi?callname=GetMyeBaySelling

我已经在其他 API 上使用了这种精确的语法,没有任何问题,但不确定 eBay 有什么不同。

【问题讨论】:

  • 已修复,根据 user3090039 下面的建议使用 SOAPAction:none

标签: bash soap curl soapui ebay-api


【解决方案1】:

打开你的 wsdl。搜索您用于发送此“GetMyeBaySellingRequest”请求的操作。 从那里复制肥皂动作并添加到你的命令行中

"SOAPAction: add soap action here from bindings or from soapui" 

或在 SOAP UI 中单击操作并在左下角查看,您将看到“操作属性”。从那里复制肥皂动作值并将其放入您的命令中。

【讨论】:

  • 我试过了,它在 wsdl 中所说的只是 。 wsdl 位于developer.ebay.com/webservices/latest/ebaysvc.wsdl。在 SoapUI 中,我看不到“操作属性”,但在请求的“原始”中显示 SOAPAction:“”
  • 好的,你可以尝试通过从你的命令中删除 -H SOAPAvtion 来执行。
  • 尝试“SOAPAction:”“”或“SOAPAction:”提供空间。我在这里有点不知所措。在soap ui中,在请求属性的左下角,如果您选择skip SOAP Action作为true,您将得到与此处完全相同的错误。您是否也可以在某个地方检查 curl 中的类似属性。我对此一无所知。
  • 你是对的。我在 SoapUI 中修改了该命令,但确实遇到了同样的错误。问题是如何直接在命令行中将其设置为“false”。我觉得我们正在到达某个地方......
  • 你试过双引号,SOAPAction: "",也试试 SOAPAction:none。
猜你喜欢
  • 2023-04-05
  • 1970-01-01
  • 2017-05-03
  • 1970-01-01
  • 2017-10-19
  • 2016-07-11
  • 2018-10-27
  • 2016-10-25
  • 1970-01-01
相关资源
最近更新 更多