2013-01-08 1 views
0

allposters.com SOAP (http://webservice.allposters.com/)에 문제가 있습니다. PHP 5.3 설치에서 (약간 수정 된) nuSOAP PHP 라이브러리 (http://sourceforge.net/projects/nusoap/)를 통해 제품 정보를 가져 오려고합니다.AllPosters.com SOAP 문제가있는 답변

내 요청 (정확히 여기처럼 모든 문자는, 그들이 개체로 변환되지 않습니다 있습니다)입니다 :

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> 

그리고이 특정 응답 오류를

Length cannot be less than zero. Parameter name: length 

을 얻을

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> 

통신이 정상적으로 작동하는 것처럼 보입니다. 내 이전 요청에서 "WebSiteID"요소를 제거하면 Visual Basic에서 샘플을 자신의 웹 사이트에 문서 나 웹에서 볼 수있는 몇 가지 예에서와 7 페이지에서, 나는 Unfortunatelly

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

를 얻을 것 (이 문서는 내가 찾을 수있는 유일한 문서 임), 나는 정말로 내가 누락 된 부분을 파악할 수 없으며, .NET 오류는 내가 사용할 수있는 것을 말해주지 않는다.

누군가가 allposters.com 제휴사 웹 서비스에 비슷한 문제를 경험하고 조언을 받았습니까?

+1

어디 당신이'length' 매개 변수를 보내는? 그렇지 않다면, 당신은 있어야합니까? – Madbreaks

+0

길이 매개 변수를 전달해야하는 것처럼 들립니다. –

+0

"길이가 0보다 작을 수는 없지만 매개 변수 이름 : 길이"는 요청에 길이 매개 변수가 없어서 아닙니다. 이미 그것을 추가하려고 시도),하지만 내 요청이 처리 될 때 서버에서 ASP 오류처럼 보인다. 아마도 문자열 빼기 작업이나 길이 매개 변수가 음수가되는 경우 일 것이다. 내 요청에 따라 서버에서이 문제가 발생한다는 것을 알 수 없습니다. 문서가 매우 부족하기 때문입니다. – Corneliu

답변

2

잘못된 방식으로 비누 서비스를 사용하고 있습니다.

http://webservice.allposters.com/ProductInformationService.asmx?op=GetProductByProductNumberInformation의 "GetProductByProductNumberInformation"호출에 대한 페이지의 예제를 보면 "string"이라는 위치 표시 만 있지만 완전한 XML 집합을 보냈습니다. 아마도 잘못된 것입니다.

내가 XML과 같은 문자열 이상을 보낼 수 있다고 생각하는 이유는 모르겠지만이 서비스는 실제로 XML로 묶여 XML이 단지 문자열 일 뿐이라는 것을 알았습니다. - 그런 다음 서버는 문자열을 압축 해제하고 다른 XML 구문 분석을 수행합니다.

이 구현 방법은 서비스가 허용하고 기대하는 매개 변수의 종류에 대한 WSDL 설명을 사용하여 SOAP 서비스를 갖는 지점을 우회하기 때문에 완전히 엉터리입니다.하지만 그 변경 가능성은 거의 없습니다.

그래서 NuSoap을 XML 문자열을 CDATA 태그로 감싸 야합니다. 그렇지 않으면 전혀 작동하지 않습니다.

+0

감사합니다. 그게 해결책이었습니다. – Corneliu

+0

@Corneliu - allposters.com에이 질문의 링크를 보낼 가치가 있습니다. 누가 다음 API 구현을 고려할 수 있습니까? – halfer

0

영업 질문 편집에 다음과 같은 솔루션을 제공, 그래서 나는 적절한 대답으로 이동하고있다 :

<?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> 
       <![CDATA[ 
        <APC_Search_Query> 
         <WebSiteID>1234567890</WebSiteID>       
          <SearchText>123456</SearchText> 
         <LanguageID>1</LanguageID> 
         <CurrencyCode>USD</CurrencyCode> 
        </APC_Search_Query> 
       ]]> 
      </APCSearchXml> 
     </GetProductByProductNumberInformation> 
    </soap:Body> 
</soap:Envelope>