简体   繁体   English

Ksoap库的SOAP信封

[英]SOAP envelope for ksoap lib

I write android client for sharepoint and use ksoap2-android-assembly-2.5.8 lib. 我为sharepoint编写了android客户端,并使用kso​​ap2-android-assembly-2.5.8 lib。 I've next code: 我有下一个代码:

 public class AndroidWSDLKActivity extends Activity {
    private static final String NAMESPACE = "http://schemas.microsoft.com/sharepoint/soap/";
    private static final String URL = "http://192.168.0.193:30004/SPMobApp/_vti_bin/lists.asmx";
    private static final String SOAP_ACTION = "http://schemas.microsoft.com/sharepoint/soap/GetList";
    private static final String METHOD_NAME = "GetList";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        TextView lblResult = (TextView) findViewById(R.id.result);

        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

                  // Set all input params   

        request.addProperty("listName", "Tasks");   

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                 // Enable the below property if consuming .Net service
        envelope.dotNet = true;
        envelope.setOutputSoapObject(request);

             HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

             try 
             {
                 List<HeaderProperty> headerList = new ArrayList<HeaderProperty>();
                 String authentication = android.util.Base64.encodeToString("LOGIN:PASS".getBytes(), android.util.Base64.NO_WRAP);

                 headerList.add(new HeaderProperty("Authorization", "Basic " + authentication));

                 androidHttpTransport.call(SOAP_ACTION, envelope);


                 SoapObject response = (SoapObject)envelope.getResponse();


                 lblResult.setText(response.getProperty(0).toString());
             }
             catch(Exception e)
             {
                 lblResult.setText(e.getStackTrace().toString());
             }

In this step 在这一步

SoapObject response = (SoapObject)envelope.getResponse(); SoapObject response =(SoapObject)envelope.getResponse();

in debug mode I have 2 errors 在调试模式下,我有2个错误

Syntax error, insert "AssignmentOperator Expression" to complete Assignment 语法错误,插入“ AssignmentOperator表达式”以完成分配

Syntax error, insert ";" 语法错误,插入“;” to complete BlockStatements 完成BlockStatement

Whats wrong? 怎么了? Help me, plz 救救我,PLZ

public class AndroidWSDLKActivity extends Activity 
{
    private static final String NAMESPACE = "http://schemas.microsoft.com/sharepoint/soap/";
    private static final String URL = "http://192.168.0.193:30004/SPMobApp/_vti_bin/lists.asmx";
    private static final String SOAP_ACTION = "http://schemas.microsoft.com/sharepoint/soap/GetList";
    private static final String METHOD_NAME = "GetList";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        TextView lblResult = (TextView) findViewById(R.id.result);

        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

                  // Set all input params   

        request.addProperty("listName", "Tasks");   

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                 // Enable the below property if consuming .Net service
        envelope.dotNet = true;
        envelope.setOutputSoapObject(request);

             HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

             try 
             {
                 List<HeaderProperty> headerList = new ArrayList<HeaderProperty>();
                 String authentication = android.util.Base64.encodeToString("LOGIN:PASS".getBytes(), android.util.Base64.NO_WRAP);

                 headerList.add(new HeaderProperty("Authorization", "Basic " + authentication));

                 androidHttpTransport.call(SOAP_ACTION, envelope);


                 SoapObject response = (SoapObject)envelope.getResponse();


                 lblResult.setText(response.getProperty(0).toString());
             }
             catch(Exception e)
             {
                 lblResult.setText(e.getStackTrace().toString());
             }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM