[英]Getting started with Paypal Adaptive Payments in C# SOAP
我正在嘗試從使用SOAP接口的Paypal自適應支付開始。 將服務引用添加到https://svcs.sandbox.paypal.com/AdaptivePayments?WSDL時 ,Visual Studio將顯示以下警告:
定制工具警告:無法導入wsdl:binding詳細信息:名為AdaptivePaymentsSOAP11Binding的WSDL綁定無效,因為在相應的portType定義中找不到與操作CancelPreapproval相匹配的內容。 錯誤的XPath來源://wsdl:definitions[@targetNamespace='http://svcs.paypal.com/services']/wsdl:binding[@name='AdaptivePaymentsSOAP11Binding'] C:\\ cproj \\ daemon \\ Service References \\ PaypalSandboxApi \\ Reference.svcmap 1 1守護程序
丟棄此消息,引用已成功添加。 為了執行交易,我嘗試創建客戶端:
var client = new PaypalSandboxApi.AdaptivePaymentsPortTypeClient()
這將引發InvalidOperationException:
在ServiceModel客戶端配置部分中找不到引用合同'PaypalSandboxApi.AdaptivePaymentsPortType'的默認終結點元素。 這可能是因為找不到您的應用程序的配置文件,或者是因為在客戶端元素中找不到與該協定匹配的端點元素。
我想念什么嗎?
我應該使用缺少的AdaptivePaymentsSOAP11Binding
而不是AdaptivePaymentsPortTypeClient
嗎?
看起來,導入此WSDL不會生成servicemodel配置。 我像這樣一起拼寫一個(並更新了相關的類名以匹配您的類名,因此您可以復制/粘貼):
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="PaypalAdaptivePayBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="1048576" maxBufferPoolSize="1048576" maxReceivedMessageSize="1048576" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="65536" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://svcs.sandbox.paypal.com/AdaptivePayments"
binding="basicHttpBinding" bindingConfiguration="PaypalAdaptivePayBinding"
contract="PaypalSandboxApi.AdaptivePaymentsPortType"
name="PaypalAdaptivePay" />
</client>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.