Search code examples
androidweb-serviceswsdltomcat7ksoap2

webservice cannot open connection external servidor


i have a problem trying to use my own webservice that i just to upload in AWS server (is from an android terminal application that i am developing). I configured the servidor with tomcat7 and msql, the database is working and i deployed the war of my webservice in it.

when i use the webservice in my tomcat localhost work fine... but if i try to change the url from localhost to my new elastic IP from AWS it crush

i dont know why is not working... maybe some small issue that i forgot in the migration.

this is the trace problem

06-06 22:06:02.350: W/System.err(9623): SoapFault - faultcode: 'soapenv:Server' faultstring: 'Cannot open connection' faultactor: 'null' detail: org.kxml2.kdom.Node@40572d80
06-06 22:06:02.360: W/System.err(9623):     at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:136) 
06-06 22:06:02.360: W/System.err(9623):     at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:137)
06-06 22:06:02.360: W/System.err(9623):     at org.ksoap2.transport.Transport.parseResponse(Transport.java:96)
06-06 22:06:02.360: W/System.err(9623):     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:189)
06-06 22:06:02.360: W/System.err(9623):     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95)
06-06 22:06:02.360: W/System.err(9623):     at es.proyecto.gestorincidencias.util.Conexiones.comprobar_usuario(Conexiones.java:55)
06-06 22:06:02.360: W/System.err(9623):     at es.proyecto.gestorincidencias.MainActivity$1.run(MainActivity.java:51)

this is my webservice wsdl url

http://50.16.208.44:8080/Service_Incidencia/services/Ejemplo?wsdl

and this is my code

public class Conexiones {
private static final String NAMESPACE = "http://ws.apache.org/axis2";
private static String URL="http://50.16.208.44:8080/Service_Incidencia/services/Ejemplo?wsdl";  
private static final String METHOD_NAME3 = "comprobar_usuario";
private static final String SOAP_ACTION3 = "http://ws.apache.org/axis2/comprobar_usuario";

public static String comprobar_usuario(String email, String password) {
    String result = null;

    try {
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME3); 
        request.addPropertyIfValue("email", email);
        request.addPropertyIfValue("password", password);

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.setOutputSoapObject(request);

        HttpTransportSE ht = new HttpTransportSE(URL);
        ht.call(SOAP_ACTION3, envelope);
        final  SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
        result = response.toString();
    } catch (Exception e) {
        e.printStackTrace();
    }

    return result;
}
}

maybe is important to know that i compiled the war in java 1.6 to deploy in the servidor and in my own localhost the war is compiled in java 1.7, hope this isnt the problem.

thanks for your time and i hope someone have a solution


Solution

  • I don't know if this helps, but by looking at your stack trace and the source code for ksoap2-android 2.5.8 the exception is being thrown by the following code:

    public void parseBody(XmlPullParser parser) throws IOException, XmlPullParserException
    {
        bodyIn = null;
        parser.nextTag();
        if (parser.getEventType() == XmlPullParser.START_TAG && parser.getNamespace().equals(env)
                && parser.getName().equals("Fault"))
        {
            SoapFault fault;
            if (this.version < SoapEnvelope.VER12) {
                fault = new SoapFault(this.version);
    

    To me this appears that your web service on AWS is returning a Fault response saying that it Cannot open connection. Are you able to test your web service on AWS directly?

    Does your web service have to open a connection to some other service?