我想從Android應用程序到PHP Web服務發送數據,Web服務得到這樣的論點:安卓:如何發送數組作爲參數WSDL請求
Type Name Description
string sessionId Session ID
array customerData Array of customerCustomerEntityToCreate
我使用ksoap2庫,在此代碼我通過的sessionId但我不`噸知道如何設置數組作爲參數到WSDL請求
env = new SoapSerializationEnvelope(SoapEnvelope.VER11);
env.dotNet = false;
env.xsd = SoapSerializationEnvelope.XSD;
env.enc = SoapSerializationEnvelope.ENC;
SoapObject request = new SoapObject(NAMESPACE,
"createCustomer");
request.addProperty("sessionId", "1234567890");
env.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
// (new MarshalHashtable()).register(env);
androidHttpTransport.call("", env);
result = env.getResponse();
Log.d("result", result.toString());
我發現使用Web服務這個PHP例如用PHP代碼:
$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
$session = $client->login('apiUser', 'apiKey');
$result = $client->customerCustomerCreate($session, array('email' => 'customer- [email protected]', 'firstname' => 'Dough', 'lastname' => 'Deeks', 'password' => 'password', 'website_id' => 1, 'store_id' => 1, 'group_id' => 1));
var_dump ($result);
我如何用java做到這一點? 感謝
在StackOverflow中,我們習慣於添加一些解釋代碼如何工作的習慣。因此,我們互相教導,而不是解決別人的問題,而不是他們:) –
它返回此錯誤:SoapFault - faultcode:'SOAP-ENV:服務器'faultstring:'無法取消設置字符串偏移量'faultactor:'null'詳細信息:空值 – mahdi