I'm trying to call WSO2 DSS in WSO2 EI 6.4.0. There is REST Resource added in DSS to execute TRUNCATE query to delete all Data in Table

WSO2 DSS Code:

<data name="WSO2_ZCloud_test_DSS" transports="http https local">
   <config enableOData="false" id="Test_DataSource">
      <property name="driverClassName">org.postgresql.Driver</property>
      <property name="url">jdbc:postgresql://hostname:5432/db_schema</property>
      <property name="username">user</property>
      <property name="password">password</property>
   </config>
   
   <query id="dev_truncate_Q" useConfig="Test_DataSource">
      <sql>TRUNCATE TABLE  test_db.dev_test</sql>
   </query>
   
   <resource method="GET" path="dev_env_truncate">
      <call-query href="dev_truncate_Q"/>
   </resource>
</data>

There is one Task Scheduler which calls below mentioned Sequence

Sequence - Updated:

<sequence name="testBQ" xmlns="http://ws.apache.org/ns/synapse">
    <log level="custom">
        <property name="*********testBQ: B4 Truncate" value="**********"/>
    </log>
    
    <call>
        <endpoint>
            <http method="GET" uri-template="http://localhost:8280/devcontainer/services/WSO2_ZCloud_test_DSS/dev_env_truncate">
                <timeout>
                    <duration>60000</duration>
                </timeout>
                <suspendOnFailure>
                    <errorCodes>-1</errorCodes>
                    <initialDuration>0</initialDuration>
                    <progressionFactor>1.0</progressionFactor>
                    <maximumDuration>0</maximumDuration>
                </suspendOnFailure>
            </http>
        </endpoint>
    </call>
    <log level="custom">
        <property name="*********after Truncate" value=" **********"/>
    </log>
</sequence>

After this DSS Call, got below EXCEPTION

ERROR {org.apache.axis2.engine.AxisEngi
ne} -  The endpoint reference (EPR) for the Operation not found is /devcontainer/services/WSO2_ZCloud_test_DSS/
dev_env_truncate and the WSA Action = null. If this EPR was previously reachable, please contact the
 server administrator.

ERROR-LOG:

[2023-03-21 09:42:39,470] [-1234] [] [PassThroughMessageProcessor-93] ERROR {org.apache.axis2.engine.AxisEngi
ne} -  The endpoint reference (EPR) for the Operation not found is /devcontainer/services/WSO2_ZCloud_test_DSS/
dev_env_truncate and the WSA Action = null. If this EPR was previously reachable, please contact the
 server administrator.                                                                                       
org.apache.axis2.AxisFault: The endpoint reference (EPR) for the Operation not found is /devcontainer/services/
WSO2_ZCloud_test_DSS/dev_env_truncate and the WSA Action = null. If this EPR was previously reachabl
e, please contact the server administrator.                                                                  
        at org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:102)                 
        at org.apache.axis2.engine.Phase.invoke(Phase.java:329)                                              
        at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)                                    
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)                                   
        at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWork
er.java:337)                                                                                                 
        at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:158)                     
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)         
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)                   
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)                   
        at java.lang.Thread.run(Thread.java:748)                                                             
[2023-03-21 09:42:39,470] [-1234] [] [PassThroughMessageProcessor-93] ERROR {org.apache.synapse.transport.pas
sthru.ServerWorker} -  Error processing GET request for : /devcontainer/services/WSO2_ZCloud_test_DSS/device_in
ventory_truncate                                                                                             
org.apache.axis2.AxisFault: The endpoint reference (EPR) for the Operation not found is /devcontainer/services/
WSO2_ZCloud_test_DSS/dev_env_truncate and the WSA Action = null. If this EPR was previously reachabl
e, please contact the server administrator.                                                                  
        at org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:102)                 
        at org.apache.axis2.engine.Phase.invoke(Phase.java:329)                                              
        at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261) 

Ref Link:

Already checked this one

Note: This REST Resource Operation is not shown in tryit tool.

  • Tried via DBReport Mediator which took min 6 mins to finish it's execution(2 record deletion). So chosen DSS rather than DBReport. I need to DELETE all record before Inserting data to Target Table.

PS: Lot of similar issue questions available, None of them are helping even after tried multiple ways.

Can anyone help me out to fix this issue?

1

There are 1 best solutions below

6
ycr On

The problem seems to be you are trying to do a SOAP call to a Restful service. Try removing the following two properties.

<property name="Content-Type" scope="axis2" type="STRING" value="text/xml"/>
<header name="Action" scope="default" value="urn:dev_env_truncate"/>

I just observed an additional context path in the service. /devcontainer/services/WSO2_ZCloud_test_DSS/device_in ventory_truncate. Obviously WSO2 doesn't understand devcontainer(Unless ou have added custom root context) so the correct URL should be http://localhost:8280/services/WSO2_ZCloud_test_DSS/dev_env_truncate