Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About philaj

  • Rank

Recent Profile Visitors

732 profile views
  1. 've create a SOAP Server using the PHP Soap functions. It has 3 functions in it and is initialised as follows; // Initialise the SOAP Server $opts = Array(); $opts['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP; $server = new SoapServer('SOTBWSDL.wsdl', $opts); $server->addFunction('getAvailability'); $server->addFunction('putReservation'); $server->addFunction('putCancelBooking'); $server->handle(); There are then 3 Functions as defined with the code in for each . I have created a test client which makes the call as; $client = new SoapClient('http://xxxxxxxxx/SOTBWSDL.wsdl',array('trace'=>1,'exceptions=>1')); $res = $client->getAvailability($xmlparams); This works and returns data as expected. However - if I try the call as $res = $client->putReservation($xmlparams); (To another function) it is the first function (get Availability) that is executed. Question 1: Are separate Functions ok to use - -or do they need to be in a Class? Question 2: No Errors are thrown regarding the WSDL so I presume this must be ok .... What reasons could cause this? Any help greatfully received. Phil
  2. ginerjm - The files are ftp'd into a location - and my script needs to process them. Thanks requinix I'll check that out
  3. Hi All - hope someone has done this before. I need to create a PHP script that detects the presence of a new file appearing into a folder, and process it. This HAS to be supported by Windows IIS (Have looked at FAM for Linux but can't use it). I could do a loop with some sleep that checks the directory every x seconds - but this has been discounted by the client as either a) too resource hungry or b) not quick enough if there is a delay. Add ons, extensions or even external 3rd party tools would all be acceptable. Any ideas? Phil
  4. 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(); ?>
  5. Hi there I'm an intermediate user of PHP, but have never needed to connect to a webservice before, and am having some problems. Hope someone can help I have the following code to test connecting to the service; $soapURL = 'http://xxx.xxx.xx.xx4/wsdl/wsdl' ; $soapParameters = Array('login' => "xxx", 'password' => "1234") ; $client = new SoapClient($soapURL, $soapParameters); var_dump($client->__getFunctions()); Which works fine and give me back the following; array(6) { [0]=> string(35) "CallResponse Call(Call $parameters)" [1]=> string(59) "FieldManagerResponse FieldManager(FieldManager $parameters)" [2]=> string(56) "FixScheduleResponse FixSchedule(FixSchedule $parameters)" [3]=> string(44) "GeocodeResponse Geocode(Geocode $parameters)" [4]=> string(59) "ShowCallInfoResponse ShowCallInfo(ShowCallInfo $parameters)" [5]=> string(59) "WorkScheduleResponse WorkSchedule(WorkSchedule $parameters)" } I now want to call the ShowCallinfo function which has 2 parameters, an integer 0, and a string 'CA12345' - and should return a set of data; I have tried so many combinations I am going dizzy, and just can't get anything to work. latest I have tried (immediately after the other code) are; $result = $client->ShowCallInfo(0,'CA212345'); Which results in a SoapFault exception: [HTTP] Not Found in Please can someone help?? Phil
  6. <script> function sendData(form) { var postform = new FormData(); var fileselect = document.getElementById('mypic'); var files = fileselect.files; postform.append('SBP_Details', document.getElementById('Details')); // Loop through each of the selected files. for (var i = 0; i < files.length; i++) { var file = files[i]; // Check the file type. if (!file.type.match('image.*')) { continue; } // Add the file to the request. postform.append('upload_file[]', file, file.name); } // postform.append('upload_file', document.getElementById('mypic')); var xmlhttp = new XHRObject(); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { //xmlhttp.responsetext will have what is sent back - use Print_R in php } } xmlhttp.open("POST","http://stxxx.co.uk/SBPostPost.php", false); xmlhttp.setRequestHeader('Content-Type','multipart/form-data'); xmlhttp.send(postform); } </script> Thanks Ch0cu3r Went thru that tutorial and coded as it says - also took the php bits from the other article; I now have as above in Jscript - and just echo $_POST, $_GET and $_Files but only get empty Arrays..... ...it's the PHP bit I need to Phil
  7. $headers = getallheaders(); if ($headers["Content-Type"] == "application/json") { $jsondata = file_get_contents("php://input"); $data = json_decode($jsondata,TRUE); echo ($data['SBP_Category']."/".$data['SBP_Details']); echo ($data['upload_file']); } if (isset($_FILES['upload_file'])) { if(move_uploaded_file($_FILES['upload_file']['tmp_name'], "temp/" . $_FILES['upload_file']['name'])){ echo $_FILES['upload_file']['name']. " OK"; } else { echo $_FILES['upload_file']['name']. " KO"; } exit; } else { echo "No files uploaded ..."; } Request URL:http://strxxx.co.uk/SBPostPost.php Request Method:POST Status Code:200 OK Request Headers Provisional headers are shown Content-type:application/json Origin: Referer: User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.3 (KHTML, like Gecko) Version/8.0 Mobile/12A4345d Safari/600.1.4 X-DevTools-Emulate-Network-Conditions-Client-Id:BFC389F1-2AF4-4347-8AC1-F9144DC2DA25 Request Payloadview source {SBP_Category:Select, SBP_Details:xxxxx Detail xxxx, upload_file:[object File]} SBP_Category: "Select" SBP_Details: "xxxxx Detail xxxx" upload_file: "[object File]" Response Headers Content-Encoding:gzip Content-Length:251 Content-Type:text/html Date:Sun, 20 Sep 2015 13:11:33 GMT Server:Microsoft-IIS/8.5 Vary:Accept-Encoding <script> function sendDataJS() { var xmlhttp = new XHRObject(); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById('ResponseDiv').innerHTML = "Entry Posted"; } } var postdata = '{'; postdata += '"SBP_Category": "' + document.getElementById('Category').value + '"'; postdata += ',"SBP_Details": "' + document.getElementById('Details').value + '"'; postdata += ',"upload_file": "' + document.getElementById('mypic').files[0] + '"'; postdata += '}'; xmlhttp.open("POST","http://strxxx.co.uk/SBPostPost.php", false); xmlhttp.setRequestHeader("Content-type","application/json"); xmlhttp.send(postdata); } Getting very confused by all the options available - could someone please help. I'm developing a hybrid HTML5/JS App in XDK that sends data to a PHP server. I can get at the data fields but struggling with a file (image). The JS that sends is as above; preceded by the console Log - which looks like it is sending the file ok as an object The PHP is also attached - What happens is that the Data in Category and Detail is echoed back fine; the echo of $Data['ipload_file'[ shows 'object' - BUT the If ISSET echoes 'No Files uploaded' Any help appreciated. By the way - the extracts above may be in wrong order - had trouble getting them into the post
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.