2011-02-10 68 views
0

我想通过PayPal使用SOAP接口开始自适应付款。 当添加服务引用https://svcs.sandbox.paypal.com/AdaptivePayments?WSDL以下警告由Visual Studio所示:在C#中使用Paypal自适应付款开始SOAP

自定义工具警告:无法导入WSDL:结合 详细信息:WSDL绑定命名AdaptivePaymentsSOAP11Binding是无效的,因为斗不过操作CancelPreapproval被发现在相应的portType定义中。 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异常:

找不到引用合同“PaypalSandboxApi.AdaptivePaymentsPortType”在ServiceModel客户端的默认终结点元素配置部分。这可能是因为没有找到适用于您的应用程序的配置文件,或者因为在客户端元素中找不到匹配此合同的端点元素。

我错过了什么吗?

我应该使用缺少的AdaptivePaymentsSOAP11Binding而不是AdaptivePaymentsPortTypeClient

回答

1

它看起来像导入此WSDL不会生成servicemodel配置。我kludged一个这样在一起(和更新相关的类名来匹配你的,所以你可以复制/粘贴):

<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> 

+0

谢谢。从那以后,我切换到简单的XML并解决了这个问题。 – UrK 2011-06-29 08:08:24

相关问题