栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何使用Web Service使用者配置Spring MVC 4以两种方式通过SSL发送和接收肥皂消息?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何使用Web Service使用者配置Spring MVC 4以两种方式通过SSL发送和接收肥皂消息?

这个问题很大。没有简单的解决方案

我可以提供步骤和手册指南

1)解决CXF依赖项以在您的项目中包含库

使用Maven,Ivy或下载。您需要jax-ws和相关的 http://cxf.apache.org/docs/using-cxf-with-
maven.html

2)使用wsdl2java生成Java客户端到您的wsdl

例如

wsdl2java -p com.mycompany.greeting Greeting.wsdl

http://cxf.apache.org/docs/wsdl-to-
java.html

3)以编程方式创建jax-ws

wdsl2java已为您完成了工作 http://cxf.apache.org/docs/how-do-i-develop-a-
client.html#HowdoIdevelopaclient?-JAX-WSProxy

HelloService service = new HelloService();Hello helloClient = service.getHelloHttpPort();String result = helloClient .sayHi("Joe");

注意:也可以通过弹簧进行配置

4)使用客户端证书配置身份验证

这是艰难的一步 http://cxf.apache.org/docs/client-http-transport-includes-ssl-
support.html#ClientHTTPTransport(包括SSLsupport)-配置SSLSupport

定义参考您的证书的管道文件。这是一个例子

<beans xmlns="http://www.springframework.org/schema/beans"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"    xmlns:sec="http://cxf.apache.org/configuration/security"    xsi:schemaLocation="http://cxf.apache.org/transports/http/configurationhttp://cxf.apache.org/schemas/configuration/http-conf.xsdhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsd">   <http-conf:conduit name="*.http-conduit">         <http-conf:tlsClientParameters disableCNCheck="true" secureSocketProtocol="TLS">  <sec:keyManagers keyPassword="password" >      <sec:keyStore type="pkcs12" password="password"          file="yourcertificate.p12" />  </sec:keyManagers> </http-conf:tlsClientParameters>  <http-conf:client Connection="Keep-Alive" MaxRetransmits="1" AllowChunking="false" />         </http-conf:conduit></beans>

如果您喜欢以编程方式进行操作,则可以

Client client = ClientProxy.getClient(helloClient);HTTPConduit http = (HTTPConduit) client.getConduit();//set the parameters in a similar way to file


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/402987.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号