Home Products Consulting About Us White Papers Careers Contact Us Tutorials
 

 Download Delve® SOA Fast-Prototyping Toolkit (Beta 1.0)

Tutorials - How To Write A Simple Web Service
(for those who have already downloaded and installed Delve)
Page 1 of 1

In this lesson, we’ll be using the Delve SOA Fast-Prototyping Toolkit to create a simple Web service that responds a request with a message greeting a person named in that request. So, if it receives a request identifying “Rob,” it will create a response that says “Hello there Rob!"

The first step in writing our greeting service is creating the Delve project that will contain its code.

  1. Select the menu item File/New/Project.
  2. Provide the name “Greetings” for the project when prompted.
  3. Right click on the project name and choose “New Page” from the context menu.
  4. When prompted, name the page “ForGreetingService.”

The first step in writing our service is naming it. We tell Delve we’re creating a service called “GreetingService” simply by writing

  service GreetingService

the keyword “service” followed by the name of the service.

We also need to denote the end of the service, and this is accomplished using the “end” keyword. Since there’s no time like the present, let’s go ahead and add the service termination code.

 

service GreetingService

 

end GreetingService

Every service needs to have “operations,” the individual executable entities that actually get invoked by service consumers. Our service will have just one of these, named “Greet."

 

service GreetingService

  operation Greet

  end Greet

end GreetingService

To add the “Greet” operation, we’ll use the “operation” keyword and close of the operation implementation with an “end” statement.

Next we’ll need to let “Greet” know what to expect as far as input messages. There are several different ways to accomplish this, the simplest being to simply name provide a parenthesized parameter list.

 

service GreetingService

  operation Greet
    in (person-to-greet);

end Greet

end GreetingService

Our greeting operation takes only one parameter, the name of the person to greet, so we’ll place its name in parentheses following the “in” keyword.

 

service GreetingService

operation Greet
   in (person-to-greet);
   out (greeting);

end Greet

end GreetingService

The output message format is declared using “out,” followed by the name of a single output parameter, containing the text of resulting greeting.

All that’s left to is to provide the operations behavior.

 

service GreetingService

operation Greet
   in (person-to-greet);
   out (greeting);

   greeting = "Hello there " + person-to-greet + "!";
end Greet

end GreetingService

Finally, we can test our newly written service using an “invoke” statement.

  invoke GreetingService/Greet("Sally") response from-greeting-service;
write(from-greeting-service);

In Tectonic, both remotely and locally defined services are invoked in the same way.

 


 Download Delve® SOA Fast-Prototyping Toolkit (Beta 1.0)

Read a Detailed Product Description

Read About Delve and Web Services in Detail

Browse Product White Papers

 
Home Products Consulting About Us White Papers Careers Contact Us Tutorials