Jump to content

philaj

New Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by philaj

  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. 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
  5. <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
  6. $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:http://127.0.0.1:58889 Referer:http://127.0.0.1:58889/http-services/emulator-webserver/ripple/userapp/x/C/Users/Phils/AppData/Local/XDK/xdk-scratchdir/e14eb410-7cf2-4bed-ba25-515e6df98e8c/platforms/ios/www/index.html 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.