SimpleJaxWsServiceExporter - BaseAddress

0

I created a Web Service with JAX-WS and used Spring to put it online and also to decrease the use of XML. Problem is that when I declare the SimpleJaxWsServiceExporter in the Spring configuration file I have to put the baseAddress attribute that is the host, the default is localhost: 8080 and when it is so I can not access the WebService through another machine. Ex: I go to another machine and I type the IP of my and not access the Web Service in the referred port, now if I configure the baseAddress with my-ip: 8080 I access from any machine and not access by localhost: 8080 / p>

If it was a study project had no problem but I have to put in homologation and production and every time before generating the .war I have change and put ip.

<?xml version="1.0" encoding="UTF-8"?><beans    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
                        http://www.springframework.org/schema/context
                        http://www.springframework.org/schema/context/spring-context-3.2.xsd
                        http://www.springframework.org/schema/tx 
                        http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

<tx:annotation-driven/>
<context:component-scan base-package="br" />
<context:annotation-config />

<bean name="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean" scope="singleton">
    <property name="packagesToScan" value="br.com" />
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
            <prop key="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</prop>
            <prop key="hibernate.connection.url">$url</prop>
            <prop key="hibernate.connection.username">$user</prop>
            <prop key="hibernate.connection.password">$pass</prop>

            <prop key="hibernate.c3p0.min_size">5</prop>
            <prop key="hibernate.c3p0.max_size">20</prop>
            <prop key="hibernate.c3p0.timeout">86400</prop>
            <prop key="hibernate.c3p0.max_statements">0</prop>
            <prop key="hibernate.temp.use_jdbc_metadata_defaults">false</prop>
            <prop key="hibernate.c3p0.idle_test_period">120</prop>
        </props>
    </property>
</bean>

<bean id="transactionManager"  class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" /> 
</bean>

<bean id="messageDispatcherServlet" class="org.springframework.ws.transport.http.MessageDispatcherServlet">
</bean>

<!-- Localhost -->
<bean class= "org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter">
    <property name="baseAddress" value="http://localhost:7078/" />
</bean>

    
asked by anonymous 28.08.2014 / 15:35

1 answer

1

I suggest using this setting:

dependency:

<dependency>
    <groupId>org.jvnet.jax-ws-commons.spring</groupId>
    <artifactId>jaxws-spring</artifactId>
    <version>1.9</version>
</dependency>

service configuration

<wss:binding url="/service/enderecoSeuServico">
    <wss:service>
        <ws:service bean="#seuBeanAnotadoCom @WebService" /> 
    </wss:service>
</wss:binding>

where the prefixes are:

xmlns:ws= "http://jax-ws.dev.java.net/spring/core"
xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"

this way no matter the baseAddress of your server

    
29.08.2014 / 13:58