0
soap 및 php를 사용하여 웹 서비스에 XML 요청을 보내는데 문제가 있습니다.중첩 태그 및 보안 헤더가있는 soap/php xml 요청을 보내려면 어떻게합니까
나는 여기와 다른 사이트에서 답을 읽고 며칠을 보냈지 만 내가하고 싶은 일과 일치하는 예는 찾을 수 없습니다. 중첩 된 xml 태그와 보안 헤더 로그인이있는 요청을 보내야합니다.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:GetAccommodationByCode>
<tem:getAccommodationByCodeRequest>
<tem:credentials>
<tem:username>userhere</tem:username>
<tem:password>passhere</tem:password>
</tem:credentials>
<tem:accommodationCode>prodcode</tem:accommodationCode>
<tem:interval></tem:interval>
</tem:getAccommodationByCodeRequest>
</tem:GetAccommodationByCode>
</soapenv:Body>
</soapenv:Envelope>
나는이 XML을 사용하여 PHP 요청을해야합니다
는 여기에 내가해야 할 요청합니다. 어떤 도움은 매우 극명하게 될 것이다
<?php
set_time_limit(0);
$wsdl = 'wsdl url here...';
$trace = true;
$exceptions = false;
$xml_array['username'] = 'pass123';
$xml_array['password'] = 'test123';
$xml_array['accommodationCode'] = '12345';
try
{
$client = new SoapClient($wsdl, array('trace' => $trace, 'exceptions' => $exceptions));
$response = $client->GetAccommodationByCode($xml_array);
}
catch (Exception $e)
{
echo "Error!";
echo $e -> getMessage();
echo 'Last response: '. $client->__getLastResponse();
}
var_dump($response);
?>
:
여기 내 시도입니다.
톰
시도를 게시 해주세요. 간과 한 잘못된 매개 변수 순서만큼 문제가 될 수 있습니다. – Prikkeldraad