eBay API SOAP请求适用于SoapUI,但不适用于shell

时间:2013-12-27 05:39:25

标签: bash soap curl soapui ebay

以下在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有什么不同。

1 个答案:

答案 0 :(得分:0)

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

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

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