How to handle Spring Webservice connection error at startup?

I am using JaxWsPortProxyFactoryBean in Spring to connect a SOAP web service. The problem is that if at the time of starting Spring the web service is not working (due to a network problem). This will throw an exception and stop Spring initialization. I do not want this behavior, the application does not need to stop just because of a failure when connecting to the web service.

Is there a better / correct way to use Spring to solve this problem? Here is my current xml context.

<bean id="beanWebServiceSOAP" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean" lazy-init="true">
    <property name="serviceInterface" value="com.company.bean.BeanWebServiceSoap" />
    <property name="wsdlDocumentUrl" value="${bean.wsdldocumenturl}" />
    <property name="namespaceUri" value="${bean.namespaceuri}" />
    <property name="serviceName" value="BeanWebService" />
    <property name="portName" value="BeanWebServiceSoap" />
</bean>

Thank,

+5
source share
2 answers

Perhaps setting the lookupServiceOnStartup ' property to false:

<bean id="beanWebServiceSOAP" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean" lazy-init="true">
    <property name="serviceInterface" value="com.company.bean.BeanWebServiceSoap" />
    <property name="wsdlDocumentUrl" value="${bean.wsdldocumenturl}" />
    <property name="namespaceUri" value="${bean.namespaceuri}" />
    <property name="serviceName" value="BeanWebService" />
    <property name="portName" value="BeanWebServiceSoap" />
    <property name="lookupServiceOnStartup" value="false" />
</bean>
+7
source

RestOperations RestTemplate?

-1

All Articles