Milos Cuculovic
Milos Cuculovic

Reputation: 20223

Android WebServices with ksoap2

i have a wsdl file it the website and i would like to get some services. My question is: how to find those parameters:

SOAP_ACTION
METHOD_NAME
NAMESPACE
URL

Here is my code but I have the connexion problem:

public class TestBookSoapActivity extends Activity {

private static final String SOAP_ACTION = "http://api.mdpi.com/ws/GetVersionInfo";
private static final String METHOD_NAME = "GetVersionInfo";
private static final String NAMESPACE = "http://api.mdpi.com/ws/";
private static final String URL = "http://api.mdpi.com/ws/mdpi.wsdl";


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    executeAppelSOAP();

}
private void executeAppelSOAP() {
    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    request.addProperty("arg0", "10");


    SoapSerializationEnvelope enveloppe = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    enveloppe.setOutputSoapObject(request);
    AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport (URL);             
    try {
        androidHttpTransport.call(SOAP_ACTION, enveloppe);
        Object resultat = enveloppe.getResponse();
        System.out.println("Version = " + resultat.toString());
    } catch(Exception e) {
        e.printStackTrace();
        System.out.println("Problem");
    }
}
}

Upvotes: 0

Views: 441

Answers (1)

Relsell
Relsell

Reputation: 771

Use Soap-Ui http://www.soapui.org/ to get answers to your problem. Then modify your android code accordingly...

Upvotes: 1

Related Questions