WSDL Server with php-wsdl-creator
im trying to build an WSDL webservice for the first time and don’t even know how to do the wsdl file so i used this class: https://code.google.com/archive/p/php-wsdl-creator/
This is building a wsdl without the actual file in this address: http://wstest.sinemx.com/, but when i try to send this soap as a string:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <user>user</user> <pass>pass</pass> </soapenv:Body> </soapenv:Envelope>
Using this code:
private function SendXML($xml) { $url = "http://wstest.sinemx.com/index.php"; $soap_do = curl_init(); curl_setopt($soap_do, CURLOPT_URL, $url); curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($soap_do, CURLOPT_TIMEOUT, 10); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true); curl_setopt($soap_do, CURLOPT_POSTFIELDS, $xml); curl_setopt($soap_do, CURLOPT_HTTPHEADER, array('POST: /index.php HTTP/1.1', 'Host: wstest.sinemx.com', 'Content-Type: text/xml; charset=utf-8', 'Content-Length: ' . strlen($xml), 'SOAPAction: http://wstest.sinemx.com/GetGPSEvents')); //curl_setopt($soap_do, CURLOPT_USERPWD, $user . ":" . $password); $result = curl_exec($soap_do); $err = curl_error($soap_do); return $result; }
Returns this:
SOAP-ENV:ServerSoapServer::SoapServer(): Invalid parameters
This is on the server side:
//index.php require_once ( 'php-wsdl/class.phpwsdl.php' ); PhpWsdl::RunQuickMode ('service.php'); //service.php $soap = new SoapServer(); $soap->setClass('GetEvents'); $soap->handle(); class GetEvents { public function GetEvents(){ //your code } /** * * @param string $user * @param string $pass * @return string */ public function GetGPSEvents($user,$pass){ require_once 'com.sine.controlador/Controlador.php'; $c = new Controlador(); $xml = $c->login($user, $pass); return $xml; }
I think maybe is not able to read the soap request but im not sure, like i said this is the first server i make so hope you can help me with the error or a better way to make a WSDL server to read soap xml requests, thanks