我使用 ksoap2 在 android 中向 webservice PHP 发送了一个请求:
String NAMESPACE="http://www.localhost:81/wsdl";
String METHOD_NAME="insertUser";
String SOAP_ACTIONS="http://www.localhost:81/wsdl#insertUser";
String URL="http://10.0.2.2:81/phpWebservice/pgsql.php";
SoapObject request=new SoapObject(NAMESPACE, METHOD_NAME);
**request.addProperty("name","地獄");**
request.addProperty("birthday", "2012/02/01");
SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
//envelope.dotNet=true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidhttpTranport=new HttpTransportSE (URL);
androidhttpTranport.call(SOAP_ACTIONS, envelope);
网页服务 php 为:
require("nusoap.php");
$server = new soap_server();
$server->register('insertUser', // method name
array('name' => 'xsd:string','birthday'=>'xsd:string'), // input parameters
array('return' => 'xsd:int'), // output parameters
$namespace, // namespace
$namespace . '#insertUser', // soapaction
'rpc', // style
'encoded', // use
'Get all user id dua vao =0' // documentation
);
function insertUser($name,$birthday)
{
value of $name=?? Why
}
来自 android 的 'name' 的值是“地狱”,但 webserver $name='??' webservice 中 $name 的值是错误的。你能帮助我吗?