问题描述
我如何消耗这个SOAP的Web服务?如何添加请求头?
How do I consume this SOAP web service? how do I add the request header?
<一个href=\"https://www.eway.com.au/gateway/ManagedPaymentService/test/managedCreditCardPayment.asmx?op=CreateCustomer\">https://www.eway.com.au/gateway/ManagedPaymentService/test/managedCreditCardPayment.asmx?op=CreateCustomer
REF :http://www.eway.com.au/Developer/eway-api/token-payments.aspx
推荐答案
最简单的方法是使用.NET的内置支持。
The easiest way is to use .NET's built-in support.
在Visual Studio中,右键点击你的项目引用和添加服务引用。给它的服务网址https://www.eway.com.au/gateway/ManagedPaymentService/managedCreditCardPayment.asmx它会为你生成一个代理类,将完成所有的工作。然后,您可以只例如。
In Visual Studio, right click on your project references and 'Add Service Reference'. Give it the service URL https://www.eway.com.au/gateway/ManagedPaymentService/managedCreditCardPayment.asmx and it will generate a proxy class for you that will do all the work. You can then just e.g.
var client = new eWayServiceReference.managedCreditCardPaymentSoapClient();
client.CreateCustomer(...);
另外,您可以使用从VS命令提示符代理类。
Alternatively you can generate the proxy class from a VS command prompt using svcutil.
这篇关于消费SOAP Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!