w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to create Liferay JSON web service for existing tables?
Neat trick if you don't want to define a new entity with servicebuilder: Just leave the entity empty, this defines just a type, but no fields, e.g. no underlying table. Then implement your methods by just delegating to whatever persistence you'd like to access (or even without any persistence). <Entity name="Foo" local-service="true" remote-service="true"> </Entity> This will create FooServiceImpl and FooLocalServiceImpl that you can use to implement your business logic, without any attached database table.

Categories : Json

Liferay Service Builder like tools
Minuteproject provides reverse-engineering starting from the database for couples of technologies (backend and front-end) If you come from Liferay, I advise you to check minuteproject 4 Openxava, that generates CRUD from database and also liferay portlets. You can also check among 15+ target technologies and run demo

Categories : Java

Calling liferay portlet as web service with REST API
After a long hours on the internet I found the answer to be very crisply written(follow the link below) with some code samples and apt explanations. I found this useful. When I am done with my complete code I will also post that for everyone's benefit :) http://www.liferay.com/web/pradip.bhatt/blog/-/blogs/integrate-jersey-restful-with-portlet-project

Categories : Web Services

Custom Liferay service function failing to openSession()
Try this code @Override public List<MBMessagesAsDiscussionPrime> findByGroupId() throws SystemException { Session session = null; try { session = openSession(); //other stuff here, eventually... } catch (Exception e) { throw new SystemException(e); } } HTH

Categories : Java

Liferay ajax request and JSON response
You can send person id from jsp using ajax request and you can fetch data inside controller(serveResource method) i.e You need to create URL <portlet:resourceURL var="resourceURL" > </portlet:resourceURL> Ajax Call $.ajax({ url : '${resourceURL}', data : data,//person id to sent type: 'POST', dataType : "json", success : function(data) { // get person data back from controller } }); Controller part public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) { //get person id using getparameter JSONObject json = JSONFactoryUtil.createJSONObject(); json.put("jsonData", "person details"); response.getWriter().write(json.toString()); } HTH

Categories : Jquery

recommed folder structure for liferay maven project using liferay developer studio
To answer your questions You don't need plugins-sdk at all! I advice you to go for a multi module maven project, and I already see you using it. Obviously when you go for a multi-module project you have the sub-folders created and each module corresponds to a separate archetype and of course, it depends on what type of project you create. Here is the sample liferay-maven project structure I had.

Categories : Maven

Getting NullPointerException when consuming Java web service using PHP
Take a second look at the wsdl file, somewhere in there, you'll see something like this: <element name="queryByPartyId"> <complexType> <element name="foobar" type="foo:int"/> </complexType> </element> This is the description of what the service expects you to pass when calling it. the inner elements have name and type attributes. To translate that into a call, just do this: $response = $soapClient->queryByPartyId(array('foobar'=> 123456)); var_dump($response); The wsdl should also contain a description of what the service will return: <element name="queryByPartyIdResponse"> <complexType> <element name="PartyReturn" type="xs:SomeType" /> </complexType> </element> In this example, the r

Categories : PHP

Own Service always leads to NullPointerException in Axis2
It appears that all the remote calls on the SQS WSDL take text/xml as input, not application/x-www-url-encoded. Assuming I'm looking at the same WSDL as you. http://sqs.us-east-1.amazonaws.com/doc/2012-11-05/QueueService.wsdl

Categories : Java

Service crashes with nullpointerexception at onCreate
Insted of this: AudioManager audioManager = (AudioManager)this.getSystemService(Context.AUDIO_SERVICE); Do this: AudioManager audioManager = (AudioManager)getApplicationContext().getSystemService(Context.AUDIO_SERVICE);

Categories : Java

unable to create service java.lang.NullPointerException
You have just declared the SensorManager reference variable , currently it holds a null reference , where have you instantiated it ? private SensorManager sensorManager; Calling any method on this null reference will throw a NullPointerException: sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL); You need to initialize it in onCreate(): sensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE); Even your AudioManager am; refers to null , you need to initialize it before invoking any methods on it.

Categories : Android

NullPointerException When Attempting To Bundle Extras Between a Service and Another Class
In you DataCountService class ,You forgot to implement the below method : private Intent getIntent() { // TODO Auto-generated method stub return null; } Always returning null. Implement your logic there,and return the result.

Categories : Java

Wso2 Data service giving java.lang.NullPointerException
You are getting this error, because you haven't defined the result of your select query. When you define a SELECT query, you are going to retrieve a resultset from the query. So you need to define the result using the output parameters. In the Add Query page there is a section called 'Result (Output Mapping)' where you can define the resut. Alternatively you can define the query with column names (ex: SELECT name, age from Student) and then just click on 'Generate Responses' which automatically generate the response[1]. [1]http://docs.wso2.org/display/DSS301/Generate+Response

Categories : Java

NullPointerException by parsing JSON
there must be something which have null value in your doInBackground() at line 105 and you are trying to access it, which is causing error. you can refer Source Attachment does not contain the source for the file ThreadPoolExecutor.class for reference. Hope this will help you.

Categories : PHP

Json parsing gives NullPointerException
Key to the answer : Gson or not, parsing the json string is the key to the answer. From the comments by Siddharth below. JsonParser parser = new JsonParser(); JsonObject json = parser.parse(jsonResults.toString()).getAsJsonObject() ; JsonArray results = json.getAsJsonArray("results"); JsonObject result = results.get(0).getAsJsonObject(); customerAddress = result.get("formatted_address").getAsString(); Alternative : I failed to read the edit 3 part of the question and failed to look at the gson tag. So i ended up providing the below alternative. JSONObject jsono = new JSONObject (myjsonstring); JSONArray myListsAll= new JSONArray(jsono.getString("results")); for(int i=0;i<myListsAll.length();i++){ JSONObject jsonObject1 = (JSONObject) myListsAll.get(i); JSONArray myarray= new J

Categories : Java

Nullpointerexception in displaying image from json url Android
It looks like you never initialize the "activity" variable in the CustomAdapter. That's probably the source of your NPE. You should probably use MainActivity.this instead.

Categories : Android

how to send media file to wcf rest json service and get string return response in json format
To send a media file (or any arbitrary file, for that matter) to WCF, you need to have an operation where the only parameter in the request body is of type Stream. That means that you can have other parameters to the operation, but they need to be passed via the URI (using the UriTemplate property of the [WebInvoke] attribute) - see more information in the post at http://blogs.msdn.com/b/carlosfigueira/archive/2008/04/17/wcf-raw-programming-model-receiving-arbitrary-data.aspx. In your example, you'd have something like the code below: [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "RegisterUser?emailId={EmailID}&name={Name}&mobile={Mobile}&IMEI={IMEI}", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat= WebMessageFormat.Json, ResponseFor

Categories : Android

Get json from Web Service
add Producers as json @Produces({ "application/json" }) @Consumes({ "application/json" }) also add error: function(jqXHR, textStatus, errorThrown) { console.log(textStatus, errorThrown); } to get the specific error

Categories : Java

java.lang.RuntimeException unable to instantiate service: java.lang.NullPointerException
You cannot call getSystemService() from an initializer (as you originally were) or from the constructor (as you are now). Please override onCreate(), and call getSystemService() there. Basically, until onCreate() is called (or, more accurately, until after you call super.onCreate() from your onCreate()), the inherited methods on Service are not yet ready for your use.

Categories : Android

java.lang.RuntimeException: Unable to start service java.lang.NullPointerException
whenever there is a null pointer exception it is mostly due to xml... Some element may not be matching in your xml file. to send sms u may try the following code: Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.putExtra("sms_body", sms_text_string); sendIntent.setType("vnd.android-dir/mms-sms"); startActivity(sendIntent);

Categories : Java

get data from json web service every second
If you are getting your data from a web service and want to deserialize to the object, I believe you should add [DataContract] and [DataMember] attributes to your class and properties. Try like this for every object that you retrieve from web service: [DataContract] public class QuestConf:List<object> { [DataMember] public Question question { get; set; } [DataMember] public List<Answer> answers { get; set; } }

Categories : C#

Json web service https
Please add some more details in the Question about What you want exactly, What you have tried and What are the Problems you are facing while implementation ? If you want to GET some data from the Web Service , you can get it like this. : NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlConParametros]]; NSString *respStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"My Response :: %@",respStr); If the Response is in JSON Format then you should do something like this : NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlConParametros]]; NSError* error; NSDictionary* json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error]; NSLog(@"My Response :: %@",json); Take a look at the Sample Co

