PDA

View Full Version : Soap


eyenine
07-24-2003, 05:11 PM
I need to consume a web service I wrote in .NET that requires SOAP to interact. After spending one whole morning and afternoon on the Internet, I found various "solutions" - using the Flash Remoting component, or have a server-side script to act as an interface, or use XML.addRequestHeader().

Option 1 requires $$$, option 2 defeats the purpose of writing a webservice (since it is automated in ASP.NET), while option 3 doesn't really work. I checked the request headers and they remained intact, despite following the same exact code discussed on the late release notes on Macromedia.com.

So, how could I get Flash to use SOAP?

CyanBlue
07-24-2003, 06:32 PM
Howdy and Welcome... ;)

First of all, Flash Remoting component is free... You can download it from the Macromedia's site... To run the Flash Remoting, you will need to either pay Macromedia to get the Flash Communication Server, or download PHP to run AMFPHP that does similar job...

I see that I am mumbling... It's because I don't know much about that stuff... :D

Go to http://www.amfphp.org to download AMFPHP package...

and see this thread...
http://www.actionscript.org/forums/showthread.php3?s=&threadid=28388

Show us what you create when it is done??? ;)

freddycodes
07-24-2003, 06:42 PM
CyanBlue, I just want to point something out as I have seen you mention this in several threads.

FLash COmmunications Server is not FLash Remoting. FLash Communication seerver is for building realtime asynchronous connections between a server and any number of clients. It is for creating multiplayer, games, multi yser chat apps, and much much more, video conferencing. However it is not FLash Remoting. They are two different products.


eyenine,

Unfortunately there is no built in way to consume web services from inside Flash. Like all things with Windows Platforms, they cost money. FLash remoting would allow you to consume .NET web services through the flash gateway on the server, a .NET library(they have both J2EE and .NET versions).

You would happen to have say PHP to use would you. There are currently 2 pretty good SOAP libraries written in PHP. nusoap and PEAR::SOAP both of which can consume .NET web servcices, your cheapest solution would be to say use amfphp and conjunction with PEAR::SOAP libraries. Or possibly use PHPObject which has some native support for SOAP.


This uses Flash MX, amfphp and PEAR::SOAP to consume a remote service written with .NET.
http://www.irq11.com/~louie/webService/irecipe.html

CyanBlue
07-24-2003, 07:07 PM
Thank you for correcting it, Masta... :)

I guess that happens when I reply without knowing what I am talking about... Gosh... Long way to go... :(

:)

eyenine
07-24-2003, 08:33 PM
Man, I don't understand this.

ASP.NET has everything automated. When one creates a web service, it will create a WSDL file to describe the service. In fact, all I want Flash to do is to send a HTTP request using the following template:

POST /ws/servicename.asmx HTTP/1.1
Host: irqnine.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://irqnine.com/ws/ActionName"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ActionName xmlns="http://irqnine.com/ws/">
<Field>int</Field>
</ActionName>
</soap:Body>
</soap:Envelope>The requirement for a Flash Remoting component on the server side sounds vague to me. To my understanding, this means that servers that want to support Flash clients will have to deal with it manually. If this is true, then web services aren't made for it is for.

SOAP is standard and cross-platform. The only differences between SOAP and normal HTTP is an additional SOAPAction header attribute, Content-Type set to text/xml and body holding the XML data. Why does Flash have to deal with various platform-dependent approach to web services? Or are the help files not talking about the "true" web services?

:confused: :confused: :confused:

eyenine
07-24-2003, 09:47 PM
I just found out that someone has already ranted about this (http://www.flash-db.com/Board/index.php?board=24;action=display;threadid=699;sta rt=0).

freddycodes
07-24-2003, 11:59 PM
I think we will most likely see some sort of web service access in the next version of flash. Flash MX came along way from Flash 5 and I think if MM wants flash to contend with the other players in web development, they will need to.

However the one thing is if they let flash do everything noone would buy CFMX, which has remoting built into it, so there is your most obvious answer. AFAIAC

pixelbath
12-13-2005, 06:09 PM
One problem I've noticed is the tendency to confuse Flash Remoting with SOAP and Webservices. Specifically, Flash Remoting is the term used by Macromedia for their proprietary system, the Action Message Format (AMF). AMF uses HTTP, but instead of sending XML it sends lightweight binary data (and since it's a proprietary format, can encapsulate AS objects without changing types).

Beginning with the release of AMFPHP version 0.5.2, it is possible to consume remote web services using Flash and AMFPHP. The only way to do this is to install PEAR::SOAP or NuSOAP. Not really a solution.

I understand your frustration, eyenine, because we are using .Net web services here as well, and I have been running into the same problem. I have worked around the bulk of it by parsing the returned XML manually. This is not an elegant or very maintainable solution, but it's working for what we will need once this application is finished. I have found no way to get the addRequestHeader() method to work, so have had to work around that in my web service calls as well.

Very frustrating, especially since anybody you talk to at Macromedia says it works fine and will show you an example using data-bound components. For those who do not use Macromedia's craponents, I guess the official stance is "you're SOL."

I'm also not sure why people think that installing Apache, PHP, and AMFPHP is a solution for something (.Net web services) that works out of the box. Flash is the problem, not the standard web service.

Followed eyenine's link and ranted about this there, too.