0

I'm using wso2esb 4.7.0 and wso2dss 3.1.0.I have created restful service in wso2dss with following configuration :

<query id="selectall" useConfig="default">
      <sql>select userid,username,password from usertable</sql>
      <result element="Entries" rowName="Entry">
         <element column="userid" name="userid" xsdType="string"/>
         <element column="username" name="username" xsdType="string"/>
         <element column="password" name="password" xsdType="string"/>
      </result>
   </query>

  <resource method="GET" path="user1">
      <call-query href="selectall"/>
   </resource>

It's working fine in dss with below curl command

curl -X GET -H "Accept: application/json" http://192.168.1.23:9764/services/A_resttest.HTTPEndpoint/user1

Now i wish to use this service in wso2esb.How can i access this in esb.For this i have created an endpoint :

Name: resttestendp
Address: http://192.168.1.23:9764/services/A_resttest.HTTPEndpoint
Format: GET

and my esb configuration is like :

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="RESTtest"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
      <log level="full"/>
         <send>
            <endpoint key="resttestendp"/>
         </send>
      </inSequence>
      <outSequence/>
   </target>
   <description/>
</proxy>

curl using to access it is:

curl -X GET -H "Accept: application/json" http://youtility-desktop:8282/services/RESTtest.HTTPEndpoint/user1

but it showing error :

ERROR - NativeWorkerPool Uncaught exception
java.lang.NullPointerException
    at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:156)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:679)

Where should i make changes or i have to implement rest api concept? let me know.. I referred : Access WSO2 Data Services Service via WSO2 ESB

Community
  • 1
  • 1
user3129056
  • 447
  • 3
  • 6
  • 19

1 Answers1

0

You have to create API in ESB if you need to implement REST API inside ESB. Please use below links for more help.

A Sample: https://docs.wso2.org/display/ESB470/Sample+800%3A+Introduction+to+REST+API

More help on verifying the usage

WSO2 ESB - REST API - Response Does Not Come

In General:

https://docs.wso2.org/display/ESB470/Getting+Started+with+REST+APIs

Community
  • 1
  • 1
jayalalk
  • 2,382
  • 3
  • 17
  • 14
  • hi jayalalk..Thanks for reply..I have tried https://docs.wso2.org/display/ESB470/Sample+800%3A+Introduction+to+REST+API But it also showing same error i.e NativeWorkerPool Uncaught exception java.lang.NullPointerException in server side – user3129056 May 14 '14 at 05:39
  • First of all, make sure sample given by the sample link is working fine. Take a new copy of ESB to new location and start ESB with command. "bin>wso2esb-samples.sh -sn 800" , then try accessing API using curl. If this works then you know how to make API – jayalalk May 14 '14 at 06:17