文档详情

07 webservice-cxf用户认证平台搭建.pdf

发布:2025-05-12约4.22千字共19页下载文档
文本预览下载声明

过程调用协议

•RPC(RemoteProcedureCallProtocol)

•RPC采用客户机/服务器模式。请求程序就

是一个客户机,而服务提供程序就是一个

服务器。

webservice

•Webservice是rpc技术的一种实现,了解

该技术主要包含以下两种概念:

•1rpc

•2wsdl

•3soap

Jdk原生webservice

•LoginServiceInfservice=newLoginServiceImp();

•Endpoint.publish(,service);

Jdk原生webservice

InfServiceservice=newInfService();

LoginServiceInfloginInf=service.getInfPort();

Userlogin=loginInf.login(王,);

System.out.println(end...);

Jdk原生webservice

•在的文件夹中,有一个

客户端,这个工具依据文件生

成相应的类文件

•可以像调用本地的类一样调用

类文件提供的方

命令•

•命令参数说明:

•-s:生成客户端执行类的源文件的存放

•-p:定义生成类的包名

dependency

groupIdorg.apache.cxf/groupId

artifactIdcxf-rt-frontend-jaxws/artifactId

version3.0.5/version

/dependency

dependency

groupIdorg.apache.cxf/groupId

artifactIdcxf-rt-ws-security/artifactId

version3.0.5/version

/dependency

其他依赖

•1spring

•2springweb

•3mybatis

•4apache常用辅助

•5servlet-api

•6其他,如wss4j

配置web.xml

web-app

context-param

param-namecontextConfigLocation/param-name

param-valueclasspath:applicationContext.xml/param-value

/context-param

listener

listener-classorg.springframework.web.context.ContextLoaderListener/listener-class

/listener

servlet

servlet-namecxfservlet/servlet-name

servlet-classorg.apache.cxf.transport.servlet.CXFServlet/servlet-class

/servlet

servlet-mapping

servlet-namecxfservlet/servlet-name

url-pattern/*/url-pattern

/servlet-mapping

/web-app

接口代码注意

•1写webservice代码时,要用接口+实现的

方式

•2发布的时候发布的是接口

•3将接口和接口demo程序交付给客户端调

用者

Spring容器发布ws接口

客户端接口调用demo

publicstaticTTgetService(ClassTt,Stringurl){

JaxWsFactoryBeanjaxWsFactoryBean=new

显示全部
相似文档