Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EDT:Resource Binding Services"

(Binding service @Resource)
Line 13: Line 13:
 
= <br>Defining a service binding in the EGL deployment descriptor<br> =
 
= <br>Defining a service binding in the EGL deployment descriptor<br> =
  
== Binding service @Resource<br><br> ==
+
At this writing, you can bind to&nbsp;a&nbsp;REST or EGL REST-RPC service.&nbsp;The distinctions among the service types&nbsp;are&nbsp;explained here: [http://www.eclipse.org/edt/papers/topics/egl_soa_overview.html http://www.eclipse.org/edt/papers/topics/egl_soa_overview.html].&nbsp; Additional information is in the help topic named "EGL support for SOA."<br><br>To define a service binding in the EGL deployment descriptor, do as follows:
  
In order to binding the service via @Resource, you should add the service into the Services Deployment. <br>Open the egldd file and switch to “Service Deployment” tab. Then click the Add button.<br><br>
+
*In an EGL project, expand the EGLSource folder and double-click&nbsp;the&nbsp;deployment descriptor, which has the file extension .egldd.&nbsp;&nbsp;
 
+
*Click the Resource Bindings tab.&nbsp;The Resource Bindings Configuraton page is displayed.
<nowiki>
+
*Click the Add button and select REST Service Binding.<br>
 
+
[[Image:Bind Img6.JPG]]
+
 
+
You can add the service myService into your Services Deployment setting up.<br>
+
 
+
[[Image:Bind Img7.JPG]]<br>
+
 
+
<br>
+
</nowiki>
+
 
+
Then switch to Resource Bindings tab to add the REST service binding. Click Add button and select “Rest Service Binding” to add the service binding.<br>
+
  
 
[[Image:Bind Img8.JPG]]<br>
 
[[Image:Bind Img8.JPG]]<br>

Revision as of 12:51, 20 January 2012

If the purpose of a resource binding is service access, the definition is called a service binding, and the main detail is in one of three formats:

  • If the service is deployed on an application server, you can specify a Universal Resource Identifier (URI). The URI begins with the http: or https: prefix (not shown) and continues with a string like this one:
    //myserver:8080/myproject/restservices/myService
Although you can run the deployed service during an EGL debugging session, the EGL debugger does not step into the service.
  • If the service is available in your workspace and was written in EGL, you can use a workspace URI, which is an identifier that points to a workspace location. Here is an example:
    workspace://mySourceProject/servicepackage.myService
In this case, the URI is useful only at development time, and an internal Test Server enables you to debug the code.
  • If a Rich UI application includes a Service type that will be deployed as a dedicated service, an Internal Test Server enables you to debug the code. In this case, the EGL deployment descriptor is never used. The only binding detail is the DedicatedService annotation, which is part of the service-access variable declaration. 

    If a Service part named MyServiceType is a dedicated service, the declaration might be as follows:
    myService MyServiceType {@DedicatedService}


Defining a service binding in the EGL deployment descriptor

At this writing, you can bind to a REST or EGL REST-RPC service. The distinctions among the service types are explained here: http://www.eclipse.org/edt/papers/topics/egl_soa_overview.html.  Additional information is in the help topic named "EGL support for SOA."

To define a service binding in the EGL deployment descriptor, do as follows:

  • In an EGL project, expand the EGLSource folder and double-click the deployment descriptor, which has the file extension .egldd.  
  • Click the Resource Bindings tab. The Resource Bindings Configuraton page is displayed.
  • Click the Add button and select REST Service Binding.

Bind Img8.JPG

You should give a name for your service binding. For the Base URI you can use two types of URI as the instruction in the dialog.

  • Deployed URI.

              Myhostname:8080 is your project server’s host and port number.

              “myTargetWebProject” is the project name which you want to deploy into. You can find the name in “Overview” tab of the elgdd file

              “restservices”. Fixed string. Please do NOT modify it

              “myService” : your service’s name.

  • Workspace URI

              “myServiceProject” : your project’s name.
              “myPackage.myservice”: your service’s name and its project’s name

Click Finish to complete the binding.

Use the service binding in code

In source code you can use the service binding your defined in section 3.1 as below:



mysrv mysrv ?{@Resource {}};
or
mysrv mysrv?{ @Resource { propertyFileName = “egldd file name” , bindingkey = “ REST service name”}}

Then you can call the methods in myService



Next:  Database bindings

Previous:  Resource binding introduction

[[Category: EDT]]

Back to the top