views:

667

answers:

1

i am using ksoap/ksoap2 api for calling a php webservice from j2me.

For ksoap:

SoapObject client = new SoapObject(NAMESPACE, "ns2221:save_record");
        client.addProperty("cc", "1234560789");

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        XmlWriter xw = new XmlWriter(new OutputStreamWriter(bos));

        SoapEnvelope envelope = new SoapEnvelope(new ClassMap(Soap.VER11));
        envelope.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/");
        envelope.setBody(client);
        envelope.write(xw);
        xw.flush();
        bos.write('\r');
        bos.write('\n');

        byte[] requestData = bos.toByteArray();
        String requestSOAPmesg = new String(requestData);
        System.out.println("request Soap Message: " + requestSOAPmesg);

        HttpTransport ht = new HttpTransport();
        ht.setUrl(url);
        ht.setSoapAction(NAMESPACE);
        SoapObject o = (SoapObject) ht.call(client);

have used..

and in ksoap2

SoapObject client = new SoapObject("http://192.168.0.205:82/imageuploader/save_record.php#save_record", "ns8862:save_record");
        client.addProperty("cc", "1234560789");

        //Create Envelope for
        Object so=soapMsg;
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet=false;
        envelope.bodyOut=client;
        System.out.println("Before Envelope");


        HttpTransport ht = new HttpTransport(url);
        ht.call("http://192.168.0.205:82/imageuploader/save_record.php#save_record", envelope);
        SoapObject o=(SoapObject) envelope.getResponse();

have used..

it returns me

fault String:

faultstring: 'Operation 'ns8862:save_record' is not defined in the WSDL for this service' faultactor: '' detail: org.kxml2.kdom.Node@ea0ef881

in the web service the first tag ns8862:save_record changes every time a request is passed for the 4 numbers.

Any Solution?

A: 

Check the web service for capital letters. The error states that "save_record" is undefined. Maybe it's "Save_Record", or "saveRecord". Make sure you are adhering to the template.

DAquilina