Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 835
j2gl Avatar asked Jul 17 '12 17:07

j2gl


1 Answers

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.

like image 99
Timm Avatar answered Sep 28 '22 03:09

Timm