require_once('lib/nusoap.php'); // Create the server instance $server = new soap_server(); // Initialize WSDL support $server->configureWSDL('hellowsdl', 'urn:hellowsdl'); // Register the method to expose $server->register('hello', // method name array('name' => 'xsd:string'), // input parameters array('return' => 'xsd:string'), // output parameters 'urn:hellowsdl', // namespace 'urn:hellowsdl#hello', // soapaction 'rpc', // style 'encoded', // use 'Says hello to the caller' // documentation ); function hello($name) { return 'Hello, ' . $name; } $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA);
private static final String SOAP_ACTION = "urn:hellowsdl#hello"; private static final String METHOD_NAME = "hello"; private static final String NAMESPACE = "urn:hellowsdl"; private static final String URL = "http://127.0.0.1/www/webs.php"; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); TextView tv = new TextView(this); setContentView(tv); SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); //SoapObject request.addProperty("name", "name"); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.setOutputSoapObject(request); HttpTransportSE httpTransport = new HttpTransportSE(URL); try { httpTransport.call(SOAP_ACTION, envelope); Object response = envelope.getResponse(); tv.setText(response.toString()); } catch (Exception exception) { tv.setText(exception.toString()); } }
private static final String URL = "http://10.0.2.2/www/webs.php";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)