0

I'm use ksoap2 to connect webservice - WCF. but java has exception : "java.io.IOException: Server returned HTTP response code: 415 for URL: http:// localhost:2967/SAT_Service.svc"."

My method:

public static String SOAP_ACTION = "http://tempuri.org/SAT_IService/";
public static String NAMESPACE = "http://tempuri.org/";
public static String URL="http://localhost:2967/SAT_Service.svc";

public static String GetString(String name)
{
    String rs="";
    request=new SoapObject(NAMESPACE,name);

    SoapSerializationEnvelope envelope = 
    new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet=true;
    envelope.setOutputSoapObject(request);
    HttpTransportSE transp=null;
    transp=new HttpTransportSE(URL);
    try
    {
        transp.call(SOAP_ACTION+name, envelope);
        Object rsl=envelope.getResponse();
        rs=rsl.toString();
    }catch(Exception ex)
    {
        ex.printStackTrace();
    }
    return rs;
}

What exception mean? How Java (use ksoap2) connect and call method webservice have session in WCF ? Thks

  • Well the exception means the server returned an HTTP response code of 415. Which is the response code for unsupported media type. – TJ Thind Jul 14 '12 at 00:24

2 Answers2

0

HTTP response code: 415 for URL: http:// localhost:2967/SAT_Service.svc means:

The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method.

Shouldn't that URL be in the format of a web service URL like “http://server/Service.asmx”?

Erol
  • 6,478
  • 5
  • 41
  • 55
  • hic! I'm try http://server/Service.asmx but Error. Before It run ok. but when service add session then it error ! – user1523272 Jul 14 '12 at 05:06
  • I just wrote it as a template. You won't use it like that. The idea is to use an asmx service instead of wcf service. – Erol Jul 14 '12 at 07:21
0

I had used KSOAP 2 to consume web service while doing blackberry app development. The problem lies with WCF service. If instead of using a wcf service(.svc), if you could make old plain web service(.amsx) it would work fine. The reason is WCF is by default SOAP 1.2 and old web services (.asmx) by default uses SOAP 1.1. KSOAP is pretty old library developed to work only with SOAP 1.1

Here is the link to problem that I ran in to

Community
  • 1
  • 1
Anand
  • 14,545
  • 8
  • 32
  • 44