ksoap with https gives HTTPstatus: 404

1.3k Views Asked by At

I have a .net web service. I can access it with Android ksoap2 library using http without a problem. When using https, I get Http status: 404. I get my code generated using www.wsdl2code.com I am sure that service part is correct, because I have a desktop .net client and it can connect via https. My certificate is signed, so I think it should work "out of the box". I am using ksoap 3.0.0 version.

Below is logcat:

12-06 12:30:38.733: WARN/System.err(17416): java.io.IOException: HTTP request failed, HTTP status: 404
12-06 12:30:38.743: WARN/System.err(17416): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:195)
12-06 12:30:38.743: WARN/System.err(17416): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:116)
12-06 12:30:38.743: WARN/System.err(17416): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:111)
12-06 12:30:38.743: WARN/System.err(17416): at com.Wsdl2Code.WebServices.WFService.WFService.SendAudio(WFService.java:104)
12-06 12:30:38.743: WARN/System.err(17416): at com.Wsdl2Code.WebServices.WFService.WFService.SendAudio(WFService.java:89)
12-06 12:30:38.743: WARN/System.err(17416): at webServiceCommunication.Service$2.run(WordsFinderService.java:105)
12-06 12:30:38.743: WARN/System.err(17416): at java.lang.Thread.run(Thread.java:841)

And this is a part of generated code that makes connection:

public String SendAudio(VectorByte file,List<HeaderProperty> headers){
        SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        soapEnvelope.implicitTypes = true;
        soapEnvelope.dotNet = true;
        SoapObject soapReq = new SoapObject("http://tempuri.org/","SendAudio");
        soapReq.addProperty("file",file.toString());
        soapEnvelope.setOutputSoapObject(soapReq);
        HttpTransportSE httpTransport = new HttpTransportSE(url,timeOut);
        try{
            if (headers!=null){
                httpTransport.call("http://tempuri.org/IWFService/SendAudio", soapEnvelope,headers);
            }else{
                httpTransport.call("http://tempuri.org/IWFService/SendAudio", soapEnvelope);
            }
            Object retObj = soapEnvelope.bodyIn;
            if (retObj instanceof SoapFault){
                SoapFault fault = (SoapFault)retObj;
                Exception ex = new Exception(fault.faultstring);
                if (eventHandler != null)
                    eventHandler.Wsdl2CodeFinishedWithException(ex);
            }else{
                SoapObject result=(SoapObject)retObj;
                if (result.getPropertyCount() > 0){
                    Object obj = result.getProperty(0);
                    if (obj != null && obj.getClass().equals(SoapPrimitive.class)){
                        SoapPrimitive j =(SoapPrimitive) obj;
                        String resultVariable = j.toString();
                        return resultVariable;
                    }else if (obj!= null && obj instanceof String){
                        String resultVariable = (String) obj;
                        return resultVariable;
                    }
                }
            }
        }catch (Exception e) {
            if (eventHandler != null)
                eventHandler.Wsdl2CodeFinishedWithException(e);
            e.printStackTrace();
        }
        return "";
    }

I tried replacing HttpTransportSE with HttpsTransportSE, but nothing changes:

HttpsTransportSE httpTransport = new HttpsTransportSE("example.com",443, "/test/WFService.svc",timeOut);
0

There are 0 best solutions below