How can I change soap address in a JBoss 7 java webservice
Asked Answered
N

3

6

How can I change the soap address in a web service. I'm working on JBoss 7.1.1.

I have this web service class:

@WebService
public class Card {

   @WebMethod
   public CardResponseDTO insertCard(
           @WebParam(name = "cardRequestCardDTO") CardDTO cardDTO,
           @WebParam(name = "userName") String userName) {

       Date today;
       CardResponseDTO cardResponseDTO = new CardResponseDTO();

       try {
            today = Calendar.getInstance().getTime();
            // My logic in here...
            return cardResponseDTO;
       } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
            cardResponseDTO.setErrorCode(-2);
            cardResponseDTO.setErrorMessage(ex.getMessage());
            return cardResponseDTO;
       }
   }
}

And when I'm working at my localhost works fine with this WSDL:

<wsdl:service name="CardService">
  <wsdl:port binding="tns:CardServiceSoapBinding" name="CardPort">
    <soap:address location="http://localhost:8080/inventory-ws/Card"/>
  </wsdl:port>
</wsdl:service>

But when I deploy to my server, that has a name server1.somedomain.com, doesn't work because I got just http:// server1:8080/ ...

<wsdl:service name="CardService">
  <wsdl:port binding="tns:CardServiceSoapBinding" name="CardPort">
     <soap:address location="http://server1:8080/inventory-ws/Card"/>
  </wsdl:port>
</wsdl:service>

What I need is how to make it work in my server with the complete url: server1.domedomain.com.

Thanks in advance.

Netty answered 17/7, 2012 at 17:42 Comment(0)
M
1

You have to configure jboss to listen to the interface you want. To do so you have to edit the standalone.xml file and add some new interface tags. I think this post might be useful. https://community.jboss.org/message/614897

Myrlemyrlene answered 18/7, 2012 at 6:50 Comment(1)
Thanks @ppapapetrou, I just make the change on standalone.xml <wsdl-host>www.myhost.com</wsdl-host>Netty
M
14

If you need to deploy SOAP web services for public access e.g. via Apache you can remove in the standalone.xml this line: <wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host> at all.
Then the host name will be taken over from the WSDL URL.
In this case you do not need to change the configuration for every deployment stage. For example dev.myhost.com, qa.myhost.com or ww.myhost.com.

This avoids also the problem with wrong SSL port 8443 for public services.

Mucosa answered 26/11, 2014 at 14:17 Comment(0)
D
7

To clarify,

In the standalone.xml, just under the tag:

<subsystem xmlns="urn:jboss:domain:webservices:1.1">

You must modify these entries

<modify-wsdl-address>true</modify-wsdl-address>
<wsdl-host>www.myhost.com</wsdl-host>

To change port:

<wsdl-port>80</wsdl-port> <!-- case you need change port, instead 8080 -->
<wsdl-secure-port>443</wsdl-secure-port> <!-- case you need change port, instead 8443 -->

To change URI Schema:

<wsdl-uri-scheme>https</wsdl-uri-scheme> <!-- or http for non secure -->
Dissimilar answered 6/5, 2014 at 10:18 Comment(2)
How do we handle the port? In my case I do not want the port to appear in the soap address, but it does. There is no way to override this my supplying wsdl-port as blank as it throws parsing error.Prospect
Try this. ** <wsdl-host>jbossws.undefined.host</wsdl-host> ** This will take whatever hostname you have binded and if you use port 80 it will not show up.Foretopsail
M
1

You have to configure jboss to listen to the interface you want. To do so you have to edit the standalone.xml file and add some new interface tags. I think this post might be useful. https://community.jboss.org/message/614897

Myrlemyrlene answered 18/7, 2012 at 6:50 Comment(1)
Thanks @ppapapetrou, I just make the change on standalone.xml <wsdl-host>www.myhost.com</wsdl-host>Netty

© 2022 - 2024 — McMap. All rights reserved.