Hai All,

           First of all, I will explain the architecture of the REST API
implementation. The Registry REST API has two mode of functionality.

1) Standalone mode -

Straight access to Registry REST API. This has been done and working fine.
In this case Registry provide a way to generate the OAuth Access token  for
users to access the resources. Therefore the REST calls can be made from
any REST client with an access token to access the resources.

2) With API Manager Mode -

This means the access to Registry REST API with the Externally running API
manager instance. In here, the admin or any responsible person will publish
the REST API via API publisher. Therefore the REST API would be available
for subscriber / endusers. Once the access token has been generated, user
will be able to access the  Registry Resources.

In this mode, There are 2 ways in which I have implemented the REST API
invocation process. This is explained as below.

1 >> REST client ----> API gateway(REST API published at the APIM)
---->Registry REST API ----> Registry Resource ----> Response go to REST
client.

The above implementation works fine.

2 >> REST Client -----> Registry REST API ----> Call the REST endpoint at
the APIM ----> return call from APIM to Registry REST API ----> Registry
Resource ----> Response back to REST client.

The above approach, I have the an issue to pass the payload from Registry
REST API to APIM. I have designed the REST API in CXF/ JAx-Rs. The apache
CXF Jax-Rs implementation provide a Request Handler which is an interceptor
for the incoming requests. Therefore any request made from REST client to
Registry REST API will hit the Request Handler First.

Therefore, when the request go to the handler, it will check whether the
request comes from APIM or Straight from the Client. If it comes from the
client it will call the REST API endpoint at the APIM via an apache
HttpClient. Therefore when I call it, I have to extract the access token,
queryParam, payload..etc from REST client's request and add it to the
request given to APIM. But I am able to extract the access token,
queryparam and add it to HttpMethod and call the APIM. Request Handler
seems that does not have a way to extract the payload ( POST/PUT).
Therefore unable to pass the payload to the REGISTRY REST API. That is why
GET and DELETE requests are working fine in the second approach since those
do not require the payload. BUT POST/PUT requests fail to proceed.


Therefore The CXF JAX-RS Request Handler has both the Standalone Mode and
APIM mode execution. Therefore the standalone mode is working fine. But
Which approach to be selected regarding the APIM mode to put it in the
request handler class. Since there is an issue in Approach 2 @ APIM mode,
It went to approach 1. According to the approach 1 the code will be cleaner
than approach 2.

*According to Approach 1 @APIM mode the example Request URL will be,*

http://{ipaddress}:8280/{REST API context
@APIM}/{version}/comments?path=/sample.xml.

*in Standalone mode:
*
http:{IP address}:{greg http port}/{rest api context @
greg}/comments?path=/sample.xml.


The APIM team already given their words to derive an integrate able APIM
solution for other WSO2 products. Meanwhile we heard that APIM team working
on that too.

Few days ago, Had a chat with APIM guys, They said that API publisher and
API store will be there as it is. Therefore whoever wants to publish an API
have login to the API publisher and publish an API. This can not be done
automatically during the server starts up.

This is all about the integration part of REST API with API Manager. @APIM
please let us know the current stage of your solution.

Thanks!
Ragu
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to