w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Request.CreateResponse vs returning POCOs in ASP.NET Web API
Request.CreateResponse can generate other http message, ex.404,500. If just return,the http message will be 200 OK. In my code, if get need authorized, I will return like this: throw new HttpResponseException(HttpStatusCode.Unauthorized); write this,you unnecessary change the return value.

Categories : Asp Net Web Api

WordPress - Ajax Request Keeps Returning 0
that's because it returns results from conditional that checks if user is logged as admin. 0 is false. Update: Try instead of return on end of the function, to put echo or print results. I think you end function procedure, but other processes from wp keep getting still.

Categories : PHP

Request.Form returning no values
Alright, the solution was as simple as attaching the appropriate name onto the HTML DOM element. The final HTML ended up looking something like this: <div class="form_section" ID="Exhibitors" style="display:none;"> <div class='wExhibitor' data-bind="foreach: $root.exhibitors"> <h2>Exhibitor <span data-bind="text: $index() + 1"></span> Information</h2> <div class="eccform_section"> <div class="eccform_column"> <div class="eccform_label">First Name*</div> <div class="eccform_field"><input id="exFirstName" runat="server" class="exFirstName" title="First Name" data-bind="value:FirstName,attr:{name: 'exFirstName_'+$index()}" /></

Categories : C#

Request to Google Places API on iOS Returning REQUEST_DENIED
So it seems like as of 09/09/13, there is no support for Places API for iOS. You have to use the one for web with any referrer rather than specify any static IP. Hope this help saves someone sometime. It took me quite a few hours to find this out.

Categories : IOS

PHP cURL request to same server returning false
Must be related to locking session situations. Try this way. <?php $url = 'http://api.some_address_on_the_same_server.com'; $postdata = array(...); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); session_write_close(); $result = curl_exec($ch); // $result is always false when on the same server for some reason curl_close($ch); session_start(); ?> EDIT : Have you added an exception in your windows host file ? /windows/system32/drivers/etc/hosts like 127.0.0.1 yourdomain.com For more information. Check out this

Categories : PHP

Symfony2 $request->query->get() returning null value
Try to change you action to this: public function getnameAction($name) { echo $name; } Symfony binds parameters defined in routing file to parameter names in action method (see Symfony book chapter on controller parameters for more details). If you want to use $request->query to get your parameters it should be passed like this: http://http://dashboardsmf.iiit.ac.in/web/app_dev.php/new?name=India.

Categories : Misc

Http request returning different response in browser
Make sure you are encoding the URL request correctly when you are setting the URL for the server. The spaces, braces, and colons all need to be appropriately escaped. Spaces should be %20, etc. This may help: HTTP URL Address Encoding in Java Old Answer.... Comments indicate this does not affect the result... so moving down. It is quite possible that the server is changing it's behaviour based on the type of 'browser' you are reporting yourself to be. When connecting to an HTTP server you tell the server what your UserAgent is (typically for a browser it is something like "Internet Explorer ...." or "Mozilla ..." or "Google Chome ...". The Server will often tailor the results of a request to suite the User Agent (different javascript files and HTML codes go to IE, etc.). This is also h

Categories : Java

Python GAE Requests not returning cookies after get request
I tried urlfetch it seems to be showing the cookie headers: import logging from google.appengine.api import urlfetch response = urlfetch.fetch(url) logging.info(response.headers)

Categories : Python

GWT's http request builder returning empty response
When you make CORS requests with GWT, you dont have to add any extra header to your request. What you must do, is check that the server is supporting CORS requests from your site. If you are managing the site http://api.mobile.endomondo.com, you have to change the server code to return the appropriate CORS headers when the client sends an OPTION request. In case of java server-side you have an example of how to handle CORS in this page using a Filter. Note that CORS only works in modern browsers (EDITED: actually old version of certain browsers support it. See the list of browsers in @Thomas comments below).

Categories : Java

