Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Web services 为Acumatica web服务建立会话_Web Services_Erp_Acumatica - Fatal编程技术网

Web services 为Acumatica web服务建立会话

Web services 为Acumatica web服务建立会话,web-services,erp,acumatica,Web Services,Erp,Acumatica,为Acumatica web服务建立会话 我需要使用web服务建立会话,然后使用该会话执行后续操作。例如,使用先前创建的会话/令牌,使用web服务创建SOOrder和Shipping SOOrder.Screen content = new SOOrder.Screen(); content.Url = InstanceUrl + “/Soap/SO301000.asmx"; content.CookieContainer = new System.Net.CookieContainer();

为Acumatica web服务建立会话 我需要使用web服务建立会话,然后使用该会话执行后续操作。例如,使用先前创建的会话/令牌,使用web服务创建SOOrder和Shipping

SOOrder.Screen content = new SOOrder.Screen();
content.Url = InstanceUrl + “/Soap/SO301000.asmx";
content.CookieContainer = new System.Net.CookieContainer();
SOOrder.LoginResult lresult= content.Login(Username, password);
使用此方法,我已经在lresult.session中获得了一个会话

现在,我想在下面的shipmentcontent中使用此会话,而无需再次调用login

SOShipment.Screen shipmentcontent = new SOShipment.Screen();
shipmentcontent.Url = InstanceUrl + "(W(3))/Soap/SO302000.asmx";
shipmentcontent.CookieContainer = new System.Net.CookieContainer();
shipmentcontent.Login(Username, password);

通过在系统->集成->配置->Web服务下的Web服务SM.20.70.40中打包各种屏幕,您可以为所有这些屏幕创建一个端点。在应用程序中使用此服务端点,只登录一次,然后呼叫所有这些屏幕


thnx

如果我正确理解您,您希望在Acumatia中的不同操作之间保持登录连接。为了实现这一点,我采用了以下方法:

创建图形:

公共类导入器:PXGraph { }

        public Screen Screen
        {
            get
            {
                var context = new Screen
                {
                    CookieContainer = new CookieContainer(),
                    AllowAutoRedirect = true,
                    EnableDecompression = true,
                    Timeout = 1000000
                };
                var nextIndex = HttpContext.Current.Request.Url.ToString().IndexOf("/", 7,        StringComparison.Ordinal) + 1;
                var urlStart = HttpContext.Current.Request.Url.ToString().IndexOf("/", nextIndex + 1, StringComparison.Ordinal);
                context.Url = HttpContext.Current.Request.Url.ToString().Substring(0, urlStart) + "/Soap/IMPORTET.asmx";

                return context;
            }
        }
内部图形创建了以下代码:

公共字符串GetHostUrl { var nextIndex=HttpContext.Current.Request.Url.ToString.IndexOf/,7,StringComparison.Ordinal+1; var urlStart=HttpContext.Current.Request.Url.ToString.IndexOf/,nextIndex+1,StringComparison.Ordinal; var url=HttpContext.Current.Request.url.ToString.Substring0,urlStart; 返回url; }

        public Screen Screen
        {
            get
            {
                var context = new Screen
                {
                    CookieContainer = new CookieContainer(),
                    AllowAutoRedirect = true,
                    EnableDecompression = true,
                    Timeout = 1000000
                };
                var nextIndex = HttpContext.Current.Request.Url.ToString().IndexOf("/", 7,        StringComparison.Ordinal) + 1;
                var urlStart = HttpContext.Current.Request.Url.ToString().IndexOf("/", nextIndex + 1, StringComparison.Ordinal);
                context.Url = HttpContext.Current.Request.Url.ToString().Substring(0, urlStart) + "/Soap/IMPORTET.asmx";

                return context;
            }
        }
然后在不同屏幕之间共享屏幕的上下文

例如:

var scr = Screen;
var userName = PXAccess.GetUserName();
var password = GetUserPassword();
var context = Screen;
var lgRes = context.Login(userName, password);
但我在不同会话之间保留了用户密码