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
;
  try
{
  project
= SAAMessageUtils.replaceDistanceUOM(project, false);
  ValidateSaaRequest request
= new ValidateSaaRequest();
  request
.setProject(project);

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


  
} catch (Fault e) {
  LOG
.error("Failed to validate airspace", e);
  
}
  List
<String> result = new ArrayList<String>();
  
if ("designerValidation".equals(format)) {
  
if (response != null && !response.isSuccess())
  result
.add(response.getMessage());
  
} else {
  
if (response != null)
  result
.add(response.getMessage());
  
}
  
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>
</props>

</
property>
</bean> 
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" >
<property name="sessionFactory" ref="sessionFactory" />
<property name="entityInterceptor" ref="hibernateEntityInterceptor" />
</bean> 
<bean id="hibernateEntityInterceptor" class="gov.faa.saa.ds.hibernate.EntityInterceptor">
<property name="sessionFactory" ref="sessionFactory" />
<property name="securityContext" ref="securityContext" />
</bean> 
<!-- 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="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" 
updateCheck
="false" monitoring="autodetect" dynamicConfig="true"> 
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 13 2017
Added on Oct 13 2017
2 comments
201 views