Hello. I didn’t work with SOAP, I’m a teapot ((((. Help make a request. I need to send xml

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

Returns me about the following parameters:

 <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> 

I need to write this in php, found an example

/ * itself xml which is regularly sent using the same SOAPUI * /

 $query="`<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); ` 

It does not go to the browser, writes error 500, but I have checked the connections! how do i write php correctly, how do i pass the parameters correctly and get an answer. Tell me please. Thank you so much !


Wsdl looks like this

 <definitions targetNamespace="http://classservice.aaa.bbb.com" name="ClassifiersWS"><types><xsd:schema><xsd:import namespace="http://classservice.aaa.bbb.com/" schemaLocation="http://classifiers.sss.com:80/classservice/service?xsd=1"/></xsd:schema></types><message name="updateData"><part name="parameters" element="tns:updateData"/></message><message name="updateDataResponse"><part name="parameters" element="tns:updateDataResponse"/></message><message name="getVersions"><part name="parameters" element="tns:getVersions"/></message><message name="getVersionsResponse"><part name="parameters" element="tns:getVersionsResponse"/></message><message name="getData"><part name="parameters" element="tns:getData"/></message><message name="getDataResponse"><part name="parameters" element="tns:getDataResponse"/></message><portType name="Service"><operation name="updateData"><input wsam:Action="http://classservice.aaa.bbb.com/Service/updateDataRequest" message="tns:updateData"/><output wsam:Action="http://classservice.aaa.bbb.com/Service/updateDataResponse" message="tns:updateDataResponse"/></operation><operation name="getVersions"><input wsam:Action="http://classservice.aaa.bbb.com/Service/getVersionsRequest" message="tns:getVersions"/><output wsam:Action="http://classservice.aaa.bbb.com/Service/getVersionsResponse" message="tns:getVersionsResponse"/></operation><operation name="getData"><input wsam:Action="http://classservice.aaa.bbb.com/Service/getDataRequest" message="tns:getData"/><output wsam:Action="http://classservice.aaa.bbb.com/Service/getDataResponse" message="tns:getDataResponse"/></operation></portType><binding name="ServicePortBinding" type="tns:Service"><soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/><operation name="updateData"><soap:operation soapAction=""/><input><soap:body use="literal"/></input><output><soap:body use="literal"/></output></operation><operation name="getVersions"><soap:operation soapAction=""/><input><soap:body use="literal"/></input><output><soap:body use="literal"/></output></operation><operation name="getData"><soap:operation soapAction=""/><input><soap:body use="literal"/></input><output><soap:body use="literal"/></output></operation></binding><service name="ClassifiersWS"><port name="ServicePort" binding="tns:ServicePortBinding"><soap:address location="http://classifiers.sss.com:80/classservice/service"/></port></service></definitions> 
  • If the error in the browser - it looks like you are trying to open the script through the browser. And this script crashes. Those. it's not about the connection. Either an error in the syntax, or somewhere else. So either turn on error output, or see the webserver logs or PHP - maybe there is more information there. - newman

1 answer 1

 <?php $request = new stdClass(); $request -> token = '6cc1447c386b4a65b3b980eaf07f7f37f680ec4496b04f1ca2c51'; $request -> tabcode = 'kod'; $request -> tabname = 'text'; $client = new SoapClient ( "адрес soap?wsdl", array('soap_version' => SOAP_1_2) ); $response = $client->getTicket($request); 

In theory, something like this, but you can say more precisely on wsdl.