Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Android(client) calling method from the server(nuSOAP)

Android(client) calling method from the server(nuSOAP)

Put your problem here if it does not fit any of the other categories.

Android(client) calling method from the server(nuSOAP)

Postby joemarieamparo » Fri Feb 25, 2011 4:41 am

Hello,

I am trying to create a webservice with nuSOAP and PHP as the language for my android application.

note:
printMessage = the function that I wanted to invoke from the server.

I have the following files on my server:
1. client.php //receives the request
Here's the code:

<?php

/**
* @author MESMERiZE
* @copyright 2011
*/

require_once('nusoap/lib/nusoap.php');
try{
$client = new nusoap_client("http://[ip address]/test/server.php");
$result = $client->call("printMessage", ??????????); //this is my
question on this part. this should be the value
passed from the client request. I don't know how
to do it. Please HELP.

header("Content-type: text/xml");
echo "<?xml version='1.0' encoding='ISO-8859-1'?>";
echo "<callback>";
echo "<request>";
echo "<authentication>";
echo "<status>200</status>";
echo "<message>Success</message>";
echo "<content>";
echo "<id>".$result."</id>";
echo "<sessionkey>Tove</sessionkey>";
echo "</content>";
echo "</authentication>";
echo "</request>";
echo "</callback>";


}catch(Exception $e){
echo $e->getMessage();

}

2. server.php
Here's my code:
<?php

/**
* @author MESMERiZE
* @copyright 2011
*/

require_once 'nusoap/lib/nusoap.php';
require_once 'library.php';

$server = new soap_server();
$server->register('printMessage' );

$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>

3. library.php
here's my code:
<?php
/**
* @author MESMERiZE
* @copyright 2011
*/

function printMessage($id) {
//return 'Printing a message';

if($id == 1)
return $id;
else
return "Not number 1.";
}

?>

And for my client side programming, here is my code:

private static final String SOAP_ACTION = "printMessage";
private static final String METHOD_NAME = "printMessage";
private static final String NAMESPACE = "urn:printMessage";
private static final String URL = "http://[IP ADDRESS]/Test/client.php";
TextView text;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
text = (TextView)findViewById(R.id.text);
SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
Request.addProperty("id", "1");

SoapSerializationEnvelope soapEnvelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);

soapEnvelope.setOutputSoapObject(Request);

AndroidHttpTransport aht = new AndroidHttpTransport(URL);
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
text.setText("RESULT: " + resultString);
}catch(Exception e)
{
e.printStackTrace();
}

}


I really need a big help here.

Thanks everyone.
[url="http://mydailyservings.wordpress.com"]Joemarie Amparo[/url]
joemarieamparo
Freshman
Freshman
 
Posts: 9
Joined: Thu Jan 20, 2011 6:35 am
Location: Cebu, Philippines

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 11 guests