Categories : Iphone

JSON and SOAP WCF Service?
As far as I know you have three options for combining json and xml responses from WCF and neither of them are desirable: Write specific methods (and enpoints) for XML and JSON and decorate them accordingly Hook into the serialization engine and combine this with an inspection of the accept header from the http request. Let your method accept and return a Stream which by convention tells WCF to give you direct access to the request and response streams. Each method has it's own flaws: 1. This is ugly and contrary to the ideas of Rest, since the serialization should be determined using http headers, not the URL (which should identify the resource). 2. It is complicated to attach to the serialization engine and you still need to look at the headers to determine the serialization.

Categories : Dotnet

Using JSON as a service in AngularJS
you could try this : the app.js: angular.module('HomeCourtArenaApp', ['HomeCourtArenaApp.services', 'HomeCourtArenaApp.controllers']). config(['$routeProvider', ($routeProvider) { $routeProvider.when('/', { templateUrl: 'views/main.html', controller: 'MainCtrl' }); $routeProvider.otherwise({ redirectTo: '/'}); }]); angular.module('HomeCourtArenaApp.services', ['ngResource']). factory('JsonData', function($resource){ return $resource('data/shoe3Dconfig.js'); }); angular.module('HomeCourtArenaApp.controllers', []). controller('MainCtrl', ['$scope', 'JsonData', function($scope, JsonData) { $scope.objs = JsonData.query(); console.log(objs); } }]); and this is not necessary to load the datas in the html <script src="scripts/services/data.j

