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
The use or URLs requires the ability to combine URLs with two new XPath functions:
combine-url(base, relative) and
compose-url(template, [name, value]*) /
compose-url(template, pairs). See xpath extensions for details.