新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     >>计算机科学论坛<<     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> Web服务(Web Services,WS), 语义Web服务(Semantic Web Services, SWS)讨论区: WSDL, SOAP, UDDI, DAML-S, OWL-S, SWSF, SWSL, WSMO, WSML,BPEL, BPEL4WS, WSFL, WS-*,REST, PSL, Pi-calculus(Pi演算), Petri-net,WSRF,
    [返回] 计算机科学论坛W3CHINA.ORG讨论区 - Web新技术讨论『 Web Services & Semantic Web Services 』 → [转帖]how to create RESTful services using CXF's HTTP binding 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 3766 个阅读者  浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: [转帖]how to create RESTful services using CXF's HTTP binding 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     hongjunli 帅哥哟,离线,有人找我吗?魔羯座1978-1-20
      
      
      威望:5
      头衔:为振兴论坛而努力!
      等级:研二(中了一篇WWWC Poster)(版主)
      文章:808
      积分:7964
      门派:IEEE.ORG.CN
      注册:2006/3/9

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给hongjunli发送一个短消息 把hongjunli加入好友 查看hongjunli的个人资料 搜索hongjunli在『 Web Services & Semantic Web Services 』的所有贴子 引用回复这个贴子 回复这个贴子 查看hongjunli的博客楼主
    发贴心情 [转帖]how to create RESTful services using CXF's HTTP binding

    how to create RESTful services using CXF's HTTP binding

    本文主要通过一个Demo来向我们展示了如何使用CXF的 HTTP 绑定来创建RESTful 服务

    http://www.java2s.com/Code/Java/Web-Services-SOA/ThisdemoshowshowtocreateRESTfulservicesusingCXFsHTTPbinding.htm


    This demo shows how to create RESTful services using CXF's HTTP binding.
    The server in the demo creates 3 different endpoints: a RESTful XML
    endpoint, a RESTful JSON endpoint, and a SOAP endpoint.

    [RUNNING THE DEMO]
    The demo has a class called com.acme.customer.Main which starts up various
    endpoints. To start this server run the command:

    $ ant server

    Once it is running try going to the following URLs:

    http://localhost:8080/xml/customers
    http://localhost:8080/json/customers
    http://localhost:8080/xml/customers/123
    http://localhost:8080/json/customers/123

    These will serve out XML and JSON representation of the resources.

    There is an HTML page that is served by CXF so you can try using the
    JSON service via Javascript. Just go to:

    http://localhost:8080/test.html

    Included are some example JSON and XML files so you can add or update
    customers using wget. Try the following commands and look at the results:

    wget --post-file add.json http://localhost:8080/json/customers
    wget --post-file add.xml http://localhost:8080/xml/customers
    wget --post-file update.xml http://localhost:8080/xml/customers/123

    And if you are interested in SOAP you can try the SOAP endpoint:

    http://localhost:8080/soap?wsdl

    [RUNNING THE CLIENT]
    The demo also includes a Client class which accesses data using
    HTTP. To run this demo, do:

    $ ant client

    这个Demo的源代码请大家下载附件(XFire-CXF-restful_http_binding.zip):


       收藏   分享  
    顶(0)
      





    关闭广告显示
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/10/31 12:50:00
     
     GoogleAdSense魔羯座1978-1-20
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 Web Services & Semantic Web Services 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2025/7/31 0:16:47

    本主题贴数1,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    171.997ms