Categories : Angularjs

ASP.NET JSON response without web service
Look into to ASP.Net Web Methods http://msdn.microsoft.com/en-us/library/byxd99hx(v=vs.90).aspx

Categories : Asp Net

How to consume JSON from WCF service
Try grabbing the data like so: statusInText = data.getStatesResult[0].State_Name You had a capital "G", when it actuality it is "getStatesResult". This then has an array of objects, so reference index 0, then State_Name Here's a demo with your JSON logging the result you want: http://jsfiddle.net/nvkB6/

Categories : Javascript

Request Web Service to get JSON
check jQuery out for this action. It would result in something like $.get("http://yourRestprovider.com/yourResource",function(data){ //handle your data },"json"); please specify what you mean with basic authentication since I see no approach of authenticating against the server in your code snippet!

Categories : Javascript

Passing a variable to a JSON web service
This is a javascript/json object: {field:'value'} You have passed a string which, doesn't count as an "object" for these purposes. Note that the error message is being generated by the service you are accessing. This question would be better directed to the creator of the service.

Categories : Python

Json Web Service Data Retrieval
So if String strJson is the resultant string received from the HTTP request that has to be populated in a ListView for instance then :- JSONObject strJsonObj = new JSONObject(strJson); Listview listContent = getListFromJson(strJsonObj); and from strJsonObj create a JSON array like: JSONArray resultantArray = strJsonObj.getJSONArray("resultantTag"); Making a loop to traverse the JsonArray Create Json Object for every traverse: for(int i=0; i<searchResultArray.length(); i++){ JSONObject objAtI = (JSONObject) resultantArray.get(i); objAtI.get("xyz").toString(); objAtI.get("abc").toString(); } Thats it.

Categories : Java

No response from gorilla/rpc JSON RPC Service
It's because gorilla/rpc/json implements JSON-RPC, which requires three parameters in the request: method, params and id. Requests without id in JSON-RPC are called notifications and do not have responses. Check specification for more details. So, in your case, you need to use following JSON: {"method":"HelloService.Say","params":[{"Who":"Test"}], "id":"1"}

Categories : Go

Read json web service spring mvc
It looks like you need to change: $('#lblResult').append('<p> deleted: ' + msg.setDeleted+ '</p>'); to $('#lblResult').append('<p> deleted: ' + msg.deleted+ '</p>');

Categories : Java

getting json from odata wcf service with jquery
You're making a cross origin call. For security reason those aren't directly allowed by the browser. A cross origin call means you are calling an url from another domain, protocol or other port. Meaning if your code was on http://demos.kendoui.com/yourpage you wouldn't get the error. First off don't just run your code on the local filesystem. Put it on a webserver. Then you'll get a similar error ('not allowed by Access-Control-Allow-Origin'), but... You have a couple of options: if you have control over the server: enable cors (= cross origin rescource sharing; send extra header information) enable jsonP (=json with padding; wrap json with a callback method) if you have no control over the server: use a proxy script ( a script on your server getting the data and passing it along

Categories : Jquery

Web service call through JS, DataType Json
Your using a absolute URL to your webservice. You should be using a relative server path like this snippet suggests: $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", data: "{ your: 'data' }", dataType: "json", url: "WebService1.asmx/sum", success: function (data) { alert(data); //use your data object } });

Categories : Javascript

why XML is part of the web service standard but not JSON
Because at the time the various Web Service Standards1 were written JSON was not established as a data format.2 1 "The great thing about standards is that there are so many to choose from". 2 JavaScript object and array literals existed, but their use outside JavaScript code was yet to be identified.

Categories : Xml

JSON Web service calling repeatedly
You can use alarm manager and call the webservice at a particular interval of time. You can chekc using alarm manager here

Categories : Android

Receiving JSON data into my Web Service
You... can try putting together some dummy data, if you know enough about the type of data you'll be getting... But if you don't even know what shape it'll be, I don't know how in the world you would "analyze" it. Unless by "analyze," you mean get the size or something generic like that...

Categories : Asp Net

how to pass arguments and parameters in json web service?
It's so simple. I am still amazed which part of the code you are not getting. You just have to take one variable (say pageNo) of type int and then provide it the default value 1. You just have to increment the pageNo (using pageNo++) to get the next page value and then you have to create string for URL with pageNo and then simply pass it to URL using the method called URLWithString of class NSURL. Translation of all the above description in 4 easy steps using Objective-C : NSString *urlString = [NSString stringWithFormat:@"http://appabn.com/iphone/files/api/api.php?q=helo_users&u_id=5&page=%d",pageNo]; NSURL *url = [NSURL URLWithString:urlString]; // web api link NSURLRequest *request = [NSURLRequest requestWithURL:url]; connection = [NSURLConnection connectionWithRequest:requ

Categories : Iphone

How do I consume C# WCF Service with JSON for development and debugging?
I'm assuming you are creating these services by using the WebInvoke/WebGet attributes on your method signatures. You can import these services just like you would any other service into a C# project, however VS doesn't add the additional attributes in the signature to the created code once you import them. You can show all files, and go into your service reference, under Reference.svcmap, into the Reference.cs file and add the attribute to the signature in the interface for your service, they will then allow you to send and/or receive them with JSON. For example make sure they both your service interface and the imported interface have: [WebInvoke(ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]

Categories : C#

Implement c# asp.net application with WCF service (wshttpBinding) using JSON
Might be this is what you are looking for http://www.codeproject.com/Articles/105273/Create-RESTful-WCF-Service-API-Step-By-Step-Guide

Categories : C#

Apache Wink Json REST Web Service
Hello is not an asset, it's a domain class. So you don't need to annotate it. Also make sure that you have some json support (I think having Jackson is preferred). By default there is no JSON provided registered.

Categories : Java

how ll i read the followong json response of a web service?
Please have a look on this example, JSON { "news1": "This is a first sample news feed", "news2": "This is a second sample news feed", "news3": "This is a third sample news feed" } HTML <ul> <li><div id="news1" style="height:100px;width:auto"></div> </li> <li><div id="news2" style="height:100px;width:auto"></div></li> <li><div id="news3" style="height:100px;width:auto"></div> </li> </ul> jQuery <script type="text/javascript"> $(document).ready( function() { $.getJSON('script/news1.js', function(jd) { $('#news1').append('<p>' + jd.news1 + '</p>'); $('#news2').append('<p>' + jd.news2 + '</p>'); $('#news3').append('<p>' + jd.news3 + '</p>

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.