Bing translation Service returning first response to every request
I have resolved these issues explained below: 1) My own fault for trying to reassign configuration object properties to themselves with varied data. This set my configuration file to retain the data of the previous service call. Causing it to parse the same data and return it as new data. 2)My belief is that when passing malformed html script tags are translated. Also please note that in your configuration of your web service call your content type parameter should be set to "text/html" Hope this helps someone down the road. Thanks!

Categories : Dotnet

Scripts returning double spaces to xhr request (ajax)
Try this $.ajax({ url: 'http://192.168.0.6/access/login', data: '{ "user":"' + user+ '",pass":"' + pass+ '",rem":"' + remember+ '"}', type: 'POST', success: function(data) { alert(data.length) if(data=="true") { $('#errorMessage').html(data) ; $('#loginWarn').fadeIn() ; } else { window.location = 'login' } } })

Categories : PHP

Returning JSON response for Spring MVC Post request
I think your method should be annotated with @ResponseBody. @RequestMapping(method = RequestMethod.POST) @ResponseBody public String uploadItem(@RequestBody MultipartFile file, @RequestParam String name, @RequestParam(required = false, defaultValue = "-1") int chunks, @RequestParam(required = false, defaultValue = "-1") This is how Spring checks for Json conversion: Jackson library is existed in the project classpath The mvc:annotation-driven is enabled Return method annotated with @ResponseBody Spring will handle the JSON conversion automatically.

Categories : Java

Python Post request returning unexpected html
I think maybe your request was not accepted by the server. First, you need to checkout how the front end send request, the developer tool in chrome can help you. Besides, many websites have some mechanisms to refuse the requests from spiders, add header is not enough.I recommend you to simulate the real browser to do this.You can try selenium.

Categories : Python

Recurly PUT request working but returning server error
For anyone else who gets stuck on this due to lack of knowledge of the API or documentation, it would appear that some of my headers were wrong/missing. Here is the code to satisfy the Recurly servers. try { HttpWebRequest renewRequest = (HttpWebRequest)WebRequest.Create(uri); renewRequest.Headers.Add("Authorization", "Basic " + encodeB64); renewRequest.Method = "PUT"; renewRequest.ContentLength = 0; renewRequest.UserAgent = "mylib/1.0"; renewRequest.Host = "XXXX.recurly.com"; renewRequest.Accept = "application/xml"; HttpWebResponse renewResponse = (HttpWebResponse)renewRequest.GetResponse(); } As you can see the Accept header is now application/xml, and the userAgent header was missing, this seems to have resolved the internal server error message.

Categories : C#

Nginx+bottle+uwsgi Server returning 404 on every request
Are you sure that NGINX and UWSGI are working properly? Lot's of things could be wrong, I recommend you to follow this guide: https://uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html It's a step by step to setup NGINX and UWSGI with Django but I'm pretty sure you can apply it to any other web app than Django.

Categories : Python

Request for product data not returning anything in sandbox environment
One very obscure problem ... say you submit a new version with some new IAP items to Apple. as you know, the sandbox works fine while that new version is in the waiting cue for a week. when you request product data (sandbox) during that period, it works fine However: Rather bizarrely -- JUST while it is in review (ie, for 6 hours or so) -- you WILL NOT be able to request product date (sandbox) - it just won't work. Hope it helps.

Categories : Iphone

Block meteor helper from returning when doing http request
On the client, you don't have the fiber module, as a result is not possible to make a synchronous call to a function. One solution might be to use a Session because of it's reactivity. You just set a default value, and use it in your helper function Session.setDefault('testHelper', {msg: 'wait'}) Meteor.templateName.helpers ({ testHelper: function() { return Session.get('testHelper'); } }); Then update this session every time you want: Template.templateName.rendered = function () { Meteor.http.get("http://api.somesite.com", function (error, result) { if(!error && result.statusCode === 200){ var respJson = JSON.parse(result.content); Session.set('testHelper', respJson) } } ); } If

Categories : Meteor

Why is Azure returning 404 Resource Not Found in response to a PUT blob request?
You should use Fiddler to verify that you are sending the request you think you are. You can then compare the Fiddler request with the documentation. Does the container already exist? It is worth using a 3rd-party storage explorer to verify that it does.

Categories : Rest

Jersey service returning 400 Bad Request with Must specify a non-null value for the 'to' index in a Range
After 5 hours, I found the answer. I was looking in the wrong place. Turns out, Runtime exceptions are turned into 400 Bad Request by Jersey response handler. I was focused on other services when the issue was my own service throwing an IllegalArgumentException from a loop. Place a try catch (Exception e) around your service impl and find the issue quickly. Jersey strips the stack trace when returning this error and it may not be from a remote service, might be your own code. Placed here for posterity for any others so afflicted. I did not know where else to note this.

Categories : Java

Ajax Request in Progress suddenly started returning status = 0
I'm not convinced that the ajax request itself is quite right. if (client.readyState != 4) return; will always be true aside from when its actually 4. This may be better: client.onreadystatechange = function () { if(client.readyState < 4) { //not complete yet return; } if(client.status != 200 && client.status != 304) { //an error alert("error "+client.status); return; } if(client.readyState === 4) { //complete callback(client); } } As for the problem whereby the ajax call is aborted: This is correct behaviour. All XHR calls will be aborted by the browser as soon the page is reloaded or unloaded. Perhaps this was somehow not the case when viewing pages locally. I would not allow th

Categories : PHP

new Angular.js 1.1.5 resource returning promise then() function error followed by another request
Fully exposed promises are currently only avaliable in master (commit https://github.com/angular/angular.js/commit/05772e15fbecfdc63d4977e2e8839d8b95d6a92d). Beginning with 1.1.3, $resource exposed the promises' then function via $then (likewise $resolved): Template.$addNew(value).$then( function( value ){newids.push(value);}, function ( error ) {console.log ('error')} )

Categories : Angularjs

How to wait till asynchronous request returns data before returning value
Asynchronous requests run on separate thread, So we don't need to worry about handling view lockup. If you want send a synchronous request then you have to use GCD to achieve the same. And various other details like, how much data is send/received etc. will not be available in synchronous request. Synchronous request are helpful if your code next state is dependent on data received in response of the request.

Categories : Objective C

QuickBooks API request returning "Premature end of file", error code -2001
Can you please try this call using ApiExplorer tool(QBD). Link - https://developer.intuit.com/apiexplorer?apiname=V2QBD PFB snapshot Please let me know if it works for you. EDIT Adding endpoint and post body. It worked fine Endpoint - https://services.intuit.com/sb/customer/v2/<relam-id> Content-Type: text/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <CustomerQuery xmlns="http://www.intuit.com/sb/cdm/v2"> <FirstLastInside>Manas</FirstLastInside> </CustomerQuery>

Categories : Xml

Angularjs testing (Jasmine) - $http returning 'No pending request to flush'
I guess you have to wrap the code below the waits inside a runs(...) block. Otherwise your code is executed immediately before the waiting has been finished waits(4000); runs(function() { $httpBackend.flush(); expect(UserManager.oauth.credentials.access_token).toEqual('ef235de46dba53ba69ed049f57496ec902 da5d28AAFB1HdeTE-2vwnhn0s-nUFtoGtj9rSm9waiuhySCpFJxKVYqOx9W7Gt'); }); It's described in the jasmine docs as well: https://github.com/pivotal/jasmine/wiki/Asynchronous-specs

Categories : Unit Testing

Angularjs: setting/returning scope after long wait on http request
You should have ng-controller defined on that div or somewhere above it in the HTML hierarchy no ng-model. Here's a fiddle that shows it working: http://jsfiddle.net/5ZJrH/ I had to update the value in the braces {{}} since in the scope for the controller the variable name was different. The JS ordersApp = angular.module("ordersApp", []); ordersApp.factory('upsPrint', function ($http, $q) { var service = { printedOrder:{}, upsPrint: function (order) { var deferred = $q.defer(); deferred.resolve("test"); service.printedOrder = "test"; //$http.post('orders/upsPrint',{order: order}).success(function(data) //{ // deferred.resolve(data);

Categories : Angularjs

Jenkins / Hudson createItem API request returning white space error
So turns out despite the Jenkins API saying to post "config.xml" you arent actually sending a file, but posting the xml data itself. The way I did this was using the Postman plugin for chrome, and adding the contents of my config.xml file directly to the RAW input. This worked for me. Hope this saves some other people some frustration.

Categories : Api

ASP.NET MVC application, localhost working, remote computer returning "An error occurred while processing your request."
I had this error running on a virtual machine in Amazon AWS. The website had been working some time ago.. like a few months when I left it last. No configuration changes, nothing. Now it doesn't work.... And why would it stop working? Real head scratcher. Maybe a virus infection - It was not set to auto patch... Hmmm.. I'd set the machine to the smallest (micro instance) as a kind of "hibernation" of the site, very little traffic expected and I didn't have this site on my list of priorities... The site "worked" in "micro" instance when I last left it. Tried rebooting first off. Nothing. Then I checked the localhost and it works from there. Weird. Anyway it is time to make some modifications on this site and some upgrades. "Micro" instances are useless when upgraded so I shut

Categories : C#

Is returning data fields on successful REST API POST/PUT/DELETE request an acceptable best practice?
Yes, it is perfectly acceptable, and perhaps even desirable. REST, after all, stands for Representational State Transfer, and so there is nothing wrong in showing the state of the affected entity/entities after a state-change has been effected. You also minimize chatter by not requiring a subsequent GET request. You can also convey this if you have a semantic media-type defined for the result of this operation.

Categories : Ajax

GWT request factory - Fire request inside of success method of another request
Try to create an event in the first onSuccess method. When your event is handled, you could send another request to the server. Check out How to use the GWT EventBus to use the eventbus. Thomas Broyer statement is also right. You should only use one RequestFactory and one ClientFactory!

Categories : Java

Python - Chaining methods: returning `self` vs returning a new cloned object
Django does this so that the base query can be kept around and reused, without inheriting changes from a future "child" query, like your exclude() on your filter(). I'm guessing somebody tried storing queries for later, and realized that didn't work well without copying. I cloned the django repo and did a quick git log on django/db/models/query.py, searching for the phrase clone. The patch that introduces this change is here: https://github.com/django/django/commit/d4a3a4b

Categories : Python

Oracle Query is returning value when setting value to it, but not returning value when passing date value
Since you're already forcing the date format, you can use the following query instead: SELECT INCIDENT_ID FROM INC_SM1 I WHERE I.CLOSE_TIME >= START_DATE AND I.CLOSE_TIME < END_DATE

Categories : Oracle

JavaScript, stringify, replacer - returning undefined vs. returning nothing
If you don't provide an explicit return, the return value is undefined. Your second function always returns undefined, in other words. Because the function always returns undefined, there'll never be anything included in the JSON stringified result, so the overall effect is that you get undefined. It's sort-of an anti-pattern to do this: if (something) { return whatever; } else { return somethingElse; } Your first function would be more idiomatic as: str = JSON.stringify(o,function(k,v) { return Object.isSealed(this) ? undefined : v; }); edit — note that JSON.stringify() calls your replacer function first with an empty key, and "v" equal to this a new wrapper object containing the object to be stringified (and note that that object is not sealed). That is, before chec

Categories : Javascript

django - request.META - when sending request, what to do so that data appears in request.META
With the exception of CONTENT_LENGTH and CONTENT_TYPE, as given above, any HTTP headers in the request are converted to META keys by converting all characters to uppercase, replacing any hyphens with underscores and adding an HTTP_ prefix to the name. So, for example, a header called X-Bender would be mapped to the META key HTTP_X_BENDER. See https://docs.djangoproject.com/en/dev/ref/request-response/ So, in your case, I think you need to simply send {"TOKEN": "abc"}.

Categories : Python

Returning 'nil' from a Lua function in C vs returning 0 values
Yes, this is perfectly valid. If you're trying to request/assign more return values than there are (no matter whether you try to get one or ten), you'll get nil for the undefined ones (i.e. those not returned). function test1() return 5 end local a, b = test1() -- a = 5, b = nil function test2() return 1, 2 end local c, d, e = test2() -- c = 1, d = 2, e = nil function test3() end local f, g = test3() -- f = nil, g = nil You probably can't find it in Lua's source because it's no special case or anything. It's just Lua's generic way to handle return values. Update: The difference you've noticed when trying to print return values is the fact that this is not just an assignment. Of course there is a slight difference between returning nil and returning nothing at all - and it

Categories : C

Spring-MVC :: How to pass request parameters (or) query string values to another subsequent request?
You could call the underlying method directly So if you have as controller2 : @RequestMapping(value = "/MyURL", method = RequestMethod.POST) public String myMethod(final BaseDTO baseDTO, Model model) {} Inject controller2 into controller1 and call "normally": controller2.myMethod(baseDTO, model);

Categories : Java

IIS handles request much longer when request originates from another computer and returns HTTP 200 and text
So a request from localhost is quicker than a request from a remote computer. That makes perfect sense - the localhost doesn't have to do a network request out to the network, find a remote host, send the request over the network and then wait for a response. Having said that - if your application is taking 15ms locally and 260ms on even a relatively close network, then it's slow :).

Categories : Dotnet

AngularJs chaining an undefined ajax request and output progress (also if one request fail)
You can use $q.all to get all response and then process the response at the same time $q.all(promises).then(function (values) { //process all result together }); And you can also plugin a callback function to each promises to indicate the progress $q.all(promises[0].then(callback), promises[1].then(callback), ...).then(function (values) { //process all result together });

Categories : Angularjs

PayPal Adaptive Payments - Preapproval request results in "Invalid request" error
OK fixed. How? Fix #1 The arguments requestEnvelope.errorLanguage and clientDetails.applicationId need to be "JSONified" into objects on their own, such as: "requestEnvelope": { "errorLanguage": "en_US" }, and "clientDetails": { "applicationId": "APP-XXXXXXXXXXXXX" }, respectively. Fix #2 Date formats; date format should be of the form 2014-03-15T20:14:38.007+00:00 and not 2014-03-14T20:14:38+0000 as I was passing. Note the milliseconds, and the timezone with the colon in the utc offset. Next time an Invalid request comes up the parameters I'm passing will be the first thing to look at.

Categories : Python

Zend Validation - Specify multiple ways to validate a request - depending on whats in the request
You can create a strategy class that can select input filter that can fit current request based on posted parameters. In other words your request flow should be something like this: Request -> Route -> Controller -> Input Filter Strategy -> InputFilter -> Other Stuff

Categories : Validation

Spring3 doesn't work @valid when json request I got 400 Bad Request error
Data binding (mapping request to objects) is an independent process from data validation. In Spring, data binding can contribute with its own binding errors to overall validation errors. Binding errors are supported by Spring's standard WebDataBinder, which kicks in when the method parameter is annotated with @ModelAttribute With @RequestBody annotation a completely different mechanism is used - HttpMessageConverters (in you case probably the MappingJackson2HttpMessageConverter). When the JSON unmarshalling fails a HttpMessageNotReadableException exception is thrown. You can handle exceptions within your global HandlerExceptionResolver or a special @ExceptionHandler annotated handler method within the handler itself or a global @ControllerAdvice.

Categories : Json



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