c# - Netsuite Suitetalk 服务引用在 ASP.NET 和 Visual Studio 中不起作用

标签 c# asp.net visual-studio-2013 netsuite

我无法让 Visual Studio (VS) 识别 Netsuite 示例代码或此处其他帖子中的方法。我附上了 VS 屏幕的屏幕截图 ( http://www.rpmex.com/img/Untitled-1.jpg )。代码主要来自Netsuite documentation的第24页。 .

我已将 WSDL 作为服务引用导入到 VS 中。这是错误的吗?我看到一篇文章 ( What is the difference between NetSuitePortType and NetSuiteService? ) 说服务引用和 Web 引用之间存在区别。 Netsuite 文档确实提到要导入 Web 引用,但 VS 似乎没有任何与该术语相关的内容。

VS 正在识别一些方法,例如 RecordRef,但它无法识别对 NetsuiteService 或 Passport 的调用,正如您在屏幕截图中看到的那样,因为这些术语带有下划线。因为 Netsuite 服务引用有一个功能命名空间,所以我认为我不需要添加“using netsuiteServiceReference.com.netsuite.webservices;”行,但我这样做了,因为文档是这么说的。

我的理解是 VS 应该识别任何有效的函数调用。我哪里出错了?

在下面的代码中,我将 VS 下划线视为语法错误的内容加粗(将其括在 ** 中)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using **netsuiteServiceReference.com**.netsuite.webservices;


namespace WebApplication5
{
    namespace netsuiteServiceReference
    {
        **NetSuiteService** service = new **NetSuiteService**();
        service.CookieContainer = new **CookieContainer**();
        //invoke the login operation
        Passport passport = new **Passport**();
        passport.account = "TSTDRV96";
        passport.email = "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="81f4f2e4f3efe0ece4c1efe4f5f2f4e8f5e4afe2eeec" rel="noreferrer noopener nofollow">[email protected]</a>";
        RecordRef record = new **RecordRef**();
        role.id = "3";
        passport.record = record;
        passport.password = "mypassword";
        Status status = service.login( passport ).status;
    }
    public partial class ThursdayTest : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

最佳答案

听起来您创建了一个服务引用。您必须创建一个 Web 引用。

  1. 在解决方案资源管理器中右键单击项目。
  2. 点击“添加”>“服务引用”。
  3. 在“服务引用”屏幕上,点击“高级”按钮。
  4. 在下一个屏幕上,点击“添加 Web 引用”框。
  5. 在下一个屏幕上,输入 NetSuite WSDL,例如https://webservices.netsuite.com/wsdl/v2014_1_0/netsuite.wsdl
  6. 加载需要一些时间。单击警告,然后添加引用。
  7. 现在替换您的包含内容,应该如下所示 使用 MySolution.com.netsuite.webservices;

关于c# - Netsuite Suitetalk 服务引用在 ASP.NET 和 Visual Studio 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28356447/

相关文章:

c++ - Visual Studio 2013 C++ 变量监视不起作用

wpf - 在单独的行上格式化 XAML 用户控件和窗口属性

C#填充多边形(三角形)

asp.net - 存储过程用户交互

c# - 如何使用 BlobClient 从 Azure 存储中删除 Blob

c# - asp.net CORE 迁移生成空

c# - ASP.NET : Possible to create a UserControl that include inside markup content?

visual-studio - 在 Visual Studio 2013 中禁用设置的云同步?

c# - 将多个文本框和标签放在同一列CSS上?

c# - 方法声明末尾的 new() 关键字