2015-02-06 51 views
2

我无法让Visual Studio(VS)从Netsuite示例代码或其他帖子中识别这些方法。我附上我的VS屏幕截图(http://www.rpmex.com/img/Untitled-1.jpg)。代码大部分来自Netsuite documentation的第24页。Netsuite Suitetalk服务引用在ASP.NET和Visual Studio中不起作用

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

VS正在识别一些像RecordRef这样的方法,但它不能识别对NetsuiteService或Passport的调用,因为您可以在屏幕截图中看到这些方法,因为这些术语是带下划线的。因为Netsuite服务参考有一个正在运行的命名空间,所以我假设我不需要放置“使用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 = "[email protected]"; 
     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) 
     { 

     } 
    } 
} 
+0

欢迎来到Stack Overflow!请编辑您的问题,将您的实际代码作为文本加入您的项目的服务参考资料中,以代替屏幕截图。另外,Netsuite文档的链接被打破。感谢您为未来的搜索者改进问题! – 2015-02-06 00:31:11

回答

2

听起来就像您创建了服务参考。您必须创建一个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替换您的包含,应该看起来像 ;
相关问题