加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Webservice原理

发布时间:2020-12-16 23:01:29 所属栏目:安全 来源:网络整理
导读:1.整体结构 ? ? 2.一个Web Service客户端,顾名思义是和一个Web Service服务器进行交互。 ? 下面是一个Web Service客户端调用Web Service的基本过程。 -- 构造SOAP请求消息(将本地数据对象转换为SOAP消息) -- 发送SOAP消息到Web Service服务器的指定端口 -

1.整体结构

?


?

2.一个Web Service客户端,顾名思义是和一个Web Service服务器进行交互。

? 下面是一个Web Service客户端调用Web Service的基本过程。


--> 构造SOAP请求消息(将本地数据对象转换为SOAP消息)

--> 发送SOAP消息到Web Service服务器的指定端口

--> 接收SOAP响应消息?

--> 将SOAP响应消息转换为本地数据对象

?

3.webService与SOA的关系
? webService是SOA的一个具体实现
? SOA是思想
? 就像面向对象和J2ee的关系
??
??
4.SOAP基于HTTP的,在http协议下传输xml文件

?

5.UDDI:发现和整合服务,很少用

?

6.开发方法:只要获得wsdl方式即可

?

7.webService效率较慢
? 传输的是文本
? EJB和CORBA传输的是二进制,效率较好

?

8.拦截soap请求和响应信息

??

Java代码?

?

    JaxWsServerFactoryBean?factory?=?new?JaxWsServerFactoryBean();?? ?????????? ????????factory.setServiceClass(HelloImpl.class);?? ????????factory.setAddress("http://localhost:8080/helloword");?? ????????factory.getInInterceptors().add(new?LoggingInInterceptor());?? ????????factory.getOutInterceptors().add(new?LoggingOutInterceptor());?? ?????????? ?????????? ????????Server?server?=?factory.create();?? ????????server.start();??
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();factory.setServiceClass(HelloImpl.class);factory.setAddress("http://localhost:8080/helloword");factory.getInInterceptors().add(new LoggingInInterceptor());factory.getOutInterceptors().add(new LoggingOutInterceptor());Server server = factory.create();server.start();

?添加拦截器

factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());

?

soap消息结构:


(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读