REST implementation on Integration Server

How can we implement REST on webMethods?

You can use the pub.client:http service (WmPublic-package) to do a REST-call. There’s no built in service specifically for REST in webMethods as far as I know. pub.client:http has been sufficient for my REST needs.

REST is an architectural style, not a technology. The mere use of HTTP does not mean one is following the REST principles.

Version 8.2 added some facilities to make doing some things in a REST way easier, but just using those features alone won’t lead you to REST either. Review the docs on the SAG site.

They now have a document titled “REST Developer’s Guide.” It has a reasonable description of what REST is and how an interface can properly support the principles. However, it too suffers from common misconceptions: “To be REST-compliant, an application must support the HTTP GET, POST, PUT, and DELETE methods.” This is simply not true. REST does not require the support of particular HTTP actions nor does it even require the use of HTTP.

1 Like

Hi,
I need to create a web service using REST style.
As in my client should be able to send the data through the URL provided by us.
Can somebody please shed some more light on how to create web services in webmehods that use REST and not SOAP ?

Regards,
Priya

Hi,

Can somebody pls help in defining how to create alias for the rest service that can be given to the client ?
Fo example we would want to hide the server url etc.

The URL ALias option only gives a way to define url for services and files withing packages.

Can anybosy pls throw some light ?

Thanks,
Priya

Hi,

I tried an ex in 8.2 , created _get flow service in one folder in ex: I created under temp/services folder (which gives one string as an output). You can invoke from browser as.

http://host:port/rest/temp/services/_get
Hope it will be helpful.

Also I have tried this option which it didn’t work;

watt.server.RESTDirective=process
http://host:port/process/temp/services/_get → Didn’t work. pls share your views.

  • Sam

did you try the one at the link:

I have tried this from ReST developers guide - watt.server.RESTDIRECTIVE=Process
But I see no result from this

The guide is not up to the expectations. Did you explore the links posted in this topic.

You may share your requirements here.

If I want to use different directive other than ‘rest’ what should I change in Server settings?

I tried watt.server.RESTDIRECTIVE=Process which does not work

http://localhost:port/process/folder.subfolder:flowservice – this didnt give the desired output and 405 error has come up

Try

http://localhost:port/Process/folder/subfolder/flowservice

When it comes to REST, you should omit the service name from the URL. In other words, instead of:

http://://.:

… your URL should be:

http://://.

Percio

hai frnds,
I am trying to consume rest API https://itunes.apple.com/search? it is a search API provided by Apple to search on itunes store. I consumed this API successfully by using pub.client.http. but when I am trying to retrieve some results from this API by passing a URL like this
https://itunes.apple.com/search?term=james bond&country=us&media=movie&entity=movie
its throwing an error Invalid symbols on the index. So help me out how to retrieve the results for the above query from the search API.

webMethods Integration Server
Version 8.0.1.0

Naveen,

The problem is that your URL is not encoded so the space between “james” and “bond” is causing the error. Either encode the URL first, or better yet, use one of the fields in the data input document to pass in your arguments.

Attached is a screenshot with an example on using data/args to pass in arguments to this service.

Percio

Thanks Percio

It worked when i set the arguments.but the result of that API is in JSON format.just i wanna how to know how to read the JSON format result from the webmethods.

Hi guys,

Exposing Rest API with IS using the Rest Resources and the httpClient for consuming Rest API. But you can use JSON input, output easily without any transformation from Document-Type to JSON for example. The JSON handler of the IntegrationServer takes care of that with passing headers (Content-Type=application/json and Accept=application/json headers) and automatically convert the JSON to IData structure.

I hope it can help you.

Ismael

Ismael,

Yes, that’s true when you’re the provider. In this case, however, Naveen is the consumer.

Naveen,

One way is to set the loadAs input variable to “stream” on the call to pub.client:http. Then call the service pub.json:jsonStreamToDocument and map body/bytes, returned by the http service, to the jsonStream input variable. This should get you the JSON data parsed as an IS document.

Percio

1 Like

Hello,

I’m currently introducing REST into our Integration Server infrastructure myself and I’ve written a step-by-step guide for creating a REST service in Integration Server: How to create a REST service in webMethods Integration Server. Please let me know, if it helps or if you have anything to add to it.

I’ll add some more articles in the upcoming weeks, e.g. how to call the REST service from Java or how to configure a clean URL with a URL Alias.

Best regards,
Stefan

1 Like

Hi all,

After reading this post I have some doubts regarding the design / implementation of REST services. :slight_smile:

From my point of view, there are two ways to design/implement REST resources in Integration server 9.10.
First option, could be create a new REST Resource and select only the methods we want to implement. (As explained in the REST Developers Guide)
Advantages:

  • Best choice if you want to implement only one or two methods.
  • Recommended option in the REST Developers Guide.

Disadvantages:

  • Duplicate code if you want to implement several methods and you have some pieces of code that you want to execute always, for example specific logging flow Services, or commong error handling flow services…

Second option could be create a new REST Resource with only a Default service/method. So, you can include inside a branch to call GET, PUT, POST, PATCH, or DELETE methods logic.

  • You have to create the Default method if you want to implement PATCH

Advantages:

  • Reuse of code. (logging, error handling)…
  • You can use PATCH.
  • Less flow Services in the Integation Server (memory save)

Disadvantages:

  • Not very useful if you only have to implement one method.

Finally, after all this brick that probably bored you :slight_smile: , anybody could add some advantage/disadvantage regarding the first or the second opcion.
Maybe I´m wrong and the second option is always a bad option for reasons unknown to me.

Thanks all and best regards!
Diego