`
沙舟狼客
  • 浏览: 157842 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

grails框架中webService插件的使用(axis2,cxf)

阅读更多

一、cxf插件的使用:

1、运行命令:

grails install-plugin cxf

2、 正确安装后在idea中可以看到如下图:



3、编写一个WebService的方法;新建一个Service类跟普通的没区别,建好后在服务类中加入:



 4、在浏览器访问http://localhost:8080/项目名/services/服务类名(符合grails服务类的写法)?wsdl,如:

http://localhost:8080/shopping/services/shop?wsdl

 5、如果正确的话会在浏览器中生成一个xml文件,比如我的:

<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name="ShopService" targetNamespace="http://shopping/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://shopping/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <wsdl:message name="add">
    <wsdl:part element="tns:add" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="login">
    <wsdl:part element="tns:login" name="parameters">
    </wsdl:part>
  </wsdl:message>

  <wsdl:message name="loginResponse">
    <wsdl:part element="tns:loginResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="addResponse">
    <wsdl:part element="tns:addResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="ShopServicePortType">

    <wsdl:operation name="add">
      <wsdl:input message="tns:add" name="add">
    </wsdl:input>
      <wsdl:output message="tns:addResponse" name="addResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="login">
      <wsdl:input message="tns:login" name="login">
    </wsdl:input>

      <wsdl:output message="tns:loginResponse" name="loginResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="ShopServiceSoapBinding" type="tns:ShopServicePortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="add">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="add">

        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="addResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="login">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="login">

        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="loginResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="ShopService">
    <wsdl:port binding="tns:ShopServiceSoapBinding" name="ShopServicePort">

      <soap:address location="http://localhost:8080/shopping/services/shop"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

 6、用eclipse生成客户端:

(1)新建WebServiceClient



 (2)输入地址,与浏览器的一致:



(3)生成客户端即可访问;

 

二、axis2插件的使用

1、axis2与cxf不同有两点:

(1)安装:

grails install-plugin axis2

(2)服务类使用:

 static

 expose=['axis2']
  • 大小: 11.4 KB
  • 大小: 19.1 KB
  • 大小: 9.7 KB
  • 大小: 57.3 KB
2
1
分享到:
评论

相关推荐

    grails+Xfire webservice

    grails+Xfire webservice

    grails框架

    实际上,一个grails插件和一个grails应用基本是完全一样的,同样可以使用grails run-app命令来运行。区别仅在于一个插件的根目录下需要提供一个fooplugin.groovy文件,提供插件的一些描述信息。

    Grails-开源框架---使用指南(中文)

    Grails是一套用于快速Web应用开发的开源框架,它基于Groovy编程语言,并构建于Spring、Hibernate等开源框架之上,是一个高生产力一站式框架。 Grails这个独特的框架被视为是提升工程师生产效率的动态工具,因为其...

    grails框架心得

    用grails开发过程中,项目优化配置,系统间调用等的总结。

    学习grails框架时候自己写的例子

    学习Grails框架时候自己写的例子,自己分页,修改sql查询,带数据库,入门极好的例子。

    使用GORM构建Spring Boot应用程序 Grails指南_ Grails框架.pdf

    使用GORM构建Spring Boot应用程序 Grails指南_ Grails框架.pdf

    grails-开源框架使用指南

    Grails是一个full-stack框架,它借助于核心技术与相关的插件(plug-in)来解决Web开发中方方面面的问题,其中包括: 易于使用的基于Hibernate的对象-关系映射(ORM)层 称为Groovy Server Pages (GSP)的表现层技术 ...

    Grails-MyBatis:用于 Grails 框架的 MyBatis 插件

    用于 Grails 框架的 MyBatis 插件 基于原始 Grails-iBatis 插件:Brian Sanders ( ) Grails 插件主页: : 修改: 命名约定的一些变化 添加了对多个数据源的完全支持 Grails 2.0 插件重构 最小 Grails 依赖项 ...

    grails 开发框架-4

    grails1.0开发框架4 类似于ruby on rails的框架。

    Grails安装SVN客户端插件指导手册

    在help菜单选择Install New Software…

    Grails开源框架 - 使用指南

    Grails开源框架 - 使用指南,版本1.0,中文文档。 Grails开源框架 - 使用指南 作者: Graeme Rocher, Marc Palmer 版本: 1.0 Copies of this document may be made for your own use and for distribution to ...

    Grails1.1中文文档

    Grails是个一栈式开发框架,它尝试通过核心技术和插件技术来解决许多Web开发难题。Grails包含了如下内容: 由 Hibernate 构成的易于使用的 Object Relational Mapping (ORM)层 称为 Groovy Server Pages (GSP) 的...

    grails 开发框架-3

    grails1.0开发框架3 类似于ruby on rails的框架。

    java中的Grails开源框架 - 使用指南(chm)

    Grails是一个full-stack框架,它借助于核心技术与相关的插件(plug-in)来解决Web开发中方方面面的问题,其中包括: 易于使用的基于Hibernate的对象-关系映射(ORM)层 称为Groovy Server Pages (GSP)的表现层技术 ...

    grails-pjax:Grails Pjax插件云可帮助您在Grails中使用pjax

    Grails Pjax插件Pjax在Grails中。 Pjax类似于(turbolinks)[ ,在'A'标签,按钮和表单上工作。 参见_pjaxHeader grails templtate文件中的演示代码。 ## Pjax是什么? Pjax是一个jQuery插件,它使用ajax和pushState...

    eclipse开发grails插件

    eclipse插件、用来开发grails(路漫漫其修远兮、吾将上下而求索)

    grails框架数据查询

    NULL 博文链接:https://niuniufei.iteye.com/blog/2292361

Global site tag (gtag.js) - Google Analytics