philaj Posted February 23, 2018 Share Posted February 23, 2018 I'm trying to create a SOAP Server that will process requests from another system. The system sends a SOAP Envelope of XML in and I need to extract the fields and do some processing. Don't fully understand the WSDL they have provided - but I have created the following basic server code (See below) - which appears to run - and some debugging shows that it is called. At debug point 0 - outputs a text file containing 'here' - and at point 1 outputs text file containing the XML as below. BUT - My function never seems to be called - is there something basic I'm missing? Please any help much appreciated. <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><DynamicChange><VTID>5572</VTID><ExtID>5572</ExtID><FunctionCode>5</FunctionCode><Status>3</Status><FMExtID>WIECR</FMExtID><Termin_von>2018-02-21T00:00:00+00:00</Termin_von><Termin_bis>2018-02-23T00:00:00+00:00</Termin_bis><Plandauer>480</Plandauer><Besuchsdauer>480</Besuchsdauer><Planankunft>2018-02-27T09:00:00+00:00</Planankunft><Infotext></Infotext></DynamicChange></soap:Body></soap:Envelope> <?php // turn off WSDL caching ini_set("soap.wsdl_cache_enabled","0"); //Function to write a debug file function wdf($no, $text) { $fp = fopen('test'.$no.'.txt', 'w'); fwrite($fp, $text); fclose($fp); } // Main Function function DynamicChange($change) { wdf("2","here"); // Debug Write $VTID = $change->VTID; $ExtID = $change->ExtID; $FunctionCode = $change->FunctionCode; $Status = $change->Status; $FMExtID = $change->FMExtID; $Termin_von = $change->Termin_von; $Termin_bis=$change->Termin_bis; $Plandauer = $change->Plandauer; $Besuchsdauer = $change->Besuchsdauer; $Planankunft = $change->Planankunft; $Infotext = $change->Infotext; // Process it wdf("3",$ExtID); // Debug Write Return ['DynamicChangeRequestResult' => 0]; } wdf("0","here"); // Debug Write $postdata = file_get_contents("php://input"); wdf("1",$postdata); // Debug Write // initialize SOAP Server $server=new SoapServer("AspDynamicServer.wsdl"); $server->addFunction('DynamicChange'); // start handling requests $server->handle(); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.