0
我有一個wsdl文件它的網站,我想獲得一些服務。 我的問題是:如何找到這些參數:Android WebServices與ksoap2
SOAP_ACTION
METHOD_NAME
NAMESPACE
URL
這裏是我的代碼,但我有問題的Connexion:
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");
}
}
}
謝謝,但我已經是soapUi,但我不知道我在哪裏尋找這些信息。你能舉個例子嗎? – 2012-02-01 15:58:43
嗯做一件事...我用了相同的技術一段時間回來..我想有一個原始(視圖)的肥皂(XML)請求和響應。經過幾次試驗,你會得到你的變量的實際值。同時嘗試在SOAP UI中集成w3schools中的示例Web服務並檢查響應和請求。 – Relsell 2012-02-01 16:18:04