Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle Spring Webservice connection error in the start up?

I'm using JaxWsPortProxyFactoryBean in Spring to connect a SOAP webservice. The problem is that if in the moment of Spring start up the webservice is down (because of network problem). It will cause an Exception and stop the Spring initialization. I don't want this behavior, the application doesn't need to stop only because of a failure with a webservice connection.

Is there any better/correct way using Spring to deal with 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>

Thanks,

like image 489
B. Broto Avatar asked Apr 06 '12 08:04

B. Broto


1 Answers

Maybe by setting the property 'lookupServiceOnStartup' 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>
like image 96
ndeverge Avatar answered Oct 19 '22 23:10

ndeverge