更改soap:在tomcat 6 axis2上生成的wsdl中的地址位置为https(1.6.2)

时间:2014-02-28 08:41:52

标签: web-services tomcat soap wsdl axis2

首先,我使用eclipse,使用Axis2 1.6.2并在tomcat 6上部署我创建的Web服务.Web服务是在eclipse中从自上而下的方法创建的。

我被要求访问我的网络服务SSL兼容。 没有问题发生在那里,我跟着网址“http://axis.apache.org/axis2/java/core/docs/servlet-transport.html”,这导致我修改axis2.xml包括:

<transportReceiver name="http" class="org.apache.axis2.transport.http.AxisServletListener">
    <parameter name="port">8080</parameter>
</transportReceiver>

<transportReceiver name="https" class="org.apache.axis2.transport.http.AxisServletListener">
    <parameter name="port">8443</parameter>
</transportReceiver>

删除:

 <transportReceiver name="http"
                   class="org.apache.axis2.transport.http.SimpleHTTPServer">
    <parameter name="port">8080</parameter>

<!-- Here is the complete list of supported parameters (see example settings further below):
    port: the port to listen on (default 6060)
    hostname:  if non-null, url prefix used in reply-to endpoint references                                 (default null)
    originServer:  value of http Server header in outgoing messages                                         (default "Simple-Server/1.1")
    requestTimeout:  value in millis of time that requests can wait for data                                (default 20000)
    requestTcpNoDelay:  true to maximize performance and minimize latency                                   (default true)
                        false to minimize bandwidth consumption by combining segments
    requestCoreThreadPoolSize:  number of threads available for request processing (unless queue fills up)  (default 25)
    requestMaxThreadPoolSize:  number of threads available for request processing if queue fills up         (default 150)
                               note that default queue never fills up:  see HttpFactory
    threadKeepAliveTime:  time to keep threads in excess of core size alive while inactive                  (default 180)
                          note that no such threads can exist with default unbounded request queue
    threadKeepAliveTimeUnit:  TimeUnit of value in threadKeepAliveTime (default SECONDS)                    (default SECONDS)
-->
<!-- <parameter name="hostname">http://www.myApp.com/ws</parameter> -->
<!-- <parameter name="originServer">My-Server/1.1</parameter>           -->
<!-- <parameter name="requestTimeout">10000</parameter>                   -->
<!-- <parameter name="requestTcpNoDelay">false</parameter>                   -->
<!-- <parameter name="requestCoreThreadPoolSize">50</parameter>                      -->
<!-- <parameter name="requestMaxThreadPoolSize">100</parameter>                     -->
<!-- <parameter name="threadKeepAliveTime">240000</parameter>                  -->
<!-- <parameter name="threadKeepAliveTimeUnit">MILLISECONDS</parameter>            -->
 </transportReceiver>

我还必须修改web配置中的web.xml以包含:

  <security-constraint>
<web-resource-collection>
  <web-resource-name>HTTPSOnly</web-resource-name>
  <url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
  <transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>

一切顺利,我只能使用https访问应用程序: “HTTPS:// myUrl:8443 / IVRCoreWebService /服务/ CardManager WSDL”

此处的问题出现在URL中打开的描述文件中:

<service name="CardManager">
        <port name="CardManagerPort" binding="tns:CardManagerBinding">
                <soap:address location="http://`myUrl`:8080/IVRCoreWebService/services/CardManager/"/>
        </port>
</service>

如何将Axis2自动生成的网址更改为https位置,我希望我的网址如下:

<service name="CardManager">
        <port name="CardManagerPort" binding="tns:CardManagerBinding">
                <soap:address location="https://`myUrl`:8443/IVRCoreWebService/services/CardManager/"/>
        </port>
</service>

如果我将<transportReceiver name="http">(见上文)中的端口修改为例如8050,则soap:地址位置将依次更改为8050,因此我的猜测是,当生成wsdl时,它正在引用<transportReceiver name="http" >,我知道如何让它引用<transportReceiver name="https" >


我检查了这个线程https://stackoverflow.com/a/10072185/861760,它告诉我在service.xml中添加<transports><transport>https</transport></transports>(我找到了services.xml),当我添加这段代码时,它给了我一个新的错误:

org.apache.axis2.AxisFault: Server does not have an epr for the wsdl epr==>http://www.example.com
org.apache.axis2.description.AxisService.getLocationURI(AxisService.java:1615)
org.apache.axis2.description.AxisService.setPortAddress(AxisService.java:1498)
org.apache.axis2.description.AxisService.printDefinitionObject(AxisService.java:1078)
org.apache.axis2.description.AxisService.printUserWSDL(AxisService.java:1112)
org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1386)
org.apache.axis2.transport.http.ListingAgent.handleWSDLRequest(ListingAgent.java:327)
org.apache.axis2.transport.http.ListingAgent.processListService(ListingAgent.java:183)
org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

感谢您的帮助,

问候。

1 个答案:

答案 0 :(得分:0)

我不确定你问这个,但我看到了

地址位置=(域+端口)/(文件名.WAR)/ services /(wsdl:binding的名称)