Saturday, November 14, 2015

Create a Proxy Service to Access the Redmine REST API through Redmine Connector


Prerequisites

  • WSO2 ESB [1]
  • WSO2 Redmine Connector [2]

This blog post is to demonstrate how to create a proxy service in WSO2 ESB (Enterprise Service Bus)   to access the Redmine REST API through Redmine connector. 


How to configure a proxy service in WSO2 ESB ?

Go to WSO2 ESB management console and select Main tag. Now click on Add button to create a new proxy service.



                       Figure 1

Now you can see the proxy service template list as shown in the following figure . From the list select the Custom Proxy template. 



                                                 Figure 2

Now add the basic settings of the proxy service as shown in the following figures.
First you should give a proper name to the proxy service  and click next button. Here I initialized the proxy service as “RedmineTest”.



                                                                          Figure 3

To Define an In Sequence in the proxy service select “Define inline” option and then click on create button. Now you will receive the “Design In Sequence” window as shown in figure 5.


                                                                    Figure 4


You need to add three properties to implement this proxy service.
To add a property you should do the following steps.
Click on “Add Child”
Select “Core” from the pop up menu.
Select “property” from the pop up menu.


                                                                   Figure 5

Now you have to enter the details of the property as shown in figure 6.


                                                                    Figure 6

Like wise you should create three properties for API URL , API Key and  Response type.

  •     apiUrl: URL for the Redmine REST API.
  •     apiKey: The generated API key for the user.
  •     responseType: The type of response to be returned (XML/JSON).

Then go to step 3 of creating proxy service. Select options as shown in figure 7 and click on finish button.


                                                                Figure 7
Now you can see the created proxy service in the “Deployed Services” list as shown in figure 8.


                                                                     Figure 8

To access the Redmine connector you have to edit the proxy service with Redmine operations [3]. Since this  sample proxy service was created to get the project list, I used two following  Redmine operations.

Redmine Init Operation:

       <redmine.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <apiKey>{$ctx:apiKey}</apiKey>
            <responseType>{$ctx:responseType}</responseType>
         </redmine.init>


Redmine List Project Operation:

 <redmine.listProjects/>

You can see the source view of the proxy service as shown in figure 9.







                                                                     Figure 9.


The design view of the proxy service as shown in figure 10.

                                                          Figure 10.

Click on Try this service.



                                                       Figure 11.

Click on Send button
                                                         Figure 12.

Now you can see the response as shown in figure 13.




                                                        Figure 13.

References.
[1] http://wso2.com/products/enterprise-service-bus/
[2] https://store.wso2.com/store/assets/esbconnector/f955b2e5-36cd-4417-8e31-a34ec8360ca4
[3] https://docs.wso2.com/display/ESBCONNECTORS/Configuring+Redmine+Operations

No comments:

Post a Comment