0

我在网站上有一个 wsdl 文件,我想获得一些服务。我的问题是:如何找到这些参数:

SOAP_ACTION
METHOD_NAME
NAMESPACE
URL

这是我的代码,但我有连接问题:

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");
    }
}
}
4

1 回答 1

1

使用 Soap-Ui http://www.soapui.org/ 获得问题的答案。然后相应地修改您的android代码...

于 2012-02-01T15:48:27.680 回答