views:

543

answers:

0

I want to access .net web service from j2me using ksoap2 or ksoap. Bt its not working.

KSOAP:

enter code here ` SoapObject client = new SoapObject(url, "GetRouteNames"); client.addProperty("pRegistration", "15"); HttpTransport ht = new HttpTransport(); ht.setUrl(url); ht.setSoapAction("http://tempuri.org/GetRouteNames"); Object o = ht.call(client);

//I get Null here @ the call if (o != null) { System.out.println("Object: " + o); } stringBuffer.append(ht.call(client)); `

KSOAP2:

` SoapObject client = new SoapObject(url, "GetRouteNames"); client.addProperty("pRegistration", "15"); ByteArrayOutputStream bos = new ByteArrayOutputStream(); XmlWriter xw = new XmlWriter(new OutputStreamWriter(bos));

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(client);

        HttpTransport androidHttpTransport = new HttpTransport(url);

        androidHttpTransport.call("http://tempuri.org/GetRouteNames", envelope);

        Object result = (Object) envelope.getResponse();`