0

I'm now using phonegap to develop a application. I have found a similar php code which can assess to a local server here, but unfortunately phonegap doesn't support php.

Can anyone help me to 'translate' the php code below into JQuery ajax or any other javascript code? Thanks!

require_once('nusoap.php');

  /* create client */
  $endpoint = "http://www.pascalbotte.be/rcx-ws/rcx";
  $ns = "http://phonedirlux.homeip.net/types";

  $client = new soapclient($endpoint);

  // queryRcx is the name of the method you want to consume
  // RcxQuery_1 is the name of parameter object you have to send
  // x and y are the names of the integers contained in the object
  $result = $client->call('queryRcx',array('RcxQuery_1' => array('x' => 12,'y' => 13)), $ns);
print_r($result);

2 Answers 2

2

Step 1. Resolve the 404 associated with http://www.pascalbotte.be/rcx-ws-rpc/rcx?WSDL
Step 2. Get a JavaScript SOAP client.
Step 3. ... ... ...
Step 4. PROFIT!

Seriously though. All this really takes is a JavaScript based SOAP client. While they aren't a dime-a-dozen, they are pretty common. The one above is for jQuery, but it is easy enough to find other implementations.

The fact that the WSDL definition causes a 404 may or may not be a problem as the actual wsdl definition is technically optional, but you really want to figure out what happened.

Sign up to request clarification or add additional context in comments.

4 Comments

+1 for step 1 :) BTW, is the crossdomain request policy applied to requests over phonegap?
Cross domain policies will continue to be cross. There isn't anything which can be done to change that.
Thanks, I havent used phonegap (yet), but I supposed it is only a tool to distrubute my html5 app, and any services I consume must be on my host (same as application itself), or have a proxy through it.
Sorry, i have made some modification above, changed it into SOAP instead of WSDL as I'm more familiar with SOAP.
0

You can add this header to the PHP file or .htaccess to avoid problems with cross domain reqs: header('Access-Control-Allow-Origin: *');

Replace the all(*) with your domain ;)

Good luck!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.