douyun3022 2013-01-08 19:46
浏览 57
已采纳

AllPosters.com SOAP有问题的响应

I have a problem with the allposters.com SOAP (http://webservice.allposters.com/). I am trying to fetch some product information via (a slightly modified) nuSOAP PHP library (http://sourceforge.net/projects/nusoap/) on a PHP 5.3 installation.

My request is (all the characters are exactly like here, they are not converted to entities):

POST /ProductInformationService.asmx HTTP/1.0
Host: webservice.allposters.com
User-Agent: NuSOAP/0.9.5 (1.123)
Content-Type: text/xml; charset=UTF-8
SOAPAction: "http://Webservice.Allposters.com/APCF.AffiliateWebService/ProductInformationService/GetProductByProductNumberInformation"
Content-Length: 570

<?xml version="1.0" encoding="UTF-8" ?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <GetProductByProductNumberInformation xmlns="http://Webservice.Allposters.com/APCF.AffiliateWebService/ProductInformationService">
            <APCSearchXml>
                <WebSiteID>1234567890</WebSiteID>
                <SearchTerm>1234567</SearchTerm>
                <LanguageID>1</LanguageID>
                <CurrencyCode>USD</CurrencyCode>
            </APCSearchXml>
        </GetProductByProductNumberInformation>
    </soap:Body>
</soap:Envelope>

And I get the error

Length cannot be less than zero. Parameter name: length

in this specific response

HTTP/1.1 200 OK
Connection: keep-alive
Date: Tue, 08 Jan 2013 18:46:59 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 4.0.30319
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 821

<APC_Search_Results>
   <StatusCode>1</StatusCode>
   <Search_Error>
       <ErrorNumber>1</ErrorNumber>
       <ErrorDescription>Length cannot be less than zero. Parameter name: length</ErrorDescription>
   </Search_Error>
</APC_Search_Results>

The communication seems to be working fine; if I remove the "WebSiteID" element from my previous request, I would get

Index was out of range. Must be non-negative and less than the size of the collection.

Unfortunatelly, from the few examples I found on the web and from a 7-pages document on their website with a sample in Visual Basic (this is the only documentation I was able to find), I really can't figure out what I am missing, and that .NET error doesn't tell me something I can use.

Did someone experienced similar problems with the allposters.com affiliate webservice and have some advice?

  • 写回答

2条回答 默认 最新

  • duan41497 2013-01-08 20:32
    关注

    You are using the Soap service in the wrong way.

    If you look at the example on the page for the call "GetProductByProductNumberInformation" on http://webservice.allposters.com/ProductInformationService.asmx?op=GetProductByProductNumberInformation there is only a placeholder "string" mentioned, but you are sending a complete set of XML. This is probably wrong.

    I don't know why you think you can send more than a string like the XML you did, but I found out that this service actually expects you to send your XML wrapped inside a CDATA so that it is just a string - the server then unpacks the string and does another XML parsing.

    This implementation method is completely bullshit, because it circumvents the point of having a Soap Service with a WSDL description of what kind of parameters the service allows and expects - but you are most unlikely to change that.

    So you have to make NuSoap to wrap your XML string inside CDATA tags, otherwise it won't work at all, I think.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器