Dear Experts,
I have built my android app based on ksoap2 2.5.2 jar with HTTP connection with server. The scenario is that I call web service from my android app [web service client] to j2ee server [web service provider] and get the response back.
Now, I want to make my web service connection secure - TLS. I want to encrypt the web service content using server's public key before sending it out to the server and get the response back.
I understand I should use ksoap2 3.4.0 to implement the above functionality. Please can you provide me a sample code snippet ? I have shared my current code snippet i use in my application below.
Thanks a lot for your help!!!
My current code that uses HTTP is:
String SOAP_ACTION = ":8080/soapaction/";
String WSDL_TARGET_NAMESPACE = ":8080/wsdltargetnamespace";
String SOAP_ADDRESS = ":8080/soapaddress";
OPERATION_NAME = "operationName";
SoapObject request = new SoapObject("http://" + loginServerIP + WSDL_TARGET_NAMESPACE, OPERATION_NAME);
request.addProperty("param1", "value1");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE("http://" + loginServerIP + SOAP_ADDRESS);
try
{
httpTransport.call("http://" + loginServerIP + SOAP_ACTION + OPERATION_NAME, envelope);
SoapObject responseObject = (SoapObject) envelope.bodyIn;
int count = responseObject.getPropertyCount();
count = 3; // The web service returns a string array with three values
String retStr[] = new String[count];
for(int i=0; i < count; i++)
{
retStr[i] = "" + responseObject.getProperty((i));
}
return (retStr);
}
catch (Exception exception)
{
String retStr[] = {"Failed - " + exception.toString(), " "};
return (retStr);
}
- Saravanan