惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
V
Vulnerabilities – Threatpost
Google Online Security Blog
Google Online Security Blog
Hugging Face - Blog
Hugging Face - Blog
L
LINUX DO - 热门话题
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
D
Docker
C
Cyber Attacks, Cyber Crime and Cyber Security
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
T
Tenable Blog
P
Privacy International News Feed
Google DeepMind News
Google DeepMind News
小众软件
小众软件
Cisco Talos Blog
Cisco Talos Blog
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
Arctic Wolf
C
Cybersecurity and Infrastructure Security Agency CISA
C
Cisco Blogs
T
Threat Research - Cisco Blogs
NISL@THU
NISL@THU
The Hacker News
The Hacker News
Project Zero
Project Zero
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threatpost
V
Visual Studio Blog
The GitHub Blog
The GitHub Blog
The Cloudflare Blog
Last Week in AI
Last Week in AI
Jina AI
Jina AI
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
MongoDB | Blog
MongoDB | Blog
U
Unit 42
Scott Helme
Scott Helme
A
About on SuperTechFans
WordPress大学
WordPress大学
F
Fortinet All Blogs
大猫的无限游戏
大猫的无限游戏
G
GRAHAM CLULEY
Latest news
Latest news
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Schneier on Security

博客园 - 阿拉伯顶峰

网页兼容调试笔记 NSoup解析处理Html jeasyui控件事件和方法的使用方法 JavaScriptSerializer 序列号datatime时少了8小时 正则表达式一 jeasyui-datagrid使用笔记 javascript笔记 excel拼接函数 2014年最简单、快捷的美股Scottrade开户攻略 将ppt转换成PDF chrome开发配置(四)生成项目及配置库引用 chrome开发配置(三)安装开发工具 chrome开发配置(二)获取源代码 chrome开发配置(一)安装配置工具 ie6 js报错unterminated string constant 关于请求添加HttpRequestHeader SqlServer数据库正在还原的解决办法 dwz ie10一直提示数据加载中 Windows Server 2008下IIS 7配置ASP+ACCESS环境
wso2 data services返回json数据方法
阿拉伯顶峰 · 2013-10-19 · via 博客园 - 阿拉伯顶峰

一、首先要修改下配置文件。

修改\repository\conf\axis2目录下axis2.xml与axis2_client.xml配置文件。

增加<parameter name="httpContentNegotiation">true</parameter>配置

axis2.xml代码段如下:

    <!-- ================================================= -->
    <!-- Parameters -->
    <!-- ================================================= -->
    <parameter name="hotdeployment">true</parameter>
    <parameter name="hotupdate">true</parameter>
    <parameter name="enableMTOM" locked="false">optional</parameter>
    <parameter name="cacheAttachments">true</parameter>
    <parameter name="attachmentDIR">work/mtom</parameter>
    <parameter name="sizeThreshold">4000</parameter>
    <parameter name="httpContentNegotiation">true</parameter>
    <parameter name="EnableChildFirstClassLoading">${childfirstCL}</parameter>

axis2_client.xml代码段如下:

    <!--If turned on with use the Accept header of the request to determine the contentType of the
    response-->
    <parameter name="httpContentNegotiation">true</parameter>


二、访问服务

            WebClient w = new WebClient();
            w.Headers.Add(HttpRequestHeader.Accept, "application/json");           
            using (StreamReader sr = new StreamReader(w.OpenRead("http://192.168.1.123:9763/services/ccjy.HTTPEndpoint/getrestnews?num=4")))
            {                
                string a =sr.ReadToEnd();                
            }