【发布时间】:2020-12-14 06:18:53
【问题描述】:
我已修改我的独立配置以使用 HTTPS 连接器和 HTTP 连接器:
<subsystem xmlns="urn:jboss:domain:web:2.2" default-virtual-server="default-host" native="false">
<connector name="http" protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="http" socket-binding="http"/>
<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
<ssl name="https" key-alias="test" password="testpwd" certificate-key-file="testjkspath"/>
</connector>
<virtual-server name="default-host" enable-welcome-root="false">
<alias name="localhost"/>
<rewrite name="redirect_https" pattern="^.*/service/(.*)" substitution="https://host.domain.com:8443/service/$1" flags="L,R=301">
<condition name="condition-0" test="%{SERVER_PORT}" pattern="8080"/>
<condition name="condition-1" test="%{HTTPS}" pattern="off"/>
</rewrite>
</virtual-server>
</subsystem>
通过此配置,我能够将 HTTP 流量传输到 HTTPS URL。它工作正常。我还有一个用 JAVA 编写的网络服务:
@Stateless
@WebService(targetNamespace = "http://app.domain.com/usecase/serv1")
public class TestInterface {
public ResultTO getResult(@WebParam(name = "getResultReq") final RequestRO getResultReq) {
// some logic here
}
}
部署应用程序 (service.ear) 后,我可以在以下位置看到 wsdl:
https://host.domain.com:8443/service/wstest/TestInterface?wsdl
但 WSDL 服务定义在“soap:address”元素中使用 HTTP URL:
<wsdl:service name="TestInterfaceService">
<wsdl:port binding="tns:TestInterfaceServiceSoapBinding" name="TestInterfacePort">
<soap:address location="http://host:8080/service/wstest/TestInterface"/>
</wsdl:port>
</wsdl:service>
可以从两个 URL 访问我的网络服务:
http://host:8080/service/wstest/TestInterface
和
https://host.domain.com:8443/service/wstest/TestInterface
如何更改生成的 WSDL 文件中“soap:address”元素中生成的 URL?
我尝试将独立 XML 中的 webservice 模块配置更改为:
<subsystem xmlns="urn:jboss:domain:webservices:1.2">
<modify-wsdl-address>true</modify-wsdl-address>
<wsdl-host>host.domain.com</wsdl-host>
<wsdl-secure-port>8443</wsdl-secure-port>
<endpoint-config name="Standard-Endpoint-Config"/>
<endpoint-config name="Recording-Endpoint-Config">
<pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
<handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
</pre-handler-chain>
</endpoint-config>
</subsystem>
在此更改之后,WSDL 将“soap:address”显示为:
<wsdl:service name="TestInterfaceService">
<wsdl:port binding="tns:TestInterfaceServiceSoapBinding" name="TestInterfacePort">
<soap:address location="http://host.domain.com:8080/service/wstest/TestInterface"/>
</wsdl:port>
</wsdl:service>
端口未更改。 URI 架构也未更改为 HTTPS。我发现了几个 SO 线程(thread1、thread2),它们要求在独立 XML 中的 web 服务定义中添加“wsdl-uri-scheme”属性。但 JBOSS EAP 6.4 尚不支持。
如果您对如何执行此操作有任何想法,请告诉我。如果您需要更多信息,请告诉我。
【问题讨论】:
标签: java web-services https jboss jboss6.x