Showing posts with label Ksoap. Show all posts
Showing posts with label Ksoap. Show all posts

KSoap in Blackberry

in blackberry, you can use ksoap api to connect .net web service. :)


public boolean LoginProcess(String userStr, String passStr) {
        boolean status = false;
        // new Thread(new Runnable() {
        // public void run() {
        String serviceUrl = getHTTPAdd();
        String serviceNamespace = "http://tempuri.org/";
        String soapAction = "http://tempuri.org/SecureLogin";
        SoapObject  rpc = new SoapObject(serviceNamespace, "SecureLogin");
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

        envelope.bodyOut  = rpc;
        envelope.dotNet  = true;
        envelope.encodingStyle = SoapSerializationEnvelope.XSD;
        rpc.addProperty("customerid", userStr);
        rpc.addProperty("password", passStr);
        String payHelpString = ";interface=wifi";
        HttpTransport ht = new HttpTransport(serviceUrl + payHelpString);
        ht.debug = true;
        String result;
        try {
            ht.call(soapAction, envelope);
            result = (envelope.getResponse()).toString();
            resultOfWebCall = result;
            userParseData = toStringStr(parseSXml(result));
            checkVal = parseSXml(result)[1];
            userStrVal = parseSXml(result)[2]; // :)
            userStrAccVall = userStr;
            System.out.println("|||||||||||| |||||||||||| checkVal: " + checkVal);
            if (checkVal.compareTo("OK") == 0) {
                status = true;
            }
        } catch (Exception ex) {
            result = ex.toString();
            System.out.println(">>> inline error: "+result);
        }
        return status;
    }