Skip to content
Advertisement

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

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

 <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>

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 = "http://app.domain.com/usecase/serv1")
public class TestInterface {
    public ResultTO getResult(@WebParam(name = "getResultReq") 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:

<wsdl:service name="TestInterfaceService">
<wsdl:port binding="tns:TestInterfaceServiceSoapBinding" name="TestInterfacePort">
<soap:address location="http://host:8080/service/wstest/TestInterface"/>
</wsdl:port>
</wsdl:service>

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:

<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>

After this change WSDL shows “soap:address” as:

<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>

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 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.

Advertisement

Answer

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”:

<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>

Then WSDL was generated with soap:address as:

https://host.domain.com:8443/service/wstest/TestInterface
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement