Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

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

Mike Kutz

It looks like table TEST1 is being used as a temp table.
In Forms, this should probably have been a GTT.
GTTs don't work in APEX dye to Connection Pooling. You'd use a Collection instead.
But, I'm just guessing about the purpose of TEST1.
(PS - you should probably have just done an INSERT... SELECT instead of parsing a cursor in a loop)

SANPAT

Dear Mike Kutz
I want to delete all the old records from test1. then i want to update the table with the latest Query data from test table. can you suggest how to insert the records using the procedure in Oracle Apex .
Delete all Data from A Table
Query on Table B and get the data
Insert the Query data into A Table.
Sanjay

Mike Kutz
Answer

APEX is stateless. It automatically calls COMMIT as needed (or ROLLBACK ).
I'd keep it simple, Sanjay (K.I.S.S.)

BEGIN
  DELETE FROM TEST1;

  INSERT INTO TEST1 (empno,name)
    SELECT empno, name FROM EMPLOYEE;
END;
Marked as Answer by SANPAT · Oct 17 2021
SANPAT

Dear Mike Kutz
Thanks , your given Query is perfectly runing on Sql Command, but the same Query when i update in the Form at server side condition , it's not working . it truncate the data but not updating with fresh data from the called table.
image.png
image.pngKindly sugget .
Sanjay

AndyH

As you are running this from a Dynamic Action it will be running in a different database session to that of your page. If your page hasn't committed it's data, the session in your DA will not see that data.
Is there a particular reason you are doing this work through a DA and not through a process?

SANPAT

Dear AndyH
I am new to Oracle Apex and Learning , Can you please give me some tips , how to take such query from Process.
Its getting executed properly , but i don't know how to display the message once the Procedure Query will update the table . Can you please suggest.
Sanjay

1 - 6
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
269 views