Print PRINT
PDF

Restful Service in webMethods


RESTful service is supported by version 9.x version,if you are using older version then you need an upgrade.  To support it in older version, you can use the service invoke method to simulate the RESTful
service call, use the URL localhost:5555/invoke/folderName.subFold...&variable=value, but you need to do some additional work like variable parsing, result formatting.
Refer below SAG link to know more about restful services:
documentation.softwareag.com/webmethods/...Developers_Guide.pdf

For brief approach follow the below process via developer and flow services.
A rest service call coming into the Integration Server with an HTTP Post request to http://:5555/invoke/TestRest.pub/event with a type ofapplication/xml in UTF-8.

  1. write a flow service in TestRest/rest/pub called event.  
  2. create an input parameter of contentStream with an object type.
  3. call pub.io:streamToString to convert the contentStream to a string
  4. Then call pub.xml:xmlStringToXMLNode to create the XML node.
  5. At last calle pub.xml:xmlNodeToDocument to finally convert to a webmethods document.

It should look something like this. 



Now you have a webmethods document from your rest service interface.


URL Parameters

If you need to take a rest service input that uses URL parameters, you can still get to them.  Say you have a url likehttp://:5555/invoke/TestRest.rest.pub/event_change/98765 where 98765 is the event_id.  


Write the service as above, but add in a call to pub.flow:getTransportInfo.  The requestURL returned will contain the service name and the parameters at the end of the url, so you can parse them out.   


/invoke/TestRest.rest.pub/event_change/98765

Response Values

You can also writer response values defining it in your output to send the http status and message back to the caller.  Use pub.flow:setResponseCode to explicitly set the response values.  Otherwise defaults are chosen for you.
Comments (0)Add Comment

Write comment
You must be logged in to post a comment. Please register if you do not have an account yet.

busy