首页 > 其他分享 >AX2012 call Webservice directly

AX2012 call Webservice directly

时间:2023-06-16 23:46:28浏览次数:35  
标签:httpRequest byteArray set Webservice System call AX2012 null Net

Static void CallWebService(str sURL, RecId PORecId )
{
    System.Net.HttpWebRequest httpRequest = null;
    System.Net.HttpWebResponse httpResponse = null;
    System.Net.CookieCollection cookies = null;
    CLRObject clro = null;
    System.Text.Encoding utf8 = null;
    System.Net.WebHeaderCollection headers;
    System.IO.Stream stream = null;
    System.IO.StreamReader streamReader = null;
    System.Byte[] byteArray = null;
    System.IO.Stream dataStream;
    str jsonData,data;
    int num;

    ;




    new InteropPermission(InteropKind::ClrInterop).assert();

    jsonData = strFmt('{"RecId":"%1"}', PORecId);

    headers = new System.Net.WebHeaderCollection();

    clro = System.Net.WebRequest::Create(sURL);
    httpRequest = clro;
    httpRequest.set_Method('Post');
    httpRequest.set_Timeout(90000);
    httpRequest.set_Headers(headers);
    httpRequest.set_ContentType("application/json");

    utf8 = System.Text.Encoding::get_UTF8();
    byteArray = utf8.GetBytes(jsonData);
    httpRequest.set_ContentLength(byteArray.get_Length());
    stream = httpRequest.GetRequestStream();
    stream.Write(byteArray,0,byteArray.get_Length());
    stream.Close ();


    httpResponse = httpRequest.GetResponse();

 

}

标签:httpRequest,byteArray,set,Webservice,System,call,AX2012,null,Net
From: https://www.cnblogs.com/lingdanglfw/p/17486708.html

相关文章

  • WebService
    WebService发布:1,建一个公用文件夹2,右键发布,选着文件系统。3,目标位置:文件系统,选择刚刚创建的文件夹4,IIS管理器:网站右键:添加网站5,填写网站名,物理路径为公用文件夹,指定IP地址,选择端口号6,发布未能加载文件或程序集“System.Web.Extensions,Version=3.5.0.0,Culture=neutral,Public......
  • fatal: unable to access 'https://github.com/JiangYuLab/CNVcaller.git/': TCP conn
     001、gitclone报错 002、解决方法进入github官网,搜索该项目 003、上传至linux、解压[root@PC1test2]#unzipCNVcaller-master.zip ......
  • Cannot Reference “XxxClass.xxx” Before Supertype Constructor Has Been Called
    百度翻译:在调用超类型构造函数之前无法引用“XxxClass.xxx”-----我的理解:一个类的构造器方法还未执行的时候,我们无法使用类的成员属性或成员方法。 下面是此错误的示例代码publicclassMyExceptionextendsRuntimeException{privateinterrorCode=0;......
  • 使用C#的WebService实现客户端软件的更新
    由于项目原因,要实施的客户离作者太远,考虑提供软件的在线升级功能.我们如何实现呢!先讲下思路.思路:先实现WEB端的开发,主要考虑使用WEBService技术,提供远程服务的调用函数,返回一个文件的字节内容,然后写一个升级程序客户端,分发给客户使用的机器中,(可以随客户的软件一起安装).......
  • Qt报错:call to constructor of '_ConfigDaoImpl' is ambiguous
    Qt报错:calltoconstructorof'_ConfigDaoImpl'isambiguous原因configform.cpp:4:13:error:calltoconstructorof'_ConfigDaoImpl'isambiguousconfigdaoimpl.h:16:5:note:candidateconstructorconfigdaoimpl.h:17:5:note:candidateconst......
  • JS bind & apply/call
    bindletboundFunc=func.bind(context);将func的context修改为传入的参数,返回一个新的func函数callfunc.call(context,arg1,arg2,...)applyfunc.apply(context,args)call和apply之间唯一的语法区别是,call期望一个参数列表,而apply期望一个包含这些参数的......
  • 解决npm i 报错显示 code EPERM syscall rename等问题
    问题描述:npmERR!codeEPERMnpmERR!syscallrenamenpmERR!pathD:\ProgramFiles\nodejs\npm_global\node_modules\cnpm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmclinpmERR!destD:\ProgramFiles\nodejs\npm_global\node_modul......
  • ManagementEventWatcher throws ManagementException with call to Stop()
    参考网址: https://stackoverflow.com/questions/46100105/managementeventwatcher-throws-managementexception-with-call-to-stop0Ihavethefollowingpieceofcodethatalwaysthrowsanexception:Thestacktraceisasfollows:System.Management.ManagementException:......
  • webservice: Could not initialize Service NoSuchMethodException getPortClassMap()
    webservicejaxws webservice中碰到的问题:CouldnotinitializeServiceNoSuchMethodExceptiongetPortClassMap()情况如下:A应用是用jaxws编写的webservice客户端,单独运行该客户端成功。B应用是基于xfire的webservice服务,在B中调用A,结果在构造一个Service类的似乎出了上......
  • JAVA 线程池之Callable返回结果
    JAVA线程池之Callable返回结果原文:https://www.cnblogs.com/hapjin/p/7599189.html本文介绍如何向线程池提交任务,并获得任务的执行结果。然后模拟线程池中的线程在执行任务的过程中抛出异常时,该如何处理。一、执行具体任务的线程类要想获得线程的执行结果,需实现Callable接......