Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems getting Ksoap2 client to talk to PHP based webservice
    primarykey
    data
    text
    <p>I'm having issues getting ksoap2 clients on a PC and Android to properly talk with a PHP webservice. I have tried both PHP's included libraries and nusoap and non of it works.</p> <p>Forgot error. Both the Android and PC client give a org.xmlpull.v1.XmlPullParserException but the messages are different. PC for instance gives <em>PI must not start with xml</em></p> <p>Here's the Code for my PC client. </p> <pre><code>import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.*; public class client { public static void main(java.lang.String args[]) { final String SOAP_ACTION = "http://secure.g4apps.com/submitAxios/writegpsdata"; final String METHOD_NAME = "writegpsdata"; final String NAMESPACE = "http://secure.g4apps.com/submitAxios/"; final String URL = "http://secure.g4apps.com/submitAxios.php"; SoapObject rpc = new SoapObject(NAMESPACE,METHOD_NAME); SoapSerializationEnvelope env = new SoapSerializationEnvelope(SoapEnvelope.VER11); rpc.addProperty("writegpsdataRequest","A1,E1,E1,AT333AT333,9055627513,2012-02-02 02:02:02,2012-02-02 02:02:02,-454545.343434,434343.232323,A334A334A334A443X,1000000,3434"); env.bodyOut=rpc; env.encodingStyle = SoapSerializationEnvelope.XSD; HttpTransportSE ht = new HttpTransportSE(URL); ht.debug = true; try { ht.call(SOAP_ACTION, env); System.out.println(ht.requestDump); } catch(org.xmlpull.v1.XmlPullParserException ex2) { System.out.println("Error" + ex2.toString() ); } catch (Exception ex){ String error = ex.toString(); System.out.println("Error: "+ error); } } } </code></pre> <p>Here's my PHP Server Code. THere is communication the function writegpsdata works but the client errors on the server response.</p> <pre><code>&lt;?php // submitGPS is a soap server which writes GPS data to a mysql database. // requires the writegpsdata.inc file which contains the required function // uses submitGPS.wsdl file for defining soap service require_once ("writegpsdata.axios.inc.php"); //require_once ("lib/nusoap.php"); ini_set("soap.wsdl_cache_enabled","0"); //disabling WSDL caching $server = new SoapServer("http://secure.g4apps.com/submitAxios.wsdl"); $server-&gt;AddFunction("writegpsdata"); $server-&gt;handle(); ?&gt; </code></pre> <p>For good measure, here's the wsdl file.</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://secure.g4apps.com/submitAxios/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="submitAxios" targetNamespace="http://secure.g4apps.com/submitAxios/"&gt; &lt;wsdl:message name="writegpsdataRequest"&gt; &lt;wsdl:part name="writegpsdataRequest" type="xsd:string"/&gt; &lt;/wsdl:message&gt; &lt;wsdl:message name="writegpsdataResponse"&gt; &lt;wsdl:part name="writegpsdataResponse" type="xsd:string"/&gt; &lt;/wsdl:message&gt; &lt;wsdl:portType name="submitAxios"&gt; &lt;wsdl:operation name="writegpsdata"&gt; &lt;wsdl:input message="tns:writegpsdataRequest"/&gt; &lt;wsdl:output message="tns:writegpsdataResponse"/&gt; &lt;/wsdl:operation&gt; &lt;/wsdl:portType&gt; &lt;wsdl:binding name="submitAxiosSOAP" type="tns:submitAxios"&gt; &lt;soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/&gt; &lt;wsdl:operation name="writegpsdata"&gt; &lt;soap:operation soapAction="http://secure.g4apps.com/submitAxios/writegpsdata"/&gt; &lt;wsdl:input&gt; &lt;soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://secure.g4apps.com/submitAxios/" use="encoded"/&gt; &lt;/wsdl:input&gt; &lt;wsdl:output&gt; &lt;soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://secure.g4apps.com/submitAxios/" use="encoded"/&gt; &lt;/wsdl:output&gt; &lt;/wsdl:operation&gt; &lt;/wsdl:binding&gt; &lt;wsdl:service name="submitAxios"&gt; &lt;wsdl:port binding="tns:submitAxiosSOAP" name="submitAxiosSOAP"&gt; &lt;soap:address location="http://secure.g4apps.com/submitAxios.php"/&gt; &lt;/wsdl:port&gt; &lt;/wsdl:service&gt; &lt;/wsdl:definitions&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload