如何使用Web Service使用者将Spring MVC 4配置为以两种方式通过SSL发送和接收肥皂消息? [英] How to Configure Spring MVC 4 to send and receive soap messages in two way SSL using Web Service Consumer?

查看:91
本文介绍了如何使用Web Service使用者将Spring MVC 4配置为以两种方式通过SSL发送和接收肥皂消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用Spring Ws通过两种方式配置Spring MVC SSL以连接到第三方,但是由于缺乏文档,我决定将Spring MVC 4 Application与Web Service Consumer集成。我是Web的初学者服务消耗。我想知道如何使用基于批注的配置通过Web Service使用者配置Spring MVC 4应用程序,以实现与第三方的双向SS1通信,并在将其肥皂消息发送到https之前对其进行加密服务器?如果有任何链接或示例代码会有所帮助
另外,如果WSDL位于aa https链接中,我如何生成类?

I have tried to configure Spring MVC in two way SSL using Spring Ws to connect to third party but due to the lack of documentation I have decided to integrate my Spring MVC 4 Application with Web Service Consumer .I am a beginner in Web Service consumption.I would like to know how to configure my Spring MVC 4 application with web service consumer with annotation based configuration to achieve a Two way SSl communication with Third party and also encrypt my soap messages before it is sent to the https server ?If any links or sample code would be helpful. Also if the WSDL is located in a a https link how do I generate the classes?

推荐答案

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

This question is huge. There is no a trivial solution

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

I can provide the steps and guide to the manual

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

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

Use maven, ivy or download. You need jax-ws and related 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

wdsl2java have done the work for you 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");

注意:也可以使用spring进行配置

Note: It is also possible configure with spring

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

这是困难的步骤
http://cxf.apache.org/docs/client- http-transport-includes-ssl-support.html#ClientHTTPTransport(包括SSLsupport)-ConfiguringSSLSupport

使用对您的证书的引用定义管道文件。这是一个示例

Define a conduit file with the reference to your certificate. This is an example

<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/configuration
           http://cxf.apache.org/schemas/configuration/http-conf.xsd
           http://www.springframework.org/schema/beans
           http://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>

如果您喜欢编程,可以这样做

If you prefer to do programmaticaly you can do

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

这篇关于如何使用Web Service使用者将Spring MVC 4配置为以两种方式通过SSL发送和接收肥皂消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