相关疑难解决方法(0)

使用WSDL(SOAP)将PayPal集成到C#/ .NET解决方案中

环境:Visual Studio 2010 Professional .NET Framework 4 C#

使用以下WSDL添加了服务引用:https://www.paypalobjects.com/wsdl/PayPalSvc.wsdl

问题1:当像这样编译时,从Reference.cs文件中获取一堆错误.看起来像名称空间错误 它提到它在我的项目的命名空间中找不到服务引用命名空间.因此,我进入了Reference.cs文件,无论我得到这个错误,我在方法名称之前删除了项目的命名空间,现在它编译.

最后访问所有类.使用所需属性创建并填充DoDirectPaymentReqCustomSecurityHeader对象.创建了一个PayPalAPIAAInterfaceClient类的实例,该类包含DoDirectPayment方法,该方法接收 CustomSecurityHeader和DoDirectPaymentReq类型的参数.看起来像这样:

using (var client = new **PayPalAPIAAInterfaceClient**())
{
   var credentials = new CustomSecurityHeaderType
   {
      Credentials = new UserIdPasswordType
      {
         Username = "xxxxxxxx@xxxxxx.com",
         Password = "xxxxxxx",
         Signature = "jksadfuhasfweakjhasf"
      }
   };

   _doDirectPaymentResponseType = client.DoDirectPayment(ref credentials, _doDirectPaymentReq);
}
Run Code Online (Sandbox Code Playgroud)

问题2:在为包含上述代码的方法编写TestMethod之后,我得到如下错误:

System.InvalidOperationException: Could not find default endpoint element that references contract 'Paypal.PayPalAPIAAInterface' in the ServiceModel client configuration section. This might …
Run Code Online (Sandbox Code Playgroud)

c# soap wsdl paypal

6
推荐指数
1
解决办法
7015
查看次数

标签 统计

c# ×1

paypal ×1

soap ×1

wsdl ×1