Hello!
WebMaker seems to be what I've been searching for. Although who's going to win the name battle with Mozilla in SEO terms remains to be seen. :-)
The project I need to build has a few requirements which I'm not certain if WM can help with, so thought I'd put them out here for comment. Please forgive me if I've got the wrong WebMaker terminology, it's still new to me!
1) I need to create a server-side 'worker' controller which runs periodically (say every hour) and has no UI element to it or event trigger. It just happens on a cron-style basis.
2) The controller in Step 1 calls a remote REST web service to retrieve data, which is returned as XML.
3) Once the data from Step 2 is in the WM application I need to write it out to another remote back-end (StackMob) in JSON, again using REST.
4) A separate UI-related controller will call data from StackMob via REST, which is returned as JSON, for display in-page.
So my questions are (a) Should this be possible with WebMaker? and (b) Would it be possible for an external (i.e; outside of the WM app) application to call / access / trigger WM controllers somehow? This isn't critical, just curiosity!
I'd be interested in any links people have for 'Hello World' WebMaker tutorials, ideally written rather than video but anything's good. Ideally using WM version 5 to avoid me getting confused with how things look or were done in previous versions,
On a related note is there a PDF / easily printable version of the v5 documentation (http://www.hyfinity.net/bwmdocumentation_v5/MVC/MVC%20Overview/print.html) ? Seems linking to URLs with spaces in doesn't work well from the forum... I guess the cure would be to remove the space from the v5 documentation URL at "/MVC Overview/". ;-)
Thanks in advance for any feedback.
Steve
WebMaker seems to be what I've been searching for. Although who's going to win the name battle with Mozilla in SEO terms remains to be seen. :-)
The project I need to build has a few requirements which I'm not certain if WM can help with, so thought I'd put them out here for comment. Please forgive me if I've got the wrong WebMaker terminology, it's still new to me!
1) I need to create a server-side 'worker' controller which runs periodically (say every hour) and has no UI element to it or event trigger. It just happens on a cron-style basis.
2) The controller in Step 1 calls a remote REST web service to retrieve data, which is returned as XML.
3) Once the data from Step 2 is in the WM application I need to write it out to another remote back-end (StackMob) in JSON, again using REST.
4) A separate UI-related controller will call data from StackMob via REST, which is returned as JSON, for display in-page.
So my questions are (a) Should this be possible with WebMaker? and (b) Would it be possible for an external (i.e; outside of the WM app) application to call / access / trigger WM controllers somehow? This isn't critical, just curiosity!
I'd be interested in any links people have for 'Hello World' WebMaker tutorials, ideally written rather than video but anything's good. Ideally using WM version 5 to avoid me getting confused with how things look or were done in previous versions,
On a related note is there a PDF / easily printable version of the v5 documentation (http://www.hyfinity.net/bwmdocumentation_v5/MVC/MVC%20Overview/print.html) ? Seems linking to URLs with spaces in doesn't work well from the forum... I guess the cure would be to remove the space from the v5 documentation URL at "/MVC Overview/". ;-)
Thanks in advance for any feedback.
Steve
RE: A few general WM queries!
Welcome to the forum!
WebMaker does support calling REST services, but I think it generally deals with XML based services. I+?+?+?ve not used StackMob before, but from a quick look at its documentation it seems to be pure JSON services, so might potentially be trickier.
You can always use the Java Method option in WebMaker to handle issues, but I think there might be a better way in this case. Please give me a day or so to investigate and I will get back to you.
With regards to your other points:
1) WebMaker itself does not provide any +?+?++timer+?+?+? type functionality, but can be easily invoked from a cron job or windows scheduled task, etc. You can call a controller via a URL (as is the normal method), or via Java, or from the command line. See Independently Invoking the Platform for an example windows bat script that could be used.
2) For information on how to setup a REST service, see the REST Based Services section of the documentation. I think there are also a number of examples in the forum.
3) Converting XML data into JSON format can be done a number of ways. Take a look at this forum entry http://www.hyfinity.com/node/263 for an example of how to do this type of conversion using an XSLT.
4) You will need to convert the JSON information returned from the REST service into XML so that it can be easily displayed on the page. I think you will probably need to use a simple Java helper method to achieve this. From a quick search this seems quite simple, eg http://stackoverflow.com/a/5869811. Let me know if you need any help setting this up as a WebMaker Java Method.
For tutorial information I would recommend watching the Getting Started video if you can, as well as looking at the Hello World section of the documentation.
There are also a number of examples on the forum, but some of these might be referring to older WebMaker versions.
Out of interest, are you a BizFlow customer? If so there are some BizFlow specific tutorial documents I can link you to.
With regards to printing the documentation, are you having issues printing the +?+?++print.html+?+?+? pages? We don+?+?+?t currently provide PDF versions unfortunately.
I agree having a space in the documentation URL is not ideal, but I think you should be able to link to it ok. I think the main problem with your link is that the closing bracket has been included at the end. You can be more specific in the forum by using tags, eg [ url]http://www.hyfinity.com[/url] or [ url=http://www.hyfinity.com]Hyfinity[/url] (Without the spaces after the first [ bracket)
I hope this helps.
Please let me know if you have any further questions, and I will get back to you with more details on calling the JSON service.
Regards,
Gerard
RE: A few general WM queries!
I+?+?+?ve looked into the area of calling JSON based REST services, and apparently we have made a few changes to improve this capability that are being released with the 5.0.0.0002 patch due for the end of this month.
To help you get going with this sooner, I have attached an updated version of the xplatform.jar that contains the relevant changes. Shut down the studio, and place this updated file in the following locations within your WebMaker installation, replacing the existing versions.
<install dir>/design/tomcat-design/common/lib
<install dir>/design/blueprints/xstudio/pxp/XDE_services/Services/deploy_service/Exposed_Business_Service/jars
<install dir>/runtime/tomcat-runtime/common/lib
(Update 29-08-2013: The 5.0.0.0002 patch has now been released, and so to avoid confusion I have removed the xplatform.jar attachment from this post. Please install this patch when prompted upon starting up the studio to make use of the functionality discussed below.)
With this change, when you call a service that returns non XML content, you will now automatically see the content returned within a +?+?++<non_xml_content>+?+?+? element in the factbase.
If you are calling a service to which you need to send a non XML message, then you need to ensure that you set the correct +?+?++Content-Type+?+?+? attribute in the xgate HttpHeader block described in the documentation http://www.hyfinity.net/mvcdocumentation_v5/Morphyc/XDE%20User%20Guide/Rest%20Based%20Services.html. With this set, the text contents of the root element of the document will actually be used as the request message.
So for example, to send a json request, you may use the following type of actions in your controller:
Insert <json_request> element containing the JSON string to send.
Insert the HttpHeader config fragment as a child of json_request, indicating the correct +?+?++application/json+?+?+? content type.
Use Invoke Service to send the json_request to the remote service proxy node.
With your specific requirements, the other area that might need some custom work is to do with converting the JSON responses into XML and vice versa. To help with this, I have created a couple of simple java methods that you can use from the Java Method action in the rules. These are contained within the attached json.jar file, which also includes a compiled copy of the Java JSON library from http://www.json.org/java/
The method names are com.hyfinity.utils.JSONUtils.jsonToXml and com.hyfinity.utils.JSONUtils.xmlToJson, and as an example, to use this to convert a JSON string you could use an action setup like shown below:
I hope this all makes sense.
With these areas covered, I don+?+?+?t think you should have any problems achieving the requirements you listed, but please let me know how you get on, or if you have any further questions.
Regards,
Gerard