Answer the question
In order to leave comments, you need to log in
Why can't get response from soap wsdl php Curl server?
I myself am not friends with soap wsdl yet, although I have read a bunch of articles about them, but the basic basics do not fit in my head.
I found an example of accessing the server via Curl on the Internet and substituted my login, password and wsdl:
<?php
$query = '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header/>
<soap:Body>
<m:Calc xmlns:m="http://www.cargo3.ru">
<m:login>test</m:login> //login
<m:password>2016</m:password> //password
<m:data>
<m:Key>Destinations</m:Key>
<m:List>
<m:Key>Destination</m:Key>
<m:Fields>
<m:Key>SenderGeography</m:Key>
<m:Value>cf862f56-442d-11dc-9497-0015170f8c09</m:Value>
<m:ValueType>string</m:ValueType>
</m:Fields>
<m:Fields>
<m:Key>RecipientGeography</m:Key>
<m:Value>cf862f56-442d-11dc-9497-0015170f8c09</m:Value>
<m:ValueType>string</m:ValueType>
</m:Fields>
<m:Fields>
<m:Key>TypeOfCargo</m:Key>
<m:Value>4aab1fc6-fc2b-473a-8728-58bcd4ff79ba</m:Value>
<m:ValueType>string</m:ValueType>
</m:Fields>
<m:Fields>
<m:Key>Weight</m:Key>
<m:Value>1</m:Value>
<m:ValueType>float</m:ValueType>
</m:Fields>
<m:Fields>
<m:Key>VolumeWeight</m:Key>
<m:Value>1</m:Value>
<m:ValueType>float</m:ValueType>
</m:Fields>
<m:Fields>
<m:Key>Volume</m:Key>
<m:Value>1</m:Value>
<m:ValueType>float</m:ValueType>
</m:Fields>
<m:Fields>
<m:Key>Qty</m:Key>
<m:Value>1</m:Value>
<m:ValueType>int</m:ValueType>
</m:Fields>
</m:List>
</m:data>
<m:parameters xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<m:Key>Parameters</m:Key>
<m:List>
<m:Key>ipaddress</m:Key>
<m:Value xsi:type="xs:string">10.0.0.1</m:Value>
<m:ValueType>string</m:ValueType>
</m:List>
</m:parameters>
</m:Calc>
</soap:Body>
</soap:Envelope>';
$ch = curl_init();
curl_setopt_array(
$ch,
array(
CURLOPT_URL => 'http://lk-test.cse.ru/1c/ws/web1c.1cws?wsdl', //wsdl
CURLOPT_VERBOSE => FALSE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_POST => TRUE,
CURLOPT_POSTFIELDS => $query,
CURLOPT_HEADER => FALSE,
CURLOPT_HTTPHEADER => array('Content-Type: text/xml')
)
);
$response = curl_exec($ch);
curl_close($ch);
header('Content-Type: text/xml');
print_r($response);
?>
Answer the question
In order to leave comments, you need to log in
Why are you doing this manually?
Let's start with the fact that php has an extension php-soap , which only feeds the wsdl address and calls ready-made methods.
As a last resort, you can use the ready-made nusoap library
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question