我在网站上有一个 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");
}
}
}