`
sillycat
  • 浏览: 2487410 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

SOAP AXIS2 with HTTPS

    博客分类:
  • SOA
 
阅读更多
SOAP AXIS2 with HTTPS

1. sample configuration on tomcat7.0
server.xml

    <Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS"
               keystoreFile="d:\tool\apache-tomcat-7.0.16\tomcat.jks"
               keystorePass="xxxxxx"/>

2. configuration in axis2.xml
    <transportSender name="https"
                     class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
        <parameter name="PROTOCOL">HTTP/1.1</parameter>
        <parameter name="Transfer-Encoding">chunked</parameter>
        <parameter name="port">443</parameter>
    </transportSender>

That is all for the server side.

3. Client side
We can call the https SOAP server with our client like this:
@Test
public void weatherService()
{
RPCServiceClient serviceClient = null;
       try
        {
        //http://www.httpdebugger.com/download.html
        String HTTPS_URL = "https://server/easyaxis/services/WeatherService";
        String HTTP_URL = "http://server:8080/easyaxis/services/WeatherService";
       
            serviceClient = new RPCServiceClient();
            Options options = serviceClient.getOptions();
            EndpointReference targetEPR = new EndpointReference(HTTP_URL);
            options.setTimeOutInMilliSeconds(1800000); // 10000 seconds
            options.setProperty(HTTPConstants.CHUNKED, Boolean.FALSE);
            options.setProperty(HTTPConstants.SO_TIMEOUT, 1800000);
            options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, 1800000);
            options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
            // client.getOptions().setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION, Boolean.TRUE);
            options.setExceptionToBeThrownOnSOAPFault(true);
            options.setTo(targetEPR);
           
            //SSL
            System.setProperty("javax.net.ssl.trustStore","d:\\tool\\apache-tomcat-7.0.16\\tomcat.jks");
            System.setProperty("javax.net.ssl.trustStorePassword","D1gby!");
           
            // Setting the weather
            QName opSetWeather = new QName("http://services.weather.axis2.sillycat.com", "setWeather");
            Weather w = new Weather();
            w.setTemperature((float) 39.3);
            w.setForecast("Cloudy with showers");
            w.setRain(true);
            w.setHowMuchRain((float) 4.5);
            Object[] opSetWeatherArgs = new Object[] { w };

            serviceClient.invokeRobust(opSetWeather, opSetWeatherArgs);

            // Getting the weather
            QName opGetWeather = new QName("http://services.weather.axis2.sillycat.com", "getWeather");
            Object[] opGetWeatherArgs = new Object[] {};
            @SuppressWarnings("rawtypes")
Class[] returnTypes = new Class[] { Weather.class };
            Object[] response = serviceClient.invokeBlocking(opGetWeather, opGetWeatherArgs, returnTypes);

            Weather result = (Weather) response[0];

            if (result == null)
            {
                System.out.println("Weather didn't initialize!");
                return;
            }
            // Displaying the result
            System.out.println("Temperature               : " + result.getTemperature());
            System.out.println("Forecast                  : " + result.getForecast());
            System.out.println("Rain                      : " + result.isRain());
            System.out.println("How much rain (in inches) : " + result.getHowMuchRain());
        }
        catch (Exception e)
        {
            System.out.println("error:" + e);
        }
        finally
        {
            try
            {
                // clear up
                serviceClient.cleanupTransport();
            }
            catch (Exception e)
            {
                System.out.println("error:" + e);
            }
        }
    }

4. Moniters

First of all, we can use the HttpAnalyzer to watch the data, but it only work for the HTTP, not HTTPS.

Then I tried the SOAP monitor. That works.

references:
http://shivendra-tripathi.blogspot.com/2010/11/enabling-ssl-for-axis2-service-and.html
http://axis.apache.org/axis2/java/core/docs/http-transport.html#httpsupport
http://www.opensubscriber.com/message/axis-dev@ws.apache.org/8077606.html
http://techtidbitsbyshiv.blogspot.com/2010/11/axis2java-client-code-for-basic.html


分享到:
评论

相关推荐

    axis2 soap技术

    axis2 soap技术 wsdl技术 java 的技术

    SOAP Axis 三种发布调用方式简单实例

    比较简单的SOAP Axis三种发布、调用方式简单的实例,代码和文档都在,不包含AXIS包,需要自行下载。

    SOAP生成使用的AXIS2

    AXIS2结合IDEA快速生成JAVA类,如果需要将SOAP报文装成JAVA对象,下载,IDEA中配置

    axis,soap,rpc最新API

    axis,soap,rpc最新API axis,soap,rpc最新API axis,soap,rpc最新API axis,soap,rpc最新API axis,soap,rpc最新API axis,soap,rpc最新API

    axis2c-src-1.6.0

    Axis2/C supports both SOAP 1.1 and SOAP 1.2. The soap processing model is built on the AXIOM XML object model. Axis2/C is capable of handling one-way messaging (In-Only) as well as request ...

    axis2 for c++ 1.6

    The Apache Axis2/C is a SOAP engine implementation that can be used to provide and consume Web Services. Axis2/C is an effort to implement Axis2 architecture, in C. Please have a look at ...

    axis2-idea-plugin-1.7.9.zip_axis2_axis2-idea-plugin_idea导入axis2_

    axis2-idea-plugin-1.7.9

    axis2-1.6.1

    axis2-1.6.1-bin.zip Axis2是下一代 Apache Axis。Axis2 虽然由 Axis 1.x 处理程序模型提供支持,但它具有更强的灵活性并可扩展到新的体系结构。...Apache Axis2 是Axis的后续版本,是新一代的SOAP引擎。

    Axis2的OMElement SOAP XML报文节点首字母小写转大写(注意,是节点,不是节点元素的值) java

    Axis2的OMElement SOAP XML报文节点首字母小写转大写(注意,是节点,不是节点元素的值) java

    Axis2-1.6.2

    Web Service是现在最适合实现SOAP的技术,而Axis2是实现Web Service的一种技术框架(架构)

    axis2例子 webservice axis2 示例

    axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例

    SOAP调用Axis服务的Client

    SOAP调用Axis服务的Client SOAP调用Axis服务的Client SOAP调用Axis服务的Client

    SOAP与AXIS2入门教程附带实例

    SOAP与AXIS2入门教程附带实例,通过实例带您入门

    完整的axis2 jar包包含实例.zip

    axis2 webservice 服务端jar包: --&gt;axis2-kernel-1.6.1.jar --&gt;axis2-spring-1.6.1.jar --&gt;axis2-transport-http-1.6.1.jar --&gt;XmlSchema-1.4.7.jar --&gt;wsdl4j-1.6.2.jar --&gt;axiom-api-1.2.12.jar --&gt;axiom...

    axis2-1.6.2.zip

    axis2-1.6.2.zip, windows axis2工具,根据 WSDL生成java文件。 1、axis2客户端下载地址:http://mirror.esocc.com/apache//axis/axis2/java/core/1.6.2/axis2-1.6.2-bin.zip; 2、下载解压在D:\Work_Program_...

    SOAP/Axis 2 Servlet

    给写好 Axis 2 的服务, 另外加上这个servlet, 以便可以用一个 url (输入json 格式的数据) 在浏览器中来调用Axis 2 的服务, 以便得到 json 格式的结果. ...

    soap+axis+tomcat

    整理的关于soap axis tomcat搭建的webservice,希望对大家有帮助!

    axis2相关的jar包

    axis2-adb-1.5.4.jar axis2-adb-codegen-1.5.4.jar axis2-codegen-1.5.4.jar axis2-corba-1.5.4.jar axis2-fastinfoset-1.5.4.jar axis2-java2wsdl-1.5.4.jar axis2-jaxbri-1.5.4.jar axis2-jaxws-1.5.4.jar axis2-...

    一种基于Axis2的SOAP安全传输模型的研究

    一种基于Axis2的SOAP安全传输模型的研究

    axis2-1.7.8.zip

    axis2-1.7.8.zip客户端。2、下载解压在D:\Work_Program_Files目录;在D:\Work_Program_Files\axis2-1.6.2\bin目录有一个wsdl2java.bat文件; 3、设置环境变量,加入AXIS2_HOME=Axis2客户端安装目录,path中追加;%...

Global site tag (gtag.js) - Google Analytics