How to save KSOP2 response to xml in android SD card?

可紊 提交于 2019-12-13 04:25:26

问题


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);
} (...)

回答1:


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



来源:https://stackoverflow.com/questions/13913001/how-to-save-ksop2-response-to-xml-in-android-sd-card

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!