2010-08-05 1 views
0

나는 전에 SOAP을 사용한 적이 없다고 말하는 것으로 시작하겠습니다.PHP SOAP 웹 서비스 호출

어쨌든, 내가 작성하려고하는 코드는 다음과 같습니다.

<soapenv:Body> 
<Circuits xmlns="http://www.qpricer.com/Services/Pricing"> 
<Circuit bandwidth="DS-3" port-billing-type="Flat" product="Dedicated Voice" term="1-Year"> 
<ns1:Loop npanxx="212255" xmlns:ns1="http://www.qpricer.com/Schema/Pricing"> 
<ns1:Address city="MANHATTAN" postal-code="10011" state="NY" street="111 8 AV FLR 1"/> 
</ns1:Loop> 
</Circuit> 
</Circuits> 
</soapenv:Body> 

헤더가 이미 있습니다. 나는 서비스를 잘 부를 수있다.

는 내가 가지고는이

//Make the call 
$result = $client->Price('Circuits', 
     array(
     'Circuit'   => array(
     'product'   => 'Dedicated Voice', 
     'port-billing-type' => 'flat', 
     'term'    => '1-Year', 
     'bandwidth'   => 'DS-3' 
     ), 

     'Loop'    => array(
     'npanxx'   => '212255' 
     ), 

     'Address'   => array(
     'street'   => '111 8 AV FLR 1', 
     'city'    => 'MANHATTAN', 
     'state'    => 'NY', 
     'postal-code'  => '10011') 
     )); 

// Display the result 
print_r($client->__getLastRequest()); 
print_r($result); 

답변

1

이 작동합니까입니다 :

$result = $client->Price('Circuits', 
    array(
    'Circuit'   => array(
     '_'     => array(
      'Loop'    => array(
       '_' => '', 
       'npanxx'   => '212255' 
      ), 
      'Address'   => array(
       '_' => '', 
       'street'   => '111 8 AV FLR 1', 
       'city'    => 'MANHATTAN', 
       'state'    => 'NY', 
       'postal-code'  => '10011' 
      ) 
     ), 
     'product'   => 'Dedicated Voice', 
     'port-billing-type' => 'flat', 
     'term'    => '1-Year', 
     'bandwidth'   => 'DS-3' 
     ) 
    )); 

'_'는 문서화하지만 가능한 것으로 보인다. 문제가 해결되지 않으면 http://www.php.net/manual/en/soapvar.soapvar.php의 의견을보십시오.

+0

불행히도, 아니요. 여전히 같은 오류입니다. QPricer.API.Common.Model.ApiException : 치명적 오류 : 캐치되지 않은 SoapFault 예외 : [soap : Client] QPricer.API.Common.Model.ApiException : QPricer.API.QPricer.Price (Circuits circuits)에서 XML 네임 스페이스를 확인하십시오. 스택 트레이스 : # 0 [내부 함수] : SoapClient -> __ call ('Price', Array) # 1 C : \ wamp \ www \ soap.php (79) : C : \ wamp \ www \ soap.php : SoapClient-> Price ('Circuits', Array) # 2 {main} C : \ wamp \ www \ soap.php 79 행에 던졌습니다. " – Xavias

+0

아, 그럼 아마도 단순한 형식 일뿐입니다. 마지막에 링크 된 soapvar 예제를 시도 했습니까 (주석을보십시오)? 결과 요청자는 무엇입니까? – Wrikken

+0

두 번째 예제를 시도했습니다. 그것은 이것을 돌려 줬다. "SOAP 오류 : QPricer.API.Common.Model.ApiException : 가격 요청에서 회로가 감지되지 않았습니다. XML 네임 스페이스를 확인하십시오. QPricer.API.QPricer.Price (회로 회선)
내 토큰은 여기에 있습니다. " – Xavias