How do I replace willSendRequestForAuthenticationChallenge with new AFNetworking2 - afnetworking-2

I have been tasked with converting NSURLConnection et al, with AFNetworking 2. My first roadblock is in a custom authentication challenge.
I am confused on what replaces the delegate method willSendRequestForAuthenticationChallenge in AFNetworking 2.
A simple code example would be great.

Related

WSo2 API Manager 1.8.0 - JSON parsing issue

I am new to wso2 API Manager, trying to set it up expose my plain HTTP POST back end calls as a REST API. I am sure this is not a new pattern that I am trying to achieve here. The requirement is to convert the JSON data coming in (has array structures) into the HTTP URL query string parameters.
After some research through the documentation and other posts on this forum, decided to go with the script mediator that would parse the JSON data and convert it to a string that can be appended to the endpoint URL. Some how I am not able to achieve this.
I have followed the following post that seems to be very straight forward. As the original poster suggested, I am also not able to use getPayloadJSON() method. Even have trouble using the work around suggested there due to JSON.parse() not working.
Link
Also, this approach of editing the service bus configuration from source view does not sound like the correct option. Is there another elegant solution to achieve this? Thanks for the help in advance.
I was able to get both methods working by using an external script instead of the inline java script. Thanks

Combine ember.js and asp.net webapi JSON formats

I am currently building a web app with ember.js and webapi 3.
Currently I am facing the problem that webapi sends a JSON result (of an array of DTOs) which doesn't get understood by ember because it is missing a root element.
I didn't got far with the solutions on the web, which mostly just pointed to a template project for VS.
Has someone a simple and understandable solution?
I'm going to assume you're talking about Ember-Data.
web-api sends back json in whatever format the object is, so if you're sending back a list/array it's going to return an array of objects. If you have control of the controller then just modify what it's returning.
return new { foos = new List<string>() };

Action script 3 /Json Vend api

I have undertaken a project to create a mobile application using flash professional 6.
I am creating the app for a friend of mine who has just opened a store and has signed up to using the vend P.O.S system.
He wants the app to be able to get and post data from the vend system via the api.
The API vend give is a RESTful api that returns responses as json.
My question is how would i go about starting this in flash professional 6?
i am using flash professional as i am used to it and, i know since flash player 11, comes with a json encoder/decoder. However i am not sure whether this would actually help me in achieving what i need.
Would it be for instance better to have flash communicate with a php file that in turn posts and gets from the api ,or just have it communicate with the api itself?
Would i instead of using json to post data be better off having the app post using rest?
what is the authentication process in flash to access the server to use the api?
I have read up on urlrequest and urloaders in actionscript3, but i am still confused as how to implement this to get the desired out come.
if any one could point me in the right direction of post some sample script that could show a draft that i need that would be perfect.
cheers
I don't know the Vend API but you can do JSON with the AS3 API from the client (unless the terms and conditions of the service mandate conditions on any API keys, for example).
On first glance, the code snippets from How to post JSON data using Actionscript 3.0? should still work. The update I notice there is that you can use the new JSON class directly instead of the com.adobe.serialization.json namespace.
this is the answer to my question. its simple but it does what i need.
var myRequest:URLRequest = new URLRequest("https://www.yourdomian.com");
var myLoader = new URLLoader();
myLoader.addEventListener(Event.COMPLETE, onload);
myLoader.load(myRequest);
function onload(evt:Event):void
{
var myOutput:Object = JSON.parse(myLoader.data);
trace(myOutput);
}

call a workflow service from jquery

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.

LDAP Java EE, Auto-complete with jquery-ui and json object by servlet?

I am developing a java web program that can manage distant ldap entries,
we have to select person and i want to do this with auto-complete text-area functionality
I have Java function to return the entire list, to find by name or just by the begin of the name (wildcard search, spring ldap).
My idea was to use the jQuery ui autocomplete plugin, but I don't know how to catch remote source.
I think that must be by json object return by a servlet
Anyone know how can I do that?
I hope that's not to hard to implement
thank in advance for help
So I assume you are successfully getting the data retrieved from the LDAP using spring security.
All you need to do is to convert the data into JSON. If you are not using any json library already, you can use json.org for simplicity (or any other jsob-library).
Create a servlet that accepts request param term. call your LDAP Search based on this term. Create a json array of the result and print that that on response in doGet(). Map the servlet to desired path
$( "#your-element" ).autocomplete({
source: "/servlet/path",
minLength: 2
});