如何保存在android的SD卡KSOP2响应XML? [英] How to save KSOP2 response to xml in android SD card?
问题描述
在我的项目,我呼吁从SQL服务器,但是作为SOAP信封的默认大小给予回应追溯到几千条记录的Web服务是64KB,我在我的日志猫只获得第15条和内存不足
例外...
请告诉我如何写在XML文件中这种反应在SD卡。
私有静态字符串SOAP_ACTION1 =http://tempuri.org/DownloadAllMasterDataRelatedToFarmer;
私人静态字符串NAMESPACE =http://tempuri.org/;
私人静态字符串METHOD_NAME1 =DownloadAllMasterDataRelatedToFarmer;
私有静态字符串URL =HTTP://someIP/Tracebaledemo/fieldbook/webservice1.asmxwsdl(......)SoapObject要求=新SoapObject空间(namespace,METHOD_NAME1);
request.addProperty(prefixText,txtFar.getText()的toString());
request.addProperty(计数,txtCount.getText()的toString());
SoapSerializationEnvelope信封=新SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(请求);
envelope.dotNet = TRUE;尝试{
HttpTransportSE androidHttpTransport =新HttpTransportSE(URL);
Log.d(TAG,输入尝试并调用WebService的); //这是一个将调用WebService的实际部件
androidHttpTransport.call(SOAP_ACTION1,信封); //从信封身体SOA的presult。
Log.d(TAG,撷取结果); SoapObject结果=(SoapObject)envelope.bodyIn;
Log.d(TAG,+结果,从WebService的,如果前挡=结果);
}(......)
您保存您的XML只是为了获取你的记录
如果没有必要你可以做
你为什么不定义一个限制你的活动
30假定每记录命中
或者您也可以优化您的互联网服务和您可以使用页脚
显示加载更多
通过这种方式你可以看到你的记录
DrawBack-它需要时间来获取您的记录就像你说的u有10000条记录
解决方案 - 您可以优化您的Web服务通过使用搜索事件的第一个字母
我希望你得到什么我想说
如果没有,请让我知道
In my project I am calling a web-service which giving response back as thousands of records from SQL server but as default size of SOAP ENVELOPE is 64KB I am getting only first 15 records in my log-cat and OutOfMemory
exception...
Please tell me how to write this response in xml file in SD card.
private static String SOAP_ACTION1 ="http://tempuri.org/DownloadAllMasterDataRelatedToFarmer";
private static String NAMESPACE = "http://tempuri.org/";
private static String METHOD_NAME1 = "DownloadAllMasterDataRelatedToFarmer";
private static String URL = "http://someIP/Tracebaledemo/fieldbook/webservice1.asmxwsdl";
(...)
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1);
request.addProperty("prefixText",txtFar.getText().toString());
request.addProperty("count",txtCount.getText().toString());
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.dotNet = true;
try {
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
Log.d(TAG, "Entering Try and calling WebService");
//this is the actual part that will call the webservice
androidHttpTransport.call(SOAP_ACTION1, envelope);
// Get the SoapResult from the envelope body.
Log.d(TAG, "Fetching Results");
SoapObject result = (SoapObject)envelope.bodyIn;
Log.d(TAG, "Result from WebService before if block= "+result);
} (...)
You Saving Your xml just to fetch your records
if it is not necessary You can do
Why Dont you define a limit to your Activity
Suppose 30 records per hit
or You can also refine your webService And You can use a Footer
showing Loading more
in this Way you can see your records
DrawBack- It Will take time to fetch your records as you said u have 10,000 records
Solution- You can refine your webservice By Using 1st Letter of your Search Event I hope u Getting what i am trying to say If no, Please let me know
这篇关于如何保存在android的SD卡KSOP2响应XML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!