JBOSS EAP 6.4:无法在生成的WSDL中的"soap:address"中使用HTTPS模式。

huangapple go评论82阅读模式
英文:

JBOSS EAP 6.4: Can not use the HTTPS schema in "soap:address" in generated WSDL

问题

我已将独立配置修改为同时使用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编写的Web服务:

@Stateless
@WebService(targetNamespace = "http://app.domain.com/usecase/serv1")
public class TestInterface {
    public ResultTO getResult(@WebParam(name = "getResultReq") final RequestRO getResultReq) {
        // 这里有一些逻辑
    }
}

应用程序(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>

我的Web服务可以从这两个URL访问:

http://host:8080/service/wstest/TestInterface

https://host.domain.com:8443/service/wstest/TestInterface

我如何更改生成的WSDL文件中“soap:address”元素内的URL?

我尝试在独立XML中更改Web服务模块配置:

<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。我在Stack Overflow上找到了一些主题(thread1thread2),其中建议在独立XML中的Web服务定义中添加“wsdl-uri-scheme”属性。但是JBOSS EAP 6.4尚不支持<wsdl-uri-scheme>。

如果您知道如何解决此问题,请告诉我。如果您需要更多信息,请告诉我。

英文:

I have modified my standalone configuration to use HTTPS connector along with the HTTP connector:

 &lt;subsystem xmlns=&quot;urn:jboss:domain:web:2.2&quot; default-virtual-server=&quot;default-host&quot; native=&quot;false&quot;&gt;
	&lt;connector name=&quot;http&quot; protocol=&quot;org.apache.coyote.http11.Http11NioProtocol&quot; scheme=&quot;http&quot; socket-binding=&quot;http&quot;/&gt;
	&lt;connector name=&quot;https&quot; protocol=&quot;HTTP/1.1&quot; scheme=&quot;https&quot; socket-binding=&quot;https&quot; secure=&quot;true&quot;&gt;
		&lt;ssl name=&quot;https&quot; key-alias=&quot;test&quot; password=&quot;testpwd&quot; certificate-key-file=&quot;testjkspath&quot;/&gt;
	&lt;/connector&gt;
	&lt;virtual-server name=&quot;default-host&quot; enable-welcome-root=&quot;false&quot;&gt;
		&lt;alias name=&quot;localhost&quot;/&gt;
		&lt;rewrite name=&quot;redirect_https&quot; pattern=&quot;^.*/service/(.*)&quot; substitution=&quot;https://host.domain.com:8443/service/$1&quot; flags=&quot;L,R=301&quot;&gt;
			&lt;condition name=&quot;condition-0&quot; test=&quot;%{SERVER_PORT}&quot; pattern=&quot;8080&quot;/&gt;
			&lt;condition name=&quot;condition-1&quot; test=&quot;%{HTTPS}&quot; pattern=&quot;off&quot;/&gt;
		&lt;/rewrite&gt;
	&lt;/virtual-server&gt;
&lt;/subsystem&gt;

With this configuration, I am able to transfer the HTTP traffic to HTTPS URL. It works fine. I also have a webservice written in JAVA:

@Stateless
@WebService(targetNamespace = &quot;http://app.domain.com/usecase/serv1&quot;)
public class TestInterface {
    public ResultTO getResult(@WebParam(name = &quot;getResultReq&quot;) final RequestRO getResultReq) {
        // some logic here
    }
}

Once application (service.ear) is deployed, I am able to see the wsdl at:

https://host.domain.com:8443/service/wstest/TestInterface?wsdl

But the WSDL service definition uses HTTP URL inside "soap:address" element:

&lt;wsdl:service name=&quot;TestInterfaceService&quot;&gt;
&lt;wsdl:port binding=&quot;tns:TestInterfaceServiceSoapBinding&quot; name=&quot;TestInterfacePort&quot;&gt;
&lt;soap:address location=&quot;http://host:8080/service/wstest/TestInterface&quot;/&gt;
&lt;/wsdl:port&gt;
&lt;/wsdl:service&gt;

My webservice can be accessed from both URLs:

http://host:8080/service/wstest/TestInterface

and

https://host.domain.com:8443/service/wstest/TestInterface

How can I change the URL generated inside "soap:address" element inside the generated WSDL file?

I tried to change webservice module configuration inside standalone XML as:

&lt;subsystem xmlns=&quot;urn:jboss:domain:webservices:1.2&quot;&gt;
	&lt;modify-wsdl-address&gt;true&lt;/modify-wsdl-address&gt;
	&lt;wsdl-host&gt;host.domain.com&lt;/wsdl-host&gt;
	&lt;wsdl-secure-port&gt;8443&lt;/wsdl-secure-port&gt;
	&lt;endpoint-config name=&quot;Standard-Endpoint-Config&quot;/&gt;
	&lt;endpoint-config name=&quot;Recording-Endpoint-Config&quot;&gt;
		&lt;pre-handler-chain name=&quot;recording-handlers&quot; protocol-bindings=&quot;##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM&quot;&gt;
			&lt;handler name=&quot;RecordingHandler&quot; class=&quot;org.jboss.ws.common.invocation.RecordingServerHandler&quot;/&gt;
		&lt;/pre-handler-chain&gt;
	&lt;/endpoint-config&gt;
&lt;/subsystem&gt;

After this change WSDL shows "soap:address" as:

&lt;wsdl:service name=&quot;TestInterfaceService&quot;&gt;
&lt;wsdl:port binding=&quot;tns:TestInterfaceServiceSoapBinding&quot; name=&quot;TestInterfacePort&quot;&gt;
&lt;soap:address location=&quot;http://host.domain.com:8080/service/wstest/TestInterface&quot;/&gt;
&lt;/wsdl:port&gt;
&lt;/wsdl:service&gt;

Port is not changed. URI schema is also not changed to HTTPS. I found couple of SO threads (thread1, thread2) which asks to add "wsdl-uri-scheme" attribute inside webservice definition inside standalone XML. But <wsdl-uri-scheme> is not supported by JBOSS EAP 6.4 yet.

Please let me know if you have any idea on how to do this. If you need more information, please let me know.

答案1

得分: 1

我终于找到了如何在JBOSS EAP 6.4中使其工作的方法。请参考这个RedHat知识库

有多种方法。我按照选项1来动态重写soap:address。你需要做的就是在webservice子系统中使用wsdl-secure-port,并将wsdl-host设置为"jbossws.undefined.host":

<subsystem xmlns="urn:jboss:domain:webservices:1.2">
    <modify-wsdl-address>true</modify-wsdl-address>
    <wsdl-host>jbossws.undefined.host</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为:

https://host.domain.com:8443/service/wstest/TestInterface
英文:

I finally found how to make it work with JBOSS EAP 6.4. Refer to this RedHat knowledgebase.

There are multiple ways. I followed option 1 to dynamically rewrite soap:address. All you need to do is use wsdl-secure-port is webservice subsystem and set wsdl-host to value "jbossws.undefined.host":

&lt;subsystem xmlns=&quot;urn:jboss:domain:webservices:1.2&quot;&gt;
    &lt;modify-wsdl-address&gt;true&lt;/modify-wsdl-address&gt;
    &lt;wsdl-host&gt;jbossws.undefined.host&lt;/wsdl-host&gt;
    &lt;wsdl-secure-port&gt;8443&lt;/wsdl-secure-port&gt;
    &lt;endpoint-config name=&quot;Standard-Endpoint-Config&quot;/&gt;
    &lt;endpoint-config name=&quot;Recording-Endpoint-Config&quot;&gt;
        &lt;pre-handler-chain name=&quot;recording-handlers&quot; protocol-bindings=&quot;##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM&quot;&gt;
            &lt;handler name=&quot;RecordingHandler&quot; class=&quot;org.jboss.ws.common.invocation.RecordingServerHandler&quot;/&gt;
        &lt;/pre-handler-chain&gt;
    &lt;/endpoint-config&gt;
&lt;/subsystem&gt;

Then WSDL was generated with soap:address as:

https://host.domain.com:8443/service/wstest/TestInterface

huangapple
  • 本文由 发表于 2020年8月25日 22:16:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/63580848.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定