RESTful BPEL, Part I has been edited by Alexis Midon (Jun 20, 2008).

(View changes)

Content:

This feature is not yet implemented in Ode. This is a proposal and is subject to change based on feedback, implementation experience, etc.

Invoke

The RESTfulvariant of the invoke activity replaces the attributes partnerLink/operation with resource and method. The method attribute identifies the HTTP method. All HTTP methods are supported, although this spec is only concerned with GET, POST, PUT and DELETE. The resource attribute identifies a BPELvariable of a simple type (xsd:uri, xsd:string, etc) used as the URL of the actual resource. The resource element can be used instead of the resource attribute to calculate the URL using an _expression_.

In addition to the above, the invoke activity adds a way to map values to/from HTTP headers, using a syntax similar to that for mapping message parts, but specifying the corresponding HTTP header instead. Headers mapped by the process override default values, and some headers have special handling.

The implementation shields the invoke activity from some of the details of the HTTP protocol, specifically:

  • Requests automatically follow redirects.
  • The Location and Content-Location headers are expanded to absolute URLs and will only use HTTP/HTTPS URLs.
  • Content negotiation and compression are handled automatically.
  • Proxies are handled automatically.
  • GET, PUT and DELETE requests retried automatically for certain error conditions.
  • GET requests may be cached by the engine, private caching is never shared across process instances.

This example uses the myPost variable to create a new blog post, store the response in the newPost variable, and the location of the new post in the variable newPostUrl:

invoke resource=createPostsUrl method=post
  input=myPost output=newPost
  from header=location to=newPostUrl

And to update the post:

invoke resource=newPostUrl method=put input=updatedPost

XPath functions

The use or URLs requires the ability to combine URLs with two new XPath functions:

combineUrl(base, relative)

Takes the relative URL and combines it with the base URL to return a new absolute URL. If the relative parameter is an absolute URL, returns it instead.
This function is similar to func-resolve-uri. However the latter is available in XPath 2.0 only.

composeUrl(template, [name, value]*)

composeUrl(template, pairs)

Expands the template URL by substituting place holders in the template, for example, ('/order/{id}', 'id', 5) returns '/order/5'. Substitute values are either name/value pairs passed as separate parameters, or a node-set returning elements with name mapping to value. The functions applies proper encoding to the mapped values. Undefined variables are replaced with an empty string.
This function returns an URL.

expandTemplate(template, [name, value]*)

expandTemplate(template, pairs)

Similar to composeURL but undefined variables are not replaced with an empty string. They are ignored. As a result with incomplete mapping may return a new URL template.

Reply via email to