calling magento web service from android client using kSoap2

假如想象 提交于 2019-12-06 09:00:40

This is how i got the login to work. the trick is not to put the ?wsdl on the url

public boolean login()  
    {
        try
        {
            SoapObject request = new SoapObject("http://schemas.xmlsoap.org/wsdl/","login");
            request.addProperty("username",apiuid.getText().toString());
            request.addProperty("apiKey",apipwd.getText().toString());
            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
            envelope.dotNet=false;
            envelope.setOutputSoapObject(request); 
            HttpTransportSE androidHttpTransport = new HttpTransportSE(apiurl.getText().toString());
            androidHttpTransport.call("http://schemas.xmlsoap.org/wsdl/login", envelope);
            String result =(String)envelope.getResponse();
            String URL = new String();
            URL=apiurl.getText().toString();
            Editor e = userDetails.edit();
                e.putString("url", URL);
                e.putString("uid", apiuid.getText().toString());
                e.putString("pwd", apipwd.getText().toString());
                e.putString("lastsession", result);
                e.commit();
               return true;
        } catch(IOException e)
             {alertbox("IO error",e.getMessage());return false;}
          catch(XmlPullParserException e)
             {alertbox("xml error",e.getMessage());return false;}
          catch(Exception e)
             {alertbox("error",e.getMessage());return false;}     
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!