編輯:關於Android編程
package com.util; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; public class AsmxUtil { private String SOAP_ACTION = ""; private String NAMESPACE = "http://tempuri.org/"; private String METHOD_NAME = ""; private String ServiceURL = ""; SoapObject request =null; public AsmxUtil(String serviceurl, String methodName) { // 建立webservice連接對象 ServiceURL = serviceurl; METHOD_NAME = methodName; SOAP_ACTION = NAMESPACE + METHOD_NAME; request = new SoapObject(NAMESPACE, METHOD_NAME); } public void AddProperty(String name, Object v) { //參數值 request.addProperty(name, v); } public String Call() throws Exception { SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); // soap協議版本必須用SoapEnvelope.VER11(Soap V1.1) envelope.bodyOut = request; envelope.dotNet=true; //對dotnet webservice協議的支持,如果dotnet的webservice //不指定rpc方式則用true否則要用false HttpTransportSE ht = new HttpTransportSE(ServiceURL); ht.debug = true; try { ht.call(SOAP_ACTION, envelope); if (envelope.getResponse() != null) { String msg = envelope.getResponse().toString(); return msg; } else { return "error"; } } catch (Exception e) { throw new Exception(e.getMessage()); } } } 調用方法: AsmxUtil au = new AsmxUtil("http://192.168.111.153/WebService2/Service1.asmx", "HelloWorld"); au.AddProperty("username","admin"); au.AddProperty("password","123"); String xst = null; try { xst = au.Call(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); //text1.setText(e.getMessage()); }
Toast.makeText(this, xst, Toast.LENGTH_LONG).show();
之前有很多朋友都問過我,在Android系統中怎樣才能實現靜默安裝呢?所謂的靜默安裝,就是不用彈出系統的安裝界面,在不影響用戶任何操作的情況下不知不覺地將程序裝好。雖說這
前言:近年來,智能電視的發展如火如荼,Googel 也在大力推進TV及穿帶設備的發展,在互聯網的風口,是豬也會飛,這句話並不是沒有道理的。傳統電視機廠商,基本都轉型致力於
相信大家已經對下拉刷新熟悉得不能再熟悉了,市面上的下拉刷新琳琅滿目,然而有很多在我看來略有缺陷,接下來我將說明一下存在的缺陷問題,然後提供一種思路來解決這一缺陷,廢話不多
狀態模式說明“狀態模式允許一個對象在其內部狀態改變的時候改變其行為。這個對象看上去就像是改變了它的類一樣。” –《JAVA與模式》管理