本文整理汇总了Java中org.ksoap2.serialization.SoapObject类的典型用法代码示例。如果您正苦于以下问题:Java SoapObject类的具体用法?Java SoapObject怎么用?Java SoapObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SoapObject类属于org.ksoap2.serialization包,在下文中一共展示了SoapObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Banner
import org.ksoap2.serialization.SoapObject; //导入依赖的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;
}
示例2: TotalsForUser
import org.ksoap2.serialization.SoapObject; //导入依赖的package包/类
public Totals[] TotalsForUser(String szAuthToken, FlightQuery fq, Context c) {
SoapObject Request = setMethod("TotalsForUserWithQuery");
Request.addProperty("szAuthToken", szAuthToken);
Request.addProperty("fq", fq == null ? new FlightQuery() : fq);
Totals[] rgt = new Totals[0];
SoapObject result = (SoapObject) Invoke(c);
if (result == null)
setLastError("Error retrieving totals - " + getLastError());
else {
try {
rgt = new Totals[result.getPropertyCount()];
for (int i = 0; i < rgt.length; i++) {
rgt[i] = new Totals((SoapObject) result.getProperty(i));
}
} catch (Exception e) {
setLastError(getLastError() + e.getMessage());
}
}
return rgt;
}
示例3: ReadResults
import org.ksoap2.serialization.SoapObject; //导入依赖的package包/类
private CustomPropertyType[] ReadResults(SoapObject result) {
CustomPropertyType[] rgcptCached = getCachedPropertyTypes();
CustomPropertyType[] rgcpt;
try {
rgcpt = new CustomPropertyType[result.getPropertyCount()];
for (int i = 0; i < rgcpt.length; i++)
rgcpt[i] = new CustomPropertyType(
(SoapObject) result.getProperty(i));
// if we made it here, we have successfully retrieved new values.
// ONLY NOW should we update the cache AND only if we got at least as many
// as we had originally. (Could be the same # but favorites could have changed)
if (rgcpt.length >= rgcptCached.length)
updateCache(rgcpt);
} catch (Exception e) {
setLastError(getLastError() + e.getMessage());
rgcpt = rgcptCached;
}
return rgcpt;
}
示例4: PropertiesForFlight
import org.ksoap2.serialization.SoapObject; //导入依赖的package包/类
public FlightProperty[] PropertiesForFlight(String szAuthToken, int idFlight, Context c) {
SoapObject Request = setMethod("PropertiesForFlight");
Request.addProperty("szAuthUserToken", szAuthToken);
Request.addProperty("idFlight", idFlight);
FlightProperty[] rgfp = new FlightProperty[0];
SoapObject result = (SoapObject) Invoke(c);
if (result == null)
setLastError("Error getting properties for flight - " + getLastError());
else {
try {
rgfp = new FlightProperty[result.getPropertyCount()];
for (int i = 0; i < rgfp.length; i++)
rgfp[i] = new FlightProperty((SoapObject) result.getProperty(i));
} catch (Exception e) {
setLastError(getLastError() + e.getMessage());
}
}
return rgfp;
}
示例5: CurrencyForUser
import org.ksoap2.serialization.SoapObject; //导入依赖的package包/类
public CurrencyStatusItem[] CurrencyForUser(String szAuthToken, Context c) {
SoapObject Request = setMethod("GetCurrencyForUser");
Request.addProperty("szAuthToken", szAuthToken);
CurrencyStatusItem[] rgCsi = new CurrencyStatusItem[0];
SoapObject result = (SoapObject) Invoke(c);
if (result == null)
setLastError("Error retrieving currency - " + getLastError());
else {
try {
rgCsi = new CurrencyStatusItem[result.getPropertyCount()];
for (int i = 0; i < rgCsi.length; i++) {
rgCsi[i] = new CurrencyStatusItem((SoapObject) result.getProperty(i));
}
} catch (Exception e) {
setLastError(getLastError() + e.getMessage());
}
}
return rgCsi;
}
示例6: ReadResults
import org.ksoap2.serialization.SoapObject; //导入依赖的package包/类
private Aircraft[] ReadResults(SoapObject result, Boolean fFallbackToCache) {
Aircraft[] rgAc = new Aircraft[0];
try {
rgAc = new Aircraft[result.getPropertyCount()];
for (int i = 0; i < rgAc.length; i++)
rgAc[i] = new Aircraft((SoapObject) result.getProperty(i));
// if we made it here, we have successfully retrieved new values.
// ONLY NOW should we update the cache
updateCache(rgAc);
} catch (Exception e) {
setLastError(getLastError() + e.getMessage());
if (fFallbackToCache)
rgAc = getCachedAircraft();
}
return rgAc;
}
示例7: AircraftForUser
import org.ksoap2.serialization.SoapObject; //导入依赖的package包/类
public Aircraft[] AircraftForUser(String szAuthToken, Context c) {
DBCache dbc = new DBCache();
Aircraft[] rgAc;
DBCache.DBCacheStatus dbcs = dbc.Status(TABLENAME);
if (dbcs == DBCache.DBCacheStatus.VALID) // return cached aircraft
{
rgAc = getCachedAircraft();
} else // refresh the cache
{
SoapObject Request = setMethod("AircraftForUser");
Request.addProperty("szAuthUserToken", szAuthToken);
SoapObject result = (SoapObject) Invoke(c);
if (result == null) {
setLastError(getLastError());
// just return the potentially invalid cached aircraft; it's better than nothing.
rgAc = getCachedAircraft();
} else {
rgAc = ReadResults(result, (dbcs == DBCache.DBCacheStatus.VALID_BUT_RETRY));
}
}
return rgAc;
}
示例8: GetMakesAndModels
import org.ksoap2.serialization.SoapObject; //导入依赖的package包/类
public MakesandModels[] GetMakesAndModels(Context c) {
setMethod("MakesAndModels"); // no need to save the request, since nothing goes out
MakesandModels[] rgMM = new MakesandModels[0];
SoapObject result = (SoapObject) Invoke(c);
if (result == null)
setLastError("Error retrieving makes and models - " + getLastError());
else {
try {
rgMM = new MakesandModels[result.getPropertyCount()];
for (int i = 0; i < rgMM.length; i++) {
rgMM[i] = new MakesandModels((SoapObject) result.getProperty(i));
}
} catch (Exception e) {
setLastError(getLastError() + e.getMessage());
}
}
return rgMM;
}
示例9: FlightPathForFlight
import org.ksoap2.serialization.SoapObject; //导入依赖的package包/类
public LatLong[] FlightPathForFlight(String szAuthToken, int idFlight, Context c) {
LatLong[] rgll = new LatLong[0];
SoapObject Request = setMethod("FlightPathForFlight");
Request.addProperty("szAuthUserToken", szAuthToken);
Request.addProperty("idFlight", idFlight);
SoapObject result = (SoapObject) Invoke(c);
if (result == null)
setLastError("Failed to get path for flight - " + getLastError());
else {
try {
rgll = new LatLong[result.getPropertyCount()];
for (int i = 0; i < rgll.length; i++)
rgll[i] = new LatLong((SoapObject) result.getProperty(i));
} catch (Exception e) {
rgll = new LatLong[0];
setLastError(getLastError() + e.getMessage());
}
}
return rgll;
}
示例10: FromProperties
import org.ksoap2.serialization.SoapObject; //导入依赖的package包/类
@Override
public void FromProperties(SoapObject so) {
Comment = ReadNullableString(so, "Comment");
VirtualPath = ReadNullableString(so, "VirtualPath");
URLFullImage = ReadNullableString(so, "URLFullImage");
ThumbnailFile = ReadNullableString(so, "ThumbnailFile");
Width = Integer.parseInt(so.getProperty("Width").toString());
Height = Integer.parseInt(so.getProperty("Height").toString());
WidthThumbnail = Integer.parseInt(so.getProperty("WidthThumbnail").toString());
HeightThumbnail = Integer.parseInt(so.getProperty("HeightThumbnail").toString());
if (so.hasProperty("Location")) {
SoapObject location = (SoapObject) so.getProperty("Location");
Location = new LatLong();
Location.FromProperties(location);
}
if (so.hasProperty("ImageType"))
ImageType = ImageFileType.valueOf(so.getProperty("ImageType").toString());
}
示例11: FromProperties
import org.ksoap2.serialization.SoapObject; //导入依赖的package包/类
@Override
public void FromProperties(SoapObject so) {
idPropType = Integer.parseInt(so.getProperty("PropTypeID").toString());
szTitle = so.getProperty("Title").toString();
szSortKey = so.getPropertySafelyAsString("SortKey");
szFormatString = so.getProperty("FormatString").toString();
szDescription = ReadNullableString(so, "Description");
cptType = CFPPropertyType.valueOf(so.getProperty("Type").toString());
cptFlag = Integer.parseInt(so.getProperty("Flags").toString());
IsFavorite = Boolean.parseBoolean(so.getProperty("IsFavorite").toString());
SoapObject PrevVals = (SoapObject) so.getProperty("PreviousValues");
int cVals = PrevVals.getPropertyCount();
PreviousValues = new String[cVals];
for (int i = 0; i < cVals; i++)
PreviousValues[i] = PrevVals.getPropertyAsString(i);
}
示例12: FromProperties
import org.ksoap2.serialization.SoapObject; //导入依赖的package包/类
public void FromProperties(SoapObject so) {
Description = so.getProperty("Description").toString();
Value = Double.parseDouble(so.getProperty("Value").toString());
// Optional strings come through as "anyType" if they're not actually present, so check for that.
Object o = so.getProperty("SubDescription");
if (o != null && !o.toString().contains("anyType"))
SubDescription = o.toString();
NumericType = NumType.valueOf(so.getProperty("NumericType").toString());
if (so.hasProperty("Query")) {
SoapObject q = (SoapObject) so.getProperty("Query");
Query = new FlightQuery();
Query.FromProperties(q);
}
}
示例13: ToProperties
import org.ksoap2.serialization.SoapObject; //导入依赖的package包/类
public void ToProperties(SoapObject so) {
so.addProperty("Tailnumber", TailNumber);
so.addProperty("AircraftID", AircraftID);
so.addProperty("ModelID", ModelID);
so.addProperty("InstanceTypeID", InstanceTypeID);
so.addProperty("ModelCommonName", ModelCommonName);
so.addProperty("ModelDescription", ModelDescription);
so.addProperty("LastVOR", LastVOR);
so.addProperty("LastAltimeter", LastAltimeter);
so.addProperty("LastTransponder", LastTransponder);
so.addProperty("LastELT", LastELT);
so.addProperty("LastStatic", LastStatic);
so.addProperty("LastAnnual", LastAnnual);
so.addProperty("RegistrationDue", RegistrationDue);
so.addProperty("Last100", Last100);
so.addProperty("LastOilChange", LastOil);
so.addProperty("LastNewEngine", LastEngine);
so.addProperty("RoleForPilot", RoleForPilot);
so.addProperty("HideFromSelection", HideFromSelection);
so.addProperty("PublicNotes", PublicNotes);
so.addProperty("PrivateNotes", PrivateNotes);
}
示例14: init
import org.ksoap2.serialization.SoapObject; //导入依赖的package包/类
private void init() {
final TextView mTextWeather = (TextView) findViewById(R.id.weather);
ProgressDialogUtils.showProgressDialog(this, "���ݼ�����...");
HashMap<String, String> properties = new HashMap<String, String>();
properties.put("theCityName", getIntent().getStringExtra("city"));
WebServiceUtils.callWebService(WebServiceUtils.WEB_SERVER_URL, "getWeatherbyCityName", properties, new WebServiceCallBack() {
@Override
public void callBack(SoapObject result) {
ProgressDialogUtils.dismissProgressDialog();
if(result != null){
SoapObject detail = (SoapObject) result.getProperty("getWeatherbyCityNameResult");
StringBuilder sb = new StringBuilder();
for(int i=0; i<detail.getPropertyCount(); i++){
sb.append(detail.getProperty(i)).append("\r\n");
}
mTextWeather.setText(sb.toString());
}else{
Toast.makeText(WeatherActivity.this, "��ȡWebService���ݴ���", Toast.LENGTH_SHORT).show();
}
}
});
}
示例15: getAccessLevels
import org.ksoap2.serialization.SoapObject; //导入依赖的package包/类
private Map<Integer, String> getAccessLevels() {
Map<Integer, String> accessLevelMap = new LinkedHashMap<>();
try {
SoapObject soapObject = this.executeQueryAndGetSoapObject("mc_enum_access_levels", null);
if(soapObject!=null) {
Vector access = (Vector) soapObject.getProperty("return");
for(Object obj : access) {
SoapObject level = ((SoapObject)obj);
accessLevelMap.put(Integer.parseInt(level.getProperty("id").toString()), level.getProperty("name").toString());
}
}
} catch (Exception ex) {
Helper.printException(ex);
}
return accessLevelMap;
}