Home Android KSOAP2 error to get value
Reply: 0

Android KSOAP2 error to get value

user1896
1#
user1896 Published in June 20, 2018, 10:58 pm

I have error to get value from web service. I try alltime but not success. I did webservice using with WCF, Entity framework. this server Works good. But I want to connect and get value from Android phone.

My Android code :

private final String NAMESPACE="http://tempuri.org/";
private final String SOAPACTION="http://tempuri.org/IService/GetValues";
private final String METHODNAME="GetTreatmentValues";

private final String URL="http://localhost:49674/Service.svc";

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setContentView(R.layout.menu); button1.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {

          SoapObject request = new SoapObject(NAMESPACE,METHODNAME);
          request.addProperty("value",1);

          SoapSerializationEnvelope sp = new SoapSerializationEnvelope(SoapEnvelope.VER11);
          sp.dotNet=true;
          sp.setOutputSoapObject(request);

          HttpTransportSE aht = new HttpTransportSE(URL);
          aht.debug = true;
          text2.setText(aht.toString());
          //AndroidHttpTransport aht = new AndroidHttpTransport(URL);
          try {
              aht.call(SOAPACTION,sp);  //I have ERROR! no work.
              //SoapPrimitive resultstring = (SoapPrimitive)sp.getResponse();
              text1.setText("test");
              //text2.setText(resultstring.toString());
          } catch (Exception e) {
              // TODO: handle exception
              text2.setText("hata!");
          }           
                  }       
             });

I get error aht.call(SOAPACTION,sp); text1 never sets "test" What should I do. I don't know what I miss. thanks. (using Ksoap2.4)

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.307937 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO