CentraSite Documentation : Runtime Governance with CentraSite : Important Considerations when Configuring REST or XML Virtual Services : Changing the HTTP Method of a REST or XML Request
Changing the HTTP Method of a REST or XML Request
 
The Implications of Changing HTTP Methods
Changing HTTP Methods in Requests Dynamically using a Context Variable
Sample XSLT Transformation for GET-to-POST or GET-to-PUT
When configuring a REST or XML virtual service, you specify whether to route the requests to the native service with the same HTTP method that is contained in the requests (GET, POST, PUT, PATCH, DELETE), or whether to route the requests with a different HTTP method.
Typically you want to pass each request to the native service with the same HTTP method that is contained in the request. For example, if a request contains a GET method, you allow the GET method to be passed to the native service. However, there might be rare cases in which you want to change the HTTP method of a request to different HTTP method. For example, you might want to:
*Expose an XML service as a REST service.
In this case, the service you create would be a Virtual XML service that exposes the HTTP methods GET, POST, PUT, PATCH, and DELETE, but the routing method would always be POST.
*Expose a REST service whose virtual REST service only exposes the POST method.
To change the HTTP method of a REST or XML request
*On the REST or XML virtual service, set the value of the HTTP Method field either statically (by explicitly setting the value to GET, POST, PUT, or DELETE) or dynamically (by setting the value to Use Context Variable).
In order to use the Use Context Variable option to set the field dynamically, you must write a webMethods IS service that sets a value of GET, POST, PUT, PATCH, or DELETE for a predefined context variable named ROUTING_METHOD. You need to invoke this service in the virtual service's Invoke webMethods IS Service action. For details, see Changing HTTP Methods in Requests Dynamically using a Context Variable.
Caution:  
Use this feature carefully, since changing HTTP methods to certain other HTTP methods could result in unintended results or errors.
For example, changing an inbound GET request to a DELETE request would be a serious mistake if the deletion was not intended and the native REST service actually deleted a resource when invoked with a DELETE method. Additionally, an incoming POST or PUT request cannot be translated into a GET or DELETE if the request has nested elements. For more information, see The Implications of Changing HTTP Methods.
Copyright © 2005-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback