"ns1"을 "ret"로 변경하고 "ret"로 설정된 네임 스페이스로 SoapUI를 사용하여 아래 XML을 테스트 한 결과 요청이 성공했습니다. 나는 "googled"하고, 여기에서 다른 관련 질문들로부터 답을 찾았지만 운이 없다. 그래서, 여기 PHP SoapClient 요청에서 네임 스페이스를 변경하고 있습니까?
요청에 전송 될 생성되는 XML입니다 ... 답을 찾을 수 종류의 필사적 :<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://retailexpress.com.au/">
<SOAP-ENV:Header>
<ns1:ClientHeader>
<ns1:ClientID>Random-hash-clientID</ns1:ClientID>
<ns1:UserName>Username</ns1:UserName>
<ns1:Password>Password</ns1:Password>
</ns1:ClientHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:CustomerGetBulkDetails>
<ns1:LastUpdated>2000-01-01T00:00:00.000Z</ns1:LastUpdated>
<ns1:OnlyCustomersWithEmails>1</ns1:OnlyCustomersWithEmails>
</ns1:CustomerGetBulkDetails>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
비록, 우리가 요청해야하는 것이 조금 이상한 것 같다
$rexHost = '<domain of retail express>';
$rexApi = '<URI of retail express API/wsdl path>';
$rexUser = 'Username';
$rexPassword = 'Password';
$rexApiClient = 'Random-hash-clientID';
$rexApiHost = 'http://retailexpress.com.au/';
$client = new SoapClient($rexHost.$rexApi, array('trace' => true));
$auth = new stdClass();
$auth->ClientID = $rexApiClient;
$auth->UserName = $rexUser;
$auth->Password = $rexPassword;
$header = new SoapHeader($rexApiHost, 'ClientHeader', $auth, false);
$client->__setSoapHeaders($header);
$lastUpdate = '2000-01-01T00:00:00.000Z'; //hardcoded for test
$params = array();
$params[] = new SoapVar($lastUpdate, XSD_DATETIME, null, null, 'LastUpdated', $rexApiHost);
$params[] = new SoapVar(1, XSD_INTEGER, null, null, 'OnlyCustomersWithEmails', $rexApiHost);
try {
$users = null;
return $users = $client->CustomerGetBulkDetails(new SoapVar($params, SOAP_ENC_OBJECT));
} catch (Exception $e) {
Log::info($e->getMessage());
Log::info($client->__getLastRequest()); //laravel logger, where I got the generated SOAP XML request
return false;
}
코드에 문제가 없습니다. 문제를 찾을 수 있었습니까? –
네임 스페이스를 변경하는 방법을 찾지 못했습니다. 하지만 이제는 단일 코드를 변경하지 않고도 작동하는 것 같습니다. 아마도 우리가 지원을 요청했기 때문에 문제를 해결할 수 있었을 것입니다. 네임 스페이스 "ns1"은 SOAP 요청과 함께 API로 작동합니다 ... 감사합니다! – jediscript
아 서버 문제 :) –