gpt4 book ai didi

web-services - 换 SOAP :address location in generated wsdl to https on tomcat 6 axis2(1. 6.2)

转载 作者:行者123 更新时间:2023-11-28 22:30:21 27 4
gpt4 key购买 nike

首先,我使用的是带有 Axis2 1.6.2 的 eclipse,我正在 tomcat 6 上部署我创建的 Web 服务。Web 服务是在 eclipse 中通过自上而下的方法创建的。

我被要求使对我的 Web 服务的访问与 SSL 兼容。那里没有出现问题,我遵循了 url“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/services/CardManager?wsdl”

这里的问题出现在 URL 中打开的描述文件中:

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

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

<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:address 位置将依次更改为 8050,因此我猜测当生成 wsdl 时,它引用了 <transportReceiver name="http" >。 , 知道如何让它引用 <transportReceiver name="https" >


我检查了这个线程 https://stackoverflow.com/a/10072185/861760这是告诉我添加 <transports><transport>https</transport></transports>在 service.xml 中(我找到了 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)

谢谢你的帮助,

问候。

最佳答案

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

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

关于web-services - 换 SOAP :address location in generated wsdl to https on tomcat 6 axis2(1. 6.2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22090135/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com