F
F
farrukh772016-08-09 13:01:27
PHP
farrukh77, 2016-08-09 13:01:27

How can I send xml data and get response using SOAP+PHP?

Hello. Didn't work with SOAP. Help make a request.
I need to send xml Send request

<S:Envelope>
<SOAP-ENV:Header/>
<S:Body>
<ns2:updateDataResponse>
<token>6cc1447c386b4a65b3b980eaf07f7f37f680ec4496b04f1ca2c51</token>
<tabcode>12345</tabcode>
<tabname> text</tabname>
</ns2:updateDataResponse>
</S:Body>
</S:Envelope>

<S:Envelope>
<SOAP-ENV:Header/>
<S:Body>
<ns2:updateDataResponse>
<return
><resultCode>0</resultCode>
<resultMessage>OK</resultMessage>
<serviceId>185</serviceId>
<timeStamp>1458118724461</timeStamp>
<vername>2.2</vername>
</return>
</ns2:updateDataResponse>
</S:Body>
</S:Envelope>

?>
Returns me something like this:
I need to write this in php, I found an example
<?php
/*сам xml который исправно отправляется с помощью того-же SOAPUI */
$query="<code lang="xml">
<S:Envelope>
<SOAP-ENV:Header/>
<S:Body>
<ns2:updateDataResponse>
<token>6cc1447c386b4a65b3b980eaf07f7f37f680ec4496b04f1ca2c51</token>
<tabcode>kod</tabcode>
<tabname>text</tabname>
</ns2:updateDataResponse>
</S:Body>
</S:Envelope>
</code>";
/*создаю клиента*/
 $client =  new SoapClient ("адрес soap?wsdl", array('soap_version'   => SOAP_1_2)); 
/*Пытаюсь отправить запрос*/
$result = $client->getTicket($query);
var_dump($result); 

?>

not sent in the browser writes an error 500 but the connection is checked!
how do I write php correctly how do I correctly pass parameters and get a response. Tell me please.
Thanks a lot !

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lubezniy, 2016-08-10
@lubezniy

The browser has nothing to do with it. There are examples here:
php.net/manual/en/soapclient.soapcall.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question