0
我需要我的服務,用戶名認證和passwor我有嘗試this但沒有得到sucess你可以幫我無法驗證服務
當我打印inlog貓我得到::
更新3: :
11-04 16:07:58.767: INFO/System.out(1531): Returned ======>>> <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Receiver</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">Server was unable to process request. ---> Data at the root level is invalid. Line 1, position 1.</soap:Text></soap:Reason><soap:Detail /></soap:Fault></soap:Body></soap:Envelope>
代碼::
DefaultHttpClient UserIDclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>();
nvps.add(new BasicNameValuePair("username","password"));
UrlEncodedFormEntity p_entity = new UrlEncodedFormEntity(nvps,HTTP.UTF_8);
httppost.setEntity(p_entity);
HttpResponse response = UserIDclient.execute(httppost);
HttpEntity resEntity = response.getEntity();
Returned = EntityUtils.toString(resEntity);
System.out.println("ans is :: "+ Returned);
System.out.println("Returned ======>>> "+Returned);
檢查更新後的代碼,運行它並只檢查你在控制檯得到的內容。 –
11-04 15:46:38.347:INFO/System.out(1381):Returned ====== >>><?xml version =「1.0」encoding =「utf-8」?> soap:Receiver 服務器無法處理請求。 --- >根級別的數據無效。第1行,第1位。 soap:Reason> soap:Envelope> –
@ Dr.nik我相信你不知道如何進行web服務調用?你同樣面臨着問題。 –