2

我在我的 WP7 项目中使用 NetSuite 网络服务。

这是我使用的链接(较新版本): https ://webservices.na1.netsuite.com/wsdl/v2012_1_0/netsuite.wsdl

这在我的 C# 控制台应用程序中运行良好,但在 WP7 中却不行。

在 WP7 中,它成功登录,但是在添加任何内容(员工、客户、时间表……)时,我收到以下错误:

"Your connection has timed out.  Please log in again"

更新:

这是我的控制台代码:

    NetSuiteService service = new NetSuiteService();

    service.CookieContainer = new CookieContainer();

    Passport passport = new Passport();
    passport.account = "TSTDRVxxxxxx";
    passport.email = "hamzeh.soboh@para-solutions.com";

    RecordRef role = new RecordRef();
    role.internalId = "3";
    passport.role = role;

    passport.password = "passxxxx";
    Status status = service.login(passport).status;

以下是我的 WP7 代码:

    NetSuitePortTypeClient service = new NetSuitePortTypeClient();

    // service.CookieContainer = new CookieContainer();

    Passport passport = new Passport();
    passport.account = "TSTDRVxxxxxx";
    passport.email = "hamzeh.soboh@para-solutions.com";

    RecordRef role = new RecordRef();
    role.internalId = "3";
    passport.role = role;

    passport.password = "passxxxx";
    service.loginAsync(passport);

取消注释第二条语句会导致运行时错误。

4

1 回答 1

0

尝试不使用 cookie,如下所示:

        // Instantiate the NetSuite web services
        netSuiteService = new DataCenterAwareNetSuiteService(*yourAccountNumber*);
        netSuiteService.Timeout = 1000 * 60 * 60;

        var appInfo = new ApplicationInfo();
        //App info from application netsuite
        appInfo.applicationId = *yourApplicationId*;

        // Prepare login credentials for request level login
        netSuiteService.passport = new Passport()
        {
            email = yourEmail*,
            password = *yourPassword*,
            account = *yourAccountNumber*
        };

        netSuiteService.applicationInfo = appInfo;

        Prefs = new Preferences();
        netSuiteService.preferences = Prefs;
        SearchPreferences = new SearchPreferences();
        netSuiteService.searchPreferences = SearchPreferences;
        Prefs.warningAsErrorSpecified = true;
        Prefs.warningAsError = false; 
        SearchPreferences.bodyFieldsOnly = false;
于 2016-12-05T01:17:28.663 回答