The details below are out of date, and the videos may no longer play in your browser.
For up to date guidance on calling REST services using WebMaker please refer to the Documentation
---------------
Create a web service proxy to represent the actual URI of the REST service.
http://www.hyfinity.net/HowTo/rest_service/service_proxy/service_proxy.htm
Create the application map to connect a search page to a server controller that will call the REST service.
http://www.hyfinity.net/HowTo/rest_service/app_map/app_map.htm
Add detail to the search page to allow capture of the search string and the ability to submit the search request to the server.
http://www.hyfinity.net/HowTo/rest_service/search_page/search_page.htm
Add rules to the server controller to enable a dynamic call to the REST service.
http://www.hyfinity.net/HowTo/rest_service/search_controller/search_controller.htm
Run and view the request to the REST service and the actual response details.
http://www.hyfinity.net/HowTo/rest_service/calling_the_service/calling_the_service.htm
Create a page to render the actual search results returned by the REST service.
http://www.hyfinity.net/HowTo/rest_service/search_results/search_results.htm
You can download a WebMaker export of the above examples from the following link:
http://www.hyfinity.net/HowTo/rest_service/rest_export.zip
For up to date guidance on calling REST services using WebMaker please refer to the Documentation
---------------
Create a web service proxy to represent the actual URI of the REST service.
http://www.hyfinity.net/HowTo/rest_service/service_proxy/service_proxy.htm
Create the application map to connect a search page to a server controller that will call the REST service.
http://www.hyfinity.net/HowTo/rest_service/app_map/app_map.htm
Add detail to the search page to allow capture of the search string and the ability to submit the search request to the server.
http://www.hyfinity.net/HowTo/rest_service/search_page/search_page.htm
Add rules to the server controller to enable a dynamic call to the REST service.
http://www.hyfinity.net/HowTo/rest_service/search_controller/search_controller.htm
Run and view the request to the REST service and the actual response details.
http://www.hyfinity.net/HowTo/rest_service/calling_the_service/calling_the_service.htm
Create a page to render the actual search results returned by the REST service.
http://www.hyfinity.net/HowTo/rest_service/search_results/search_results.htm
You can download a WebMaker export of the above examples from the following link:
http://www.hyfinity.net/HowTo/rest_service/rest_export.zip
RE: How do I call a REST service?
This example has been a big help for integrating with REST services.
I am attempting to bind form data to an entity and do a POST via the REST call. I've put the POST command in the request method for the xg:url element. It seems that "from" and "to" XPaths would be reversed from the GET to the service in the rule that executes the Invoke Service.
I am connecting to the service, but getting a 415 response code. Probably the xml for the form data is not getting into the request properly. However, I do see the form data in the messages from the log monitor.
I may still need to tweak the URL for the call. In the meantime, do you have any hints on getting the rules set up for a POST?
Thank you,
Mike
RE: How do I call a REST service?
We'll need a bit more info, but I'm slightly confused by the reversal of the from and to xpaths. The from xpath determines the fragment that will be sent to the remote service and may be this is getting confused. WebMaker should remove the xg:HttpHeader fragment before POST, so don't worry about this fragment being within the mvc :D ata fragment.
You should be able to see the exact fragment that is being sent if you look at the correct location using the Dashboard. Please ensure you are looking at the service call lines that are coloured salmon pink'ish.
Kind Regards
Abdul
RE: How do I call a REST service?
Ah, that clarifies things a bit. So the to path is where the response is placed. OK. Do I place the content to be POSTed as a child of the xg:HttpHeader or the xg:params or am I way off?
Thank you,
Mike
RE: How do I call a REST service?
Yes, the to xpath is where the response is placed. The from xpath indicates the fragment to send to the service, which means it can be any part of your factbase, e.g. /mvc :D ata or /mvc :D ata/yourDataToSend/etc/etc.
Therefore, the data to send does not have to reside within xg:HttpHeader. Actually, xg:HttpHeader will reside somewhere within the fragment indicated by the from xpath, so make sure the from xpath does not exclude the xg:HttpHeader fragment. WebMaker uses the xg:HttpHeader to compose the service call and then removes it, leaving the fragment to send as indicated by the from xpath minus the xg:HttpHeader fragment.
I hope this helps.
Kind Regards
Abdul
RE: How do I call a REST service?
After some of noodling, it appears that the POST working.
It's throwing an error in the logs for a response 201. Maybe the to location is not acceptable. Anyway, your assistance is very much appreciated.
Thank you,
Mike
RE: How do I call a REST service?
That sounds promising. The to location is not an issue because this is only used to place the well-formed response xml document after a successful HTTP 200 code from the service.
I think the 201 code is indicating success, but WebMaker unfortunately currently classifies only 200 as a success. You can therefore ignore the 201 code for now and carry on if possible. I have looked into the 201 code a bit more and it suggests that a URI of the newly created resource is returned, which WebMaker will not make available.
Therefore, depending on exactly what you are trying to do with the REST service and the sequence of behaviour you may me okay. So, for example, if you are creating a resource on the server using the post and then have another means of getting the URI for this new resource, either via another service call or database lookup for example then you should be okay. Also, you may not need the URI at all because you simply need to know that the POST has been successful, which the 201 code is actually indicating, although WebMaker unfortunately wraps this in a generic error. But, if you need the URI immediately after the POST to create the resource and you have no other way to get to it then there is an issue.
I may be able to help further if you share some details at a high-level about the sequence of service calls you are making and the purpose of the calls. Also, are you using some public/third party services or are the services your own?
Kind Regards
Abdul
RE: How do I call a REST service?
Sounds good. I was prototyping the calls to a small database with a Jersey-implemented REST interface, just to get the Webmaker mechanics ironed out.
We have not specified the details of our systems integration, but the intent is to eventually interact with internal corporate services.
Thanks again,
Mike
RE: How do I call a REST service?
The example helped me to understand general idea of how to use restful web services in WebMaker.
But I am getting an error when to test the example.
An unexpected error occurred while trying to call the remote service. Error Cause: Cannot parse response. Most likely cause is empty or non-structured payload: http://search.twitter.com/search.atom?q=BizFlow&rpp=2 Request: URL=http://search.twitter.com/search.atom?q=BizFlow&rpp=2 Action= RequestMethod=GET Header Allowed=true Header Exists=true Security Info=false Header Attribs=
I attached log.txt for details.
Thanks,
Taeho
RE: How do I call a REST service?
Good to hear from you. Nice juicy game coming up for you this weekend :)
I think Twitter changed the way this service works, related to the way they process cookies. If I remember correctly the cookie processing in the HTTP Header needs a modification in WebMaker to handle this change. Unfortunately this has not been prioritised as a future change yet and I haven't looked into this example for a while.
Is this something you are specifically looking to use for a project or just learning?
Kind Regards
Abdul
RE: How do I call a REST service?
Taeho
Use SOAPUI to get the call working as you'd expect and then use the request header to back stitch into WM. I also used Fiddler to track the traffic whilst debugging in SOAPUI to make it a little easier to find what was needed for WM.
Paul
RE: How do I call a REST service?
Thank you,
Mike
RE: How do I call a REST service?
When you call the REST service proxy from your Controller that contains the xg:HttpHeader element, you specify the from location. This is the same as any other service call. This from location can identify any element in your factbase, e.g. / or /mvc:eForm/mvc :D ata, etc.
In your scenario, ensure that the fragment you are identifying in the from location still includes the xg:HttpHeader element. WebMaker uses the information in the xg:HttpHeader element to package up all necessary headers and the payload, depending on the configuration specified in your xg:HttpHeader fragment.
WebMaker should 'strip out' the xg:HttpHeader element before posting to your REST service. So, if you wanted to send a data block named /mvc:eForm/mvc :D ata/myRESTdata then ensure xg:HttpHeader resides within /mvc :D ata/myRESTdata and you can then specify /mvc:eForm/mvc :D ata/myRESTdata in your from location.
I'm unsure exactly where your problems occur, but you could try using some of the lower level tools mentioned earlier in this post to trace the payload that leaves WebMaker.
You could also try the POST method to see if there are any differences at the receiving end of your invocation.
Hope this helps. Let me know how you get on and I'll have a look at it in a bit more detail for you.
Kind Regards
Abdul
RE: How do I call a REST service?
That helped us. We're now successfully PUT-ing and DELETE-ing. Thank you.
Regards,
Mike
RE: How do I call a REST service?
We are reviewing the links provided in this thread: "How do I call a REST service? "
http://www.hyfinity.net/HowTo/rest_servi..._proxy.htm
Create the application map to connect a search page to a server controller that will call the REST service.
http://www.hyfinity.net/HowTo/rest_servi...pp_map.htm
Add detail to the search page to allow capture of the search string and the ability to submit the search request to the server.
http://www.hyfinity.net/HowTo/rest_servi...h_page.htm
Add rules to the server controller to enable a dynamic call to the REST service.
http://www.hyfinity.net/HowTo/rest_servi...roller.htm
Run and view the request to the REST service and the actual response details.
http://www.hyfinity.net/HowTo/rest_servi...ervice.htm
Create a page to render the actual search results returned by the REST service.
http://www.hyfinity.net/HowTo/rest_servi...esults.htm
Unfortunately they are not longer available.
Its there a plan to update them or do you know why those was removed?
Regards
Ivan
RE: How do I call a REST service?
Hi Ivan,
My apologies for the problems you+?+?+?ve had with these links.
We did have an issue with these, but it should now be resolved, and the links from the first post in this thread should be working correctly.
I do want to point out that these videos are quite old now though, and are based on an earlier WebMaker version. The overall approach is still valid, but the screen layout etc has changed.
You should be able to find some more up to date information by looking at the details shown when selecting the REST icon from the Data Source tab on Page Design within the studio, or from the REST Services page of the documentation: http://www.hyfinity.com/docs/hyfinity/v9/Platform/XMLControllers/REST%20Services.html
Regards,
Gerard