WSO2 EI Rest Api - Implement Custom handler class - wso2

When i try to add Handler class into my Rest API
it works after it was compiled
when i need to edit it Handler class statement is disappeared
But it is worked inside
What is the problem?
It is creating handler class and save it successfully
After this when i click again edit api, its gone

In EI AFAIR, this wasn't supported in UI rendering view however if its saved it will work properly. Also you might use the Integration Studio to create the API, then there won't be such issues.

It is not shown in management console source or design view, but if you view in folders like:
EI-Home/repository/deployment/server/synapse-configs/default/apis/your API
…the handler is present in code.

Related

How to dispatch an action to the redux-devtools store for importing a state from a component?

I'm currently trying to implement a panel integrated in my angular application which will allow me to import whatever json state file exported from redux-devtools using the same import feature as redux-devtools.
My application is properly integrated with #ngrx/store-devtools.
I can't figure out how to retrieve the devtools store from my component to then dispatch the action IMPORT_STATE as i saw on redux-devtools code:
store.liftedStore.dispatch({type: 'IMPORT_STATE', ...nextLiftedState});
The goal is to manually trigger the import state feature from redux-devtools but within a component of my application directly.
Is it possible to do that? And how to inject this store in my component to then use it?
Thanks in advance,
EDIT:
Actually, what i am trying to achieve is to have a component in my application which allows me to import different state (as json file) that i would have previously recorded from the redux-devtools extension to reach any pages of my application. Thus, this component needs to access to the redux-devtools store and dispatch the action IMPORT_STATE. What i did for the moment seems to not trigger the reducer for IMPORT_STATE action of the redux-devtools store. I think i'm missing something to include the redux-devtools store from the angular application.
Do you have any idea of how to achieve that?
Thanks in advance,
To dispatch into the store from the dispatcher in the redux devtools you just enter in the action definition as json and then click dispatch.
for example:
{
type: 'IMPORT_STATE',
... whatever payload contents you need here ...
}
To open the dispatcher, click the little keyboard button in the middle at the bottom of the devtools.

Affecting a page from a class in wp7

I'm calling a web service in a class and needs the result in some page in my project. How could I execute something in my page when the event in that class is fired? note: the calling is asynchronous.
You can do it easily using INotifyPropertyChanged in your view model. Simply bind the view model to your page and when anything changes in the background (e.g. asynchronously), the view should be updated.
Try to use MVVM in your applications and you will be good to go. Also, note you can place view model globally in the App class. This will make it easy to update from one place since everyone has access to App.

Correct way of initializing internal data for API in Django with Piston/Django-tastypie vs jsonrpc

After some API implementations, using jsonrpclib in Python, I need to migrate them inside a Django Framework project. I am quite new in Django and Piston/tastypie, but have some experience using jsonrpc/xmlrpc libs in my Python apps.
Until now I have developed some modules, with a ServiceClass attached to the register of jsonrpc server who handle the request and call the methods in the ServiceClass.
When the class is attached to the register, a new instance of the ServiceClass is created, loading all the initial data and keeping it in memory, so every method called through jsonrpc can have access to the internal values in that instance.
Now, I am trying to do the same in Django with Piston or Tastypie. I followed this link http://www.robertshady.com/content/creating-very-basic-api-using-python-django-and-piston and other resources, and all the documentation I read is clear, showing the correct way to work with it:
Modify url.py to map requests like "/api/" to a specific handler.
Add a handler.py in the api application, extending the BaseHandler of
Piston/Tastypie.
So I am wondering if its the correct way of working with Django and APIs, to create the instance of my ServiceClass (init the data, provide the methods) inside handler.py when I create the instance of the Handler extending the BaseHandler. Is this Handler class instantiated once when the server starts? What if my ServiceClass relies on some Model to load the data from it?
I want to avoid the framework to instantiate my class everytime a new request arrive to the /api/ application.
I will be glad to hear about any recommendation,
Thanks,
Specifically for piston... You shouldnt really use the handler in terms of an instance. Its more like a metaclass that you set up with class attributes. These attributes control whicch model the handler will be bound to if any. And what fields it should show or what methods it supports.
Generally the request enter one of your methods and you then handle the request however you want, as an isolated state. If it needs to use a shared resource or use the model for queries, that part is up to you, being shared from some imported resource . You said you need a model which is why you would bind it to the handler as a class attribute and then query on it. You shouldnt really store state on the handler.

Registering an achivement

I'm trying to learn about facbeook achievements, so i made the achivement URL but now when i'm trying to register it i'm getting :
"(#15) This method is not supported for native apps",
i comlpetely removed the native iOS section from my app's definition on facebook but it still won't let me register. any ideas?
Oded
See the following links:
creating test users - method is not supported for native application
http://forum.developers.facebook.net/viewtopic.php?id=90782
Also ensure your app is registered as a "game".

How to call a webservice programmatically in asp.net

How to call webservice programmatically in asp.net without using add web reference?
My webservice url keeps on changing. Hence i need to capture the url at runtime and display the results.
Please advice.
You can change the URL of a web-reference at runtime (provided that the new address is hosting a service with the same schema that you originally used to create the reference):
MyWebService ms = new MyWebService();
ms.Url = "http://example.com/webservice.asmx";
ms.MyWebMethod();
Web References are definitely the way to go - whilst the classes that are created by the web reference are usually pretty heavy, all that strong typing makes it well worth your while.
you need to do the following steps.
PreReq :
First of all, you know the URL of web service.
Solution:
use wsdl.exe to create a proxy class and than compile it.
wsdl /out:myProxyClass.cs http://hostServer/WebserviceRoot/WebServiceName.asmx?WSDL
(there are other switches available
for wsdl. For Example to generate VB
class, you need to add switch
/language:VB)
Once your proxy class is generated you can easily consume in code.
MyProxyClass objService = new MyProxyClass();
DateTime time = objService.GetServerTime(); //Suppose service has method getServerTime
You can specify the end-point URL as part of the constructor of your client-side proxy class.
If you don't need to specify it during runtime then it can also be set in your web.config file.
Where are you trying to call the service and where the service file is located?
If the service is located on the same site. Why not just instantiate the class name from the service. Or just create a separate class and use interface