Calling sharepoint custom webservices from android using Ksoap2

I'm trying to build an android app to access SharePoint online using the webservices

String SOAP_ACTION = "http://tempuri.org/GetAvailableLeaves";
         String OPERATION_NAME = "GetAvailableLeaves";

         String WSDL_TARGET_NAMESPACE = "http://tempuri.org/";
         String SOAP_ADDRESS="http://sp:8002/_layouts/sharepointwebservice/sharepointtestservice.asmx";
         request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);
         
         envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.implicitTypes=true;
     
        envelope.setOutputSoapObject(request);
     
        httpTransport = new HttpTransportSE(SOAP_ADDRESS);
        
        String authentication = android.util.Base64.encodeToString("username:#password".getBytes(), android.util.Base64.NO_WRAP);
        List<HeaderProperty> headerList = new ArrayList<HeaderProperty>();
        headerList.add(new HeaderProperty("Authorization", "Basic " + authentication));
       
                
        
        PropertyInfo user = new PropertyInfo();
        user.type = PropertyInfo.STRING_CLASS;
        user.setName("empid");
        user.setValue(empid.toString());
        request.addProperty(user);
        
       
        
       
        
         Object response;
         try{
             
            // httpTransport.call(SOAP_ACTION, envelope);
             httpTransport.call(SOAP_ACTION, envelope, headerList);
             String requestDumpString = httpTransport.requestDump;
             System.out.println(requestDumpString);
              response = envelope.getResponse();
           
              return response.toString();
        
             }
        
             catch (Exception exception)
        
              {
        
             
                 return "2";
              }
             

The following error occured When the HTTPTransportSE is called:  

org.xmlpull.v1.XmlPullParserException: unexpected type ( null@1:0 in java.io.InputStreamReader)

Please advise how to solve this, and if there is a good documentation that descrips the connection between sharepoint online and Mobile Platforms (Android, iOS) that would be appreciated.

December 23rd, 2013 2:52am

Hi,

According to your post, my understanding is that you want to access SharePoint Online web services in Android app.

Here is a blog for your reference:
Connecting to SharePoint 2013 online (365) APIs in Android
http://asheshany.wordpress.com/2013/07/18/connecting-to-sharepoint-2013-online-365-apis-in-android/

If the blog above does not meet your requirement, the following way for your reference:
We can create a .net web service and use Client Object Model to access SharePoint Online web service to get the data.Then we can use Ksoap2 to access the .net web service.
http://blogs.msdn.com/b/chjain/archive/2013/11/29/sharepoint-online-pass-credentials-to-web-service-passively.aspx
http://codeoncloud.blogspot.in/2013/06/android-java-soap-web-service-access.html

Best R

Free Windows Admin Tool Kit Click here and download it now
December 24th, 2013 6:37am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics