views:

26

answers:

1

Hi all, I've used the Flex HTTPService to connect to a backend blazeDS service without any problems at all. The question I have is, can I also use HTTPService to send a HTTP POST message to a server (with basic authentication)?

Specifically I'd like to be able to interface Flex with Notifo (https://api.notifo.com) and to interface with it you just need to send a http POST with authentication and some key:value strings for the message content. (I've done it from java and from the command line with curl and it all seemed pretty easy to set but I'm just not sure how to go about trying this with Flex).

How would this be done via the HTTPService (if at all) ?

Can anyone see how the mxml/as class would look like and what would be in the services-config file and what adapters need to be used etc etc ??

Is there a similar example out there anywhere ??

Many thanks, Alex

A: 

Here's one I found in PHP which you could pretty easily translate to an HTTP service in Flex:

http://snipplr.com/view/30355/notifo-subscribe-request-using-php-curl-and-jquery/

Checking on their site, it says basic HTTP requests will be refused, are you sure you are using HTTPS?

In response to your question below, I think you're using BlazeDS? I'm not using it so I don't use the messaging-config.xml. I'm not sure if you can do the same if you're using it, but my destination code is done directly in the component I'm working on:

<fx:Declarations>
    <s:HTTPService id="employeeService"
        url="https://www.adobetes.com/f4iaw100/remoteData/employeeData.cfm"
        result="employeeService_resultHandler(event)"
        fault="employeeService_faultHandler(event)" />
    <s:HTTPService />
</fx:Declarations>

That's just a small example, thrown right into a component. The result function (employeeService_resultHandler) would be where you handle the return call from the API. I may be missing something though, is that what you're looking for?

Organiccat
Yep I'll be using HTTPS. It's this 'translation into an HTTP service' that I'm not sure about - even if it should be pretty easy. What adapters would I need to use in the messaging-config.xml etc ?
Alex Curtis
Hmm, tried to update the answer, not sure if that's what you're looking for.
Organiccat