利用AXIS2返回JSON
来源:互联网 发布:js encode 编辑:程序博客网 时间:2024/06/06 05:27
部署AXIS2查看上一篇文章。
在已经有AXIS2的基础之上操作
1、下载DynamicResponseHandler(wso2dynamic-response-1.5.mar)模块,复制到webservice项目中的WEB-INF/modules中,将wso2dynamic-response-1.5.mar加到modules.list文件中。
2、下载Jettison 1.2和jettison-1.2-patched.jar,放入WEB-INF/lib中的模块,删除jettison-1.0-RC2.jar。
3、找到tomcat\webapps\axis2\WEB-INF\conf\axis2.xml文件,添加xml
<module ref="DynamicResponseHandler"/>
4、在axis2.xml中添加JSON消息格式,找到标签,在这个标签里添加如下代码段:
<messageFormatter contentType="application/json" class="org.apache.axis2.json.JSONMessageFormatter"/> <messageFormatter contentType="application/json/badgerfish" class="org.apache.axis2.json.JSONBadgerfishMessageFormatter"/>5、在axis2.xml中添加消息编译,找到标签,添加如下代码:
<messageBuilder contentType="application/json" class="org.apache.axis2.json.JSONOMBuilder"/> <messageBuilder contentType="application/json/badgerfish" class="org.apache.axis2.json.JSONBadgerfishOMBuilder"/>
执行完以上步骤后,打开Tomcat服务器,在浏览器中输入测试url: http://localhost:8080/axis2/services/Version/getVersion?response=application/json
将返回json格式的数据。根据自己的要求调整返回的数据格式,模式是xml
0 0
- 利用AXIS2返回JSON
- java Axis2 返回json格式
- axis2系列之返回json数据
- 利用struts2返回json对象
- Spring MVC 利用 @ResponseBody 注解返回JSON
- java web利用 ajax 返回 json
- JAVA WEB中利用@responsebody返回json
- spring MVC利用注解直接返回Json
- Axis2通过JSON交互
- axis2利用spring发布
- 利用axis2调用webservice
- 利用HttpWebRequest请求url路径返回json结果对象
- 利用ashx操作OleDb数据库返回json数据
- springMVC利用FastJson接口返回json数据相关配置
- java 获取后台返回json 并js循环利用
- Springmvc 4.x利用@ResponseBody返回Json数据
- Springmvc 4.x利用@ResponseBody返回Json数据
- Springmvc 4.x利用@ResponseBody返回Json数据
- mysq对数据的l查询,增加,修改和删除sql语句
- freecodecamp advance algorithm scripting
- 简单的爬取新浪新闻标题与链接
- python和lua的socket实例
- android 瀑布流布局 + 自由拖拽
- 利用AXIS2返回JSON
- 1011. A+B和C (15)
- 程序员的思考
- LeetCode 61. Rotate List
- 字符集与编码二之编号 vs 编码
- reactNative react.children.only expected to receive a single react element child.问题
- OpenGLES的简单应用绘图,以及照相机画面变色变形渲染(六)
- centos7中安装redis
- bzoj 4006: [JLOI2015]管道连接 斯坦纳树