call a workflow service from jquery - json

How can I call a windows workflow 4 service from jquery? I see, there is a soap protocol used. How can I convert this to get a json output from js? I have never used a wcf, so I don't know, maybe this is a trivial to do.

Related

Mock a web server for ajax in IntelliJ environment

IntelliJ can deploy HTML/JS code at localhost:63342 on the fly. I can see how the frontend behaves immediately.
Now I have a web application.
http://localhost:8080/frontend
http://localhost:8080/backend
The frontend will fetch data from its backend. Now I cannot start a real backend at localhost:63342. How can mock some ajax response at localhost:63342. Is there any magic plugin of IntelliJ can help?
My current solution is put all ajax call in an Angular service module and replace it with a mocked service module. I believe there must be some better solutions.
If you want to mock up some endpoints for you to test with I would suggest you use Mockjax. This will allow you to do exactly what you want and you won't have to run two separate apps to do so. I'm not familiar with IntelliJ, but Mockjax only has a dependency on jQuery and you should be able to easily set it up with any project that at least uses jQuery.

Creating WSO2 BPEL project for JSON webservices

I have the WSO2 Developer Studio Eclipse Plugin downloaded. And I was looking at this tutorial: http://wso2.com/library/tutorials/2010/07/eclipse-bpel-designer-wso2bps-tutorial/. But it seems to be talking about using SOAP. But my webservices, which are written in PHP(in live servers) are REST using JSON. Accepts data via HTTP GET methods by these webservices and respond back with JSON data.
So how will I implement a BPEL project making use of the JSON webservices? Any ideas or suggestion? Am completely new to this. Thank you.
EDIT
When I created the BPEL Process, I have used HTTP from the dropdown instead of SOAP
WSO2 uses a custom variant of the Apache ODE engine for executing BPEL processes. ODE provides extensions for REST, which you can try out. However, I am not sure if these extensions also support JSON or if they just allow XML data. Also have a look at this answer.

Angular.js : CORS HttpInterceptor that transforms $http.get into $http.jsonp request transparently

I've been looking into if it's possible to create a web based version of my Chrome Plugin
now that it's relying completely on Trakt.TV's JSON API.
According to angular's documentation, it's possible to intercept HTTP requests at several levels, one is the HTTP Backend itself (mainly used for testing though) and the other is HTTPInterceptor.get
The basic idea is to wrap calls to Trakt.TV's JSONP api through http://json2jsonp.com/ and have them returned transparently to get around cross site scripting restrictions. This would not only be very useful for my own project, but for a lot of other people daeling with the same issues too (therefore i'll release the module after it's done, but I want to do it properly)
The basics should be simple:
Hook the $http.get request at the right level
Overwrite the original request made
Cancel an optional other request already set up
Hook it through $http.jsonp(http://json2jsonp.com/)
Return the original promise's success/fail when done
Questions:
Has anyone built anything like this yet? (Github searches revealed nothing)
Would you suggest using the HTTPBackend or the HTTPInterceptor?
why can't you just use the jsonp helper function?
httpBakend is a mockup service to fake a backend server is not used on live code. http interceptors would do what you want you just need to attach the callback function name to your request if the url contains what ever name you want to filter and then in the response interceptor you have to pass response to the callback function so the json to be evaluated. be aware that interceptors will inspect every request makde by angular which is not very eficien, unless you are only doing calls to the tv service.
like i said before a better approach is to use $http.jsonp function
https://docs.angularjs.org/api/ng/service/$http#jsonp
a word about interceptors they need to be defined as services and then be passed to HttpProvider during your apps configuration.

Json parsing in IBM Worklight

I am trying to achieve something like which is mentioned in this link
but i don't know whereto write the parsing code. I tried to write it in new method and added the method in "my adapter.xml" but nothing happens. I even don't know how to log in IBM WorkLight. I used WL.logger(some) but its throwing error that "Logger can not be called on an object".
Any help would be appreciated. Thanks in advance.!
In most cases you don't need to manually parse responses because WL adapter framework will do this for you. Anything you retrieve via WL.Server.invokeHttp API will be parsed to JSON automatically unless you specify returnedContentType:"plain". In case you DO need to manually parse JSON you can use JSON.parse() and JSON.stringify() APIs.
Server side logging is achieved via WL.Logger.debug/error/info etc. You can get more info about it here
You don't have to parse JSON data, there are libraries in Javascript to do that. Try JSON.parse(). You should learning how to write adapters and invoking them from clients. The Getting Started modules are a good place to start, specifically Module 4 in your case.

Flex, using navigateToURL to send an AMF object and open the response in a new window

I have an application that connects to an AMF gateway exclusively (in a certain mode) and I have a service that renders some HTML that I want to display in a new window outside of the Flex application.
Is it possible, in Flex, to use navigateToURL to send an AMF object and open the response in a new window?
EDIT: More specifically, does anyone have insight into how an AMF request can be properly constructed in actionscript and sent via the POST data of a URLRequest?
UPDATE: Still looking for a clear spec for AMF that makes it obvious how to construct the service call related headers in AMF and what headers are required. Some guidance in this area would be helpful. I've done more reading and have seen some people talk about some custom solutions they have that work in a similar way to what I've mentioned above, although it seems like those solutions are guarded assets. But this further enforces my belief that this is quite possible.
I'd say no... Even if you could create an AMF packet by hand in AS3, how would you pass it to the URL using navigateToURL? How would the browser know how to handle the AMF values returned from your service call?
I suggest you call the AMF gateway service in your Flash app; do the processing that needs done; and then return a URL to the results. In the result handler method, you can open the URL using navigateToURL.
#Flextras is along the right lines - the AMF gateway in particular with AMFPHP isn't used with a URLRequest, instead you use the RPC remoting - most typically RemoteObject where you specify the receiving gateway (ie: endpoint or more generically the destination channel - but this one needs to be in your services-config which resides on the server), and you typically assign a responder to handle the result/failure events (in which your response is almost always a class marked as a [RemoteAlias]).
See: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/rpc/remoting/mxml/RemoteObject.html#includeExamplesSummary