本文整理汇总了Java中org.ksoap2.SoapEnvelope类的典型用法代码示例。如果您正苦于以下问题:Java SoapEnvelope类的具体用法?Java SoapEnvelope怎么用?Java SoapEnvelope使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SoapEnvelope类属于org.ksoap2包,在下文中一共展示了SoapEnvelope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWSResponse
import org.ksoap2.SoapEnvelope; //导入依赖的package包/类
Komunikat getWSResponse(String code, String soapAction, String methodName, String outerBox)
throws HttpResponseException, IOException, XmlPullParserException{
//create envelope
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.implicitTypes=false;
addSecurityHeader(envelope);
addMappings(envelope, outerBox);
envelope.setOutputSoapObject(createRequestParameter(code, methodName));
//WS call
HttpTransportSE transport = new HttpTransportSE(URL);
transport.debug = true;
// try{
transport.call(soapAction, envelope);
// }catch(Exception e){
// e.printStackTrace();
// }
WSResponse response = (WSResponse) envelope.bodyIn;
return response.getKomunikat();
}
示例2: Banner
import org.ksoap2.SoapEnvelope; //导入依赖的package包/类
public static String Banner(String webMethName) {
String resTxt = null;
// Create request
SoapObject request = new SoapObject(NAMESPACE, webMethName);
// Create envelope
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
// Set output SOAP object
envelope.setOutputSoapObject(request);
// Create HTTP call object
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
// Invole web service
androidHttpTransport.call(SOAP_ACTION + webMethName, envelope);
// Get the response
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
// Assign it to fahren static variable
resTxt = response.toString();
} catch (Exception e) {
e.printStackTrace();
resTxt = "Error occured";
}
return resTxt;
}
示例3: checkUsernames
import org.ksoap2.SoapEnvelope; //导入依赖的package包/类
private void checkUsernames() throws TechnicalException {
final List<Account> accounts = Account.fromString(prefs.accounts().get());
final List<Account> checkedAccounts = new LinkedList<Account>();
for (Account account : accounts) {
if (!StringUtils.isEmpty(account.getCheckedUsername())) {
checkedAccounts.add(account);
continue;
}
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("borrowerNumber", account.getUsername());
parameters.put("pin", account.getPassword());
SoapObject checkBorrowerResult = doRequest(USER_NAMESPACE, "CheckBorrower", USER_URL, parameters, SoapEnvelope.VER12);
String checkedUsername = soapHelper.getCheckedUsername(checkBorrowerResult);
if (!StringUtils.isEmpty(checkedUsername)) {
checkedAccounts.add(new Account(account.getUsername(), checkedUsername, account.getPassword(), account.getAppearance()));
} else {
throw new LoginFailedException(account.getUsername());
}
}
prefs.accounts().put(Account.toString(checkedAccounts));
}
示例4: doCall
import org.ksoap2.SoapEnvelope; //导入依赖的package包/类
/**
* Do call.
*
* @param url the url
* @param nameSpace the name space
* @param methodName the method name
* @param params the params
* @param listener the listener
*/
public void doCall(String url,String nameSpace,String methodName,AbSoapParams params, AbSoapListener listener) {
String result = null;
try {
SoapObject request = new SoapObject(nameSpace, methodName);
// 传递参数
List<BasicNameValuePair> paramsList = params.getParamsList();
for (NameValuePair nameValuePair : paramsList) {
request.addProperty(nameValuePair.getName(), nameValuePair.getValue());
}
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.bodyOut = request;
envelope.dotNet = mDotNet;
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransportSE = new HttpTransportSE(url,mTimeout);
httpTransportSE.debug = true;
AbLogUtil.d(AbSoapClient.class, "--call--");
httpTransportSE.call(nameSpace+methodName, envelope);
SoapObject bodyIn = (SoapObject) envelope.bodyIn;
result = bodyIn.toString();
if (result != null) {
listener.sendSuccessMessage(AbHttpStatus.SUCCESS_CODE, result);
}
} catch (Exception e) {
e.printStackTrace();
listener.sendFailureMessage(AbHttpStatus.UNTREATED_CODE, AbAppConfig.UNTREATED_EXCEPTION, new AbAppException(AbAppConfig.UNTREATED_EXCEPTION));
}
}
示例5: createEnvelope
import org.ksoap2.SoapEnvelope; //导入依赖的package包/类
private Envelope createEnvelope(SoapObject so, Element body) {
Envelope envelope = new Envelope(
SoapEnvelope.VER11, body);
envelope.dotNet = false;
envelope.implicitTypes = true;
envelope.setAddAdornments(false);
envelope.setOutputSoapObject(so);
return envelope;
}
示例6: getProvinceList
import org.ksoap2.SoapEnvelope; //导入依赖的package包/类
public static List<String> getProvinceList() {
// ���õķ���
final String methodName = "getRegionProvince";
FutureTask<List<String>> task = new FutureTask<List<String>>(
new Callable<List<String>>() {
@Override
public List<String> call() throws Exception {
// ����HttpTransportSE�������
final HttpTransportSE ht = new HttpTransportSE(SERVICE_URL);
ht.debug = true;
// ʹ��SOAP1.1Э�鴴��Envelop����
final SoapSerializationEnvelope envelope =
new SoapSerializationEnvelope(SoapEnvelope.VER11);
// ʵ����SoapObject����
SoapObject soapObject = new SoapObject(SERVICE_NS, methodName);
envelope.bodyOut = soapObject;
// ������.Net�ṩ��Web Service���ֽϺõļ�����
envelope.dotNet = true;
// ����Web Service
ht.call(SERVICE_NS + methodName, envelope);
if (envelope.getResponse() != null) {
// ��ȡ��������Ӧ���ص�SOAP��Ϣ
SoapObject result = (SoapObject) envelope.bodyIn;
SoapObject detail = (SoapObject) result.getProperty(
methodName + "Result");
// ������������Ӧ��SOAP��Ϣ��
return parseProvinceOrCity(detail);
}
return null;
}
});
new Thread(task).start();
try {
return task.get();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
示例7: getWeatherByCity
import org.ksoap2.SoapEnvelope; //导入依赖的package包/类
public static SoapObject getWeatherByCity(String cityName) {
final String methodName = "getWeather";
final HttpTransportSE ht = new HttpTransportSE(SERVICE_URL);
ht.debug = true;
final SoapSerializationEnvelope envelope =
new SoapSerializationEnvelope(SoapEnvelope.VER11);
SoapObject soapObject = new SoapObject(SERVICE_NS, methodName);
soapObject.addProperty("theCityCode", cityName);
envelope.bodyOut = soapObject;
// ������.Net�ṩ��Web Service���ֽϺõļ�����
envelope.dotNet = true;
FutureTask<SoapObject> task = new FutureTask<SoapObject>(
new Callable<SoapObject>() {
@Override
public SoapObject call() throws Exception {
ht.call(SERVICE_NS + methodName, envelope);
SoapObject result = (SoapObject) envelope.bodyIn;
SoapObject detail = (SoapObject) result.getProperty(
methodName + "Result");
return detail;
}
});
new Thread(task).start();
try {
return task.get();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
示例8: say
import org.ksoap2.SoapEnvelope; //导入依赖的package包/类
public java.lang.String say(java.lang.String input) throws Exception {
SoapObject _client = new SoapObject("", "say");
_client.addProperty("input", input);
SoapSerializationEnvelope _envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
_envelope.bodyOut = _client;
HttpTransport _ht = new HttpTransport(Configuration.getWsUrl());
_ht.call("", _envelope);
return (java.lang.String) _envelope.getResponse();
}
示例9: getYear
import org.ksoap2.SoapEnvelope; //导入依赖的package包/类
public int getYear() throws Exception {
SoapObject _client = new SoapObject("", "getYear");
SoapSerializationEnvelope _envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
_envelope.bodyOut = _client;
HttpTransport _ht = new HttpTransport(Configuration.getWsUrl());
_ht.call("", _envelope);
return Integer.parseInt(_envelope.getResponse().toString());
}
示例10: say
import org.ksoap2.SoapEnvelope; //导入依赖的package包/类
public java.lang.String say(java.lang.String input) throws Exception {
SoapObject _client = new SoapObject("", "say");
_client.addProperty("input", input);
SoapSerializationEnvelope _envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
_envelope.bodyOut = _client;
AndroidHttpTransport _ht = new AndroidHttpTransport(Configuration.getWsUrl());
_ht.call("", _envelope);
return (java.lang.String) _envelope.getResponse();
}
示例11: getYear
import org.ksoap2.SoapEnvelope; //导入依赖的package包/类
public int getYear() throws Exception {
SoapObject _client = new SoapObject("", "getYear");
SoapSerializationEnvelope _envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
_envelope.bodyOut = _client;
AndroidHttpTransport _ht = new AndroidHttpTransport(Configuration.getWsUrl());
_ht.call("", _envelope);
return Integer.parseInt(_envelope.getResponse().toString());
}
示例12: say
import org.ksoap2.SoapEnvelope; //导入依赖的package包/类
public void say(java.lang.String input) throws Exception {
SoapObject _client = new SoapObject("", "say");
_client.addProperty("input", input);
SoapSerializationEnvelope _envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
_envelope.bodyOut = _client;
HttpTransport _ht = new HttpTransport(Configuration.getWsUrl());
_ht.call("", _envelope);
}
示例13: say1
import org.ksoap2.SoapEnvelope; //导入依赖的package包/类
public void say1(ksoap2.generator.complexe.Composite composite) throws Exception {
SoapObject _client = new SoapObject("", "say1");
_client.addProperty("composite", composite);
SoapSerializationEnvelope _envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
_envelope.bodyOut = _client;
HttpTransport _ht = new HttpTransport(Configuration.getWsUrl());
_ht.call("", _envelope);
}
示例14: say2
import org.ksoap2.SoapEnvelope; //导入依赖的package包/类
public ksoap2.generator.complexe.Composite say2(ksoap2.generator.complexe.Composite com) throws Exception {
SoapObject _client = new SoapObject("", "say2");
_client.addProperty("com", com);
SoapSerializationEnvelope _envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
_envelope.bodyOut = _client;
HttpTransport _ht = new HttpTransport(Configuration.getWsUrl());
_ht.call("", _envelope);
SoapObject _ret = (SoapObject) _envelope.getResponse();
int _len = _ret.getPropertyCount();
ksoap2.generator.complexe.Composite _returned = new ksoap2.generator.complexe.Composite();
for (int _i = 0; _i < _len; _i++) {
_returned.setProperty(_i, _ret.getProperty(_i)); }
return _returned;
}
示例15: say3
import org.ksoap2.SoapEnvelope; //导入依赖的package包/类
public void say3(ksoap2.generator.complexe.Composite com, java.lang.String st) throws Exception {
SoapObject _client = new SoapObject("", "say3");
_client.addProperty("com", com);
_client.addProperty("st", st);
SoapSerializationEnvelope _envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
_envelope.bodyOut = _client;
HttpTransport _ht = new HttpTransport(Configuration.getWsUrl());
_ht.call("", _envelope);
}