rpc lib for blackberry / j2me ( json / xml / * ) - json

I'm trying to setup an rpc server so that a blackberry mobile app can make calls to it. Thought of trying out json first.
I've setup a working server side impl using http://jsonrpcphp.org/ .
Couldn't find any direct libs for blackberry/j2me. android-json-rpc looked interesting, but the blackberry SDK complains
"The type java.net.URI cannot be resolved. It is indirectly referenced from required .class files" at this line
HttpPost request = new HttpPost(serviceUri);
I'm using v4.1 of apache http core and client to make android-json-rpc work.
Looks like the URI class isn't bundled with the j2me/blackberry standard lib.
Is there a quick and dirty way to get rpc working on blackberry ? I don't mind xml or any thing else for the encoding, http is the transport I'm interested in.

BlackBerry 6 has built-in the JSON parser and some better APIs for making HTTP requests. Prior to that, though, you have to compile the JSON parser into your app and use the Java ME HttpConnection class to make and get the HTTP requests. So it depends what version you're targeting.

If you are targeting to < BB OS 6.0 devices.
You can also use org.json.me lib in your app.
Here is the sample named Implementing JSON in your application. It's very simple to use.
Good luck

Related

Is there any added advantage of using djangorestframework over JsonResponse?

I am new to Django and API creation. I am trying to figure out if it is better to use djangorestframework or just use JsonResponse. I got the suggestion of djangorestframework from Digital Ocean's tutorial but also found out about JsonResponse, which seems simpler given that I don't have to install another package.
Goal: I would like to be able to provide user information for both web and mobile applications.
I see that there are some reasons provided on this post for djangorestframework, which I pasted below for posteriority.
The common cases for using DRF are:
1)You're creating a public-facing external API for third-party
developers to access the data in your site, and you want to output
JSON they can use in their apps rather than HTML.
2)You're doing mobile development and you want your mobile app to make
GET/PUT/POST requests to a Django backend, and then have your backend
output data (usually as JSON) to the mobile app. Since you don't want
to pass back HTML to the mobile app, you use DRF to effectively create
a REST API that your mobile app can call.
3)You're creating a web app, but you don't want to use the Django
templating language. Instead you want to use the Django ORM but output
everything as JSON and have your frontend created by a JavaScript MVC
framework such as React, Backbone, AngularJS, etc. In those cases, you
can use DRF to output JSON that the JavaScript framework can process.
DRF basically provides you many features to make APIs that you don't have in raw django.
for example:
Serializers: a declarative way(django style like declaring models) of making serializers, when you use JsonResponse you have to tell everywhere what to serialize, with the serializer you have to import it and just use it, also this serializers can be able to save/update objects too. Also support ORM source to connect yours models(think how difficult would be serialize a model with nested relations with JsonResponse).
The Web browsable API, you can see all the availables endpoints.
Third party packages to install and use: https://www.django-rest-framework.org/community/third-party-packages/#existing-third-party-packages.

Servicestack migration to core, fallback router and HandlerFactoryPath

Im migrating my code to a core application.
So far so good. i got it all running, but there is one problem.
I had a ui (with razor) and using the CatchAllHandlers. And for the api i used HandlerFactoryPath to prefix the urls.
Now i have 2 problems:
It seems CatchAllHandlers isn't used?
Route is only processed if route starts with HandlerFactoryPath?
The second issue is fixable but how would i go around the first one?
Do i make my own middle-ware or does servicestack support other ways of doing this?
CatchAllHandlers are executed in .NET Core, it's also what ServiceStack's new MVC RazorFormat uses to process Content Pages.
Specifying a HandlerFactoryPath, e.g:
SetConfig(new HostConfig {
HandlerFactoryPath = "api"
});
Tells ServiceStack that you only want to listen to requests from the /api path info. All other requests are passed through ServiceStack who calls the next module in .NET Core pipeline as per .NET Core's convention when it's not configured to handle a route.
Not sure if it's relevant to your solution but in ServiceStack .NET Core you can register a ServiceStack Handler in .NET Core module pipeline so you could for instance return a /default.cshtml Content Razor Page for each request that's not handled by ServiceStack, by registering it after ServiceStack:
app.UseServiceStack(new AppHost());
app.Use(new RazorHandler("/default"));

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.

Can Worklight http adapter load open data format like JSON , xml, csv?

I have a open data link below
http://data.ntpc.gov.tw/NTPC/od/data/api/IMC14?$format=xml
How to create worklight http adapter get json object? Then using json object let it to dojo mobile!
I have ever see a example using jquery link to open data api. But not ever see using dojo mobile link open data.
Yes. Read the Getting Started modules and try the code samples. Specifically I would recommend:
Adapter framework overview
HTTP adapter – Communicating with HTTP back-end systems
Invoking adapter procedures from client applications.
Also take a look at the documentation here. There's an example with Worklight + Dojo Mobile here.

reading JSON on Blackberry OS pre 6.0

I am trying to implement web services within an app, and the response of the web serivce is in JSON. How is it possible to parse simple json without net_rim_json_org module of BBOS 6.0?
For pre-6 BB OS people use JSON ME lib.