Skip to Main Content

Java Programming

Webservice not returning correct response

user8769643Oct 13 2017 — edited Oct 16 2017

-1down votefavorite

Can someone help me with an issue i am having with my SOAP web services. It's hosted on Apache Servicemix and using PostgresSQL as database and using hibernate as ORM framework .

I have a validateProject request which internally calls another webservice validateShape hosted on glassfish server. When i run validateProject with invalid data for the first time it gives correct response saying "validation failed" . But once i correct the request and run it again the response still says validation failed instead of passing . But strange part is the response that comes back from internal validateShape request comes back as passed when i run it from SOAPUI separately. Here is the code snippet fort the validateProject method in my webservice code.

public List<String> validateProject(String project, String format) {

  ValidateSaaResponse response
= null;
  IntegrationModuleGetService getClient
= SAAMessageUtils.replaceDistanceUOM(project, false);
  ValidateSaaRequest request
= new ValidateSaaRequest();

= getClient.validateShape(request); // This is another webservice call with in validateProject request

} catch (Fault e) {
.error("Failed to validate airspace", e);
<String> result = new ArrayList<String>();
if ("designerValidation".equals(format)) {
if (response != null && !response.isSuccess())
} else {
if (response != null)
return result;

I looked into webservice code to check if there is any caching happening. Since we are using hibernate in our project i noticed both query_cache and second level cache were being used and they are set to true. Also ehcache is also being used. This is the configuration and ehcache xmls.

<property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop> 
<prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory
</prop> <prop key="hibernate.show_sql">false</prop> <prop key="hibernate.format_sql">true</prop>
<!-- Caching -->
<prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</prop>
<prop key="hibernate.cache.use_second_level_cache">false</prop>
<prop key="hibernate.cache.use_query_cache">false</prop>

<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" >
<property name="sessionFactory" ref="sessionFactory" />
<property name="entityInterceptor" ref="hibernateEntityInterceptor" />
<bean id="hibernateEntityInterceptor" class="gov.faa.saa.ds.hibernate.EntityInterceptor">
<property name="sessionFactory" ref="sessionFactory" />
<property name="securityContext" ref="securityContext" />
<!-- DAO Layer -->   
<bean id="projectsDAO" class="gov.faa.saa.ds.dao.impl.HibernateProjectsDAO">
<property name="sessionFactory" ref="sessionFactory" /> </bean> 
<bean id="usersDAO" class="gov.faa.saa.ds.dao.impl.HibernateUsersDAO">
<property name="sessionFactory" ref="sessionFactory" /> </bean>

I set both query cache and second level cache to false and changed the ehcache configuration file parameters timeToLiveSeconds and timeToIdleSeconds to set to like 2 seconds but the issue is not resolved.

<?xml version="1.0" encoding="UTF-8"?> <ehcache xmlns:xsi="" xsi:noNamespaceSchemaLocation="" 
="false" monitoring="autodetect" dynamicConfig="true"> 
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 13 2017
Added on Oct 13 2017