我有callWebservice()
方法,并且我需要一些Web服务来对其进行测试。我仍然大致了解Web服务,并且此代码来自教程。结果我得到“错误”,我不知道出什么问题了。任何可以用来测试代码的技巧或其他服务都会得到应用。
private static final String NAMESPACE = "https://api.authorize.net/soap/v1/";
private static final String METHODNAME = "AuthenticateTest";
private static final String WSDL = "https://apitest.authorize.net/soap/v1/Service.asmx?wsdl";
private static final String SOAP_ACTION = "https://api.authorize.net/soap/v1/AuthenticateTest";
private static String TAG = "soap";
public static String callWebservice() {
String res = "sample string";
SoapObject request = new SoapObject(NAMESPACE, METHODNAME);
request.addProperty("name","44vmMAYrhjf");
request.addProperty("transactionKey","9MDQ7fghjghjh53H48k7e7n");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(WSDL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
res = resultsRequestSOAP.toString();
} catch (Exception e) {
Log.d(TAG, e.getMessage());
}
return res;
}
AuthenticateTestResponse{AuthenticateTestResult=anyType{resultCode=Error; messages=anyType{MessagesTypeMessage=anyType{code=E00014; text=Merchant Authentication is required.; }; }; }; }