Example SOAP Analysis for Android

Does anyone have a good example of parsing SOAP on Android?

+3
source share
4 answers

Soap message analysis is not included in the Android runtime, so it is not so simple. You must use an external library. I am using ksoap2 .

If you are looking here at fooobar.com/questions/tagged / ... , you will see many examples of how to use it. For example here .

+6
source

It is also worth checking out WSClient ++ . It generates all stub objects and models and hides all parsing and bindings to objects.

, Android. , ksoap2, , , , ( , 1 )

+2

Only to complete the code above, including authentication:

httpClient.getCredentialsProvider().setCredentials(new AuthScope("serverIP", portNo), 
            new UsernamePasswordCredentials(username, password));
+2
source

try this code

      DefaultHttpClient httpClient=new DefaultHttpClient();
     String responseString = null;
     try
     {

     HttpPost httppost = new HttpPost("http://services/?wsdl");
     httppost.setHeader("SOAPAction", "urn:getSearch");
     httppost.setHeader("Content-Type", "text/xml; charset=utf-8");

     String strEnvelope = "SOAP BODY" ;

     HttpEntity entity = new StringEntity(strEnvelope);
     httppost.setEntity(entity);
     ResponseHandler<String> strResponseHandler=new BasicResponseHandler(); 
     responseString = httpClient.execute(httppost, strResponseHandler);
     Log.d("Search", responseString);

     }
     catch (Exception objException)
     {
         throw objException ;

     }
     finally
     {
         httpClient.getConnectionManager().shutdown();
     }
+1
source

All Articles