Search code examples
androidweb-servicesrestful-urlsaprfc

Invoking restful Soap web service in android


I am trying to invoke the SOAP Web Service in android in Restful methodology.

DefaultHttpClient client=new DefaultHttpClient();
HttpHost targetHost=new HttpHost("87.11.9.26", 8000, "http");
client.getCredentialsProvider()  
.setCredentials(new AuthScope(targetHost.getHostName(),  
                targetHost.getPort()),  
                new UsernamePasswordCredentials("abcdefg","*******"));
BasicScheme basicAuth=new BasicScheme();
BasicHttpContext localcontex=new BasicHttpContext();
localcontex.setAttribute(ClientContext.AUTH_SCHEME_PREF, basicAuth);
HttpGet request=new HttpGet("http://87.11.9.26:8000/sap/bc/srt/rfc/  
sap/zmaterials_group_list/800/zmaterials_group_list/zmaterials_group_list_bind/");

ResponseHandler<String> handler=new BasicResponseHandler();
try {
     System.out.println("**********target host is****************"+targetHost);
     System.out.println("**********request is****************"+request);
     result=client.execute(targetHost, request, handler);
     System.out.println("**************************"+result);
     // client.getConnectionManager().shutdown();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

then it gives the exception as

org.apache.http.client.HttpResponseException: SRT: Unexpected failure in SOAP  
processing occurred: ("No Web service configuration for this  
 access path: "/sap/bc/srt/rfc/sap/zmaterials_group_list/800/zmat"")

Please help me where I did wrong.Thanks in advance.


Solution

  • SOAP and REST are quite different principles. /sap/bc/srt/rfc is the prefix of the SOAP runtime for RFC, and it requires you to provide correctly formatted SOAP requesty, obeying to the WSDL / schema and so on. I may be wrong, but I doubt you'll be able to provide RESTful services using this adapter. You (or whoever wrote that function module zmaterials_group_list) will have to implement your own ICF HTTP handler if you want to go for RESTful services.

    That being said, check the service path in the configuration (SICF) and make sure that the service you're trying to call is present and enabled. Also check whether the WS runtime is configured correctly.