타사 api를 사용하여 잔액을 요청하고 있습니다. 다른 시도에서 여러 가지 오류가 발생하지만 가까운 건지 알고 있습니다. 여기에 호출 내 코드 ...SOAP PHP 요청 오류
<?php
try {
$wsdl_url = 'https://www.domain.com/SOAP?wsdl';
$UserID = 'UserID';
$Pwd= 'Password';
$client = new SOAPClient($wsdl_url);
$headerbody = array(
'UsernameToken'=>array('Username'=>$UserID,
'Password'=>$Pwd));
//Create Soap Header.
$header = new SOAPHeader('wsse', 'Security', $headerbody);
//set the Headers of Soap Client.
$client->__setSoapHeaders($header);
//$client->__getLastResponse();
$BalanceInquiryRequest->AccountNo="7777700020";
$BalanceInquiryRequest->RetailerId="0123";
$getBalance = $client->balanceInquiry($BalanceInquiryRequest);
print_r($getBalance);
} catch (SoapFault $fault) {
echo $fault->faultcode . "-" . $fault->faultstring;
//echo "REQUEST:\n" . htmlentities($client->__getLastRequest()) . "\n";
}
?>
이의 출력은 ...
ENV의 : 서버 java.lang.NullPointerException이
는 여기에 요청에 대한 XML입니다 ..
<soapenv:Envelope xmlns:req="http://domain.com" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="0" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-1">
<wsse:Username>Username</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">Password</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">5Ht+O9hKvAEXhNJZSTLg==</wsse:Nonce>
<wsu:Created>2012-03-27T15:31:01.792Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<req:BalanceInquiryRequest>
<req:AccountNo>7777700020</req:AccountNo>
<req:RetailerId>0123</req:RetailerId>
</req:BalanceInquiryRequest>
</soapenv:Body>
</soapenv:Envelope>
오류는 Java 오류입니다. 즉, 코드가 서버 측에서 실패하고 있음을 의미합니다. 서버 측을 디버그 할 수있는 방법이 있습니까? 누락 된 매개 변수 나 원래 개발자가 고쳐야하는 SOAP API 소스 코드의 버그 또는 잘못된 API 번호에 대한 요청과 같은 여러 가지 일 수 있습니다. SOAP API가 올바르게 처리하지 못합니다. – mellamokb
응답 해 주셔서 감사합니다. 불행히도이 API는 타사 API이므로 액세스 할 권한이 없습니다. 또한 SOAPUI에서 이것을 테스트 해 보았는데 제대로 작동하기 때문에 내가 잘못하고있는 것을 정의 할 수 있습니다. 계정 번호가 잘못되었지만 XML 기반 오류 응답을 제공해야합니다. –
Fiddler (http://www.fiddler2.com/fiddler2/)와 같은 도구를 사용해보고 SOAPUI의 요청을 PHP의 요청과 비교할 수 있습니까? – mellamokb