Есть вот такой код:
curl -H "Content-Type: text/xml; charset=utf-8" \
-H "SOAPAction: \"http://www.example.com/contractor/dtaservice/v7/contractorservice/GetProductCatalog\"" \
-d @$3 \
-X POST http://$1:$2/DTAContractor/Service/ContractorSystemService
где, $1 = ip,
$2 = порт,
$3 = xml файл:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:AuthenticationHeader xmlns:h="http://www.example.com/contractor/dtaservice/v7/contractorheader" xmlns="http://www.example.com/contractor/dtaservice/v7/contractorheader" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ClientId>ID</ClientId>
<UserName>USER</UserName>
<Password>PASS</Password>
</h:AuthenticationHeader>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetProductCatalogRequest xmlns="http://www.example.com/contractor/dtaservice/v7/contractormessages" />
</s:Body>
</s:Envelope>
Пробовал вот так:
$location = 'http://'.$ip.':'.$port.'/DTAContractor/Service/ContractorSystemService';
$uri = 'http://www.example.com/contractor/dtaservice/v7/contractorservice/GetProductCatalog';
$ns = 'http://www.example.com/contractor/dtaservice/v7/contractorheader';
$soap = new SoapClient(null, array('location' => $location, 'uri' => $uri, 'trace' => 1));
$headerBody = array(
'ClientId' => $clientId,
'UserName' => $userName,
'Password' => $password,
);
$soapHeader = new SoapHeader($ns, 'AuthenticationHeader', $headerBody);
$soap->__setSoapHeaders($soapHeader);
$soap->GetProductCatalogRequest();
Получаю ошибку: User Error: SOAP-Fehler: (Fehlernummer: HTTP, Fehlermeldung: Could not connect to host)
Что я делаю не так? Спасибо!