Volledige versie bekijken : SOAP autentication header meegeven in Flash?
ScriptSuite
%Europe/Berlin %574 %2005, 14:47
Iemand die daar ervaring mee heeft en een stukje code wil plaatsen?
b.v.d.
Roenes
%Europe/Berlin %583 %2005, 15:00
Even een beknopde uitleg wat een SOAP authentication header is? Want ik ken de term niet, maar misschien het principe wel :)
mateo)
%Europe/Berlin %595 %2005, 15:18
ik denk dat je hier wel wat aan hebt:
bron:http://www.flash-db.com/Board/index.php?board=9;action=display;threadid=6647;sta rt=
Here is a workaround provided very kindly by Jonathan Duran from Macromedia Technical Support.
=========================
Hi Michael,
Thank you for contacting Macromedia Technical Support. I've reviewed your
issue and discovered that the SOAPCall.addHeader method is a documentation
error and isn't actually supported as part of Flash 2004. We are in the
process of creating a TechNote to document this erratum.
There is a workaround, which I can provide for you as an unsupported fix.
You can attach an addHeader method to the PendingCall class to allow you to
have the same functionality. I've attached an AS file with this code.
Keep in mind that this workaround is unsupported code that hasn't been
through a full cycle of testing.
Let me know if you have any further questions regarding this incident.
Regards,
Jonathan Duran
Macromedia Technical Support
=========================
// This file documents a fix/workaround to the webservice classes,
// to allow you to add SOAP headers to calls to webservice operations.
// If you #include this file in a .FLA and run it, it will make
// several service calls with headers - you can observe this
// by using your favorite TCP/IP monitor.
// NOTE - for illustration purposes, this file shows calls to a public
// Stock Quote service; be advised that the headers that we send are
// not actually recognized by that service.
// This function adds the fix to the web services classes.
function addSOAPHeaderFix()
{
if (mx.services.PendingCall.prototype.__encodeSOAPHea der__ != null) return;
mx.services.PendingCall.prototype.__encodeSOAPHead er__ =
mx.services.PendingCall.prototype.encodeSOAPHeader ;
mx.services.PendingCall.prototype.encodeSOAPHeader = function ()
{
var theService = this.myCall.wsdlOperation.wsdl.serviceProxy.servic e;
// here is how to do headers that apply to all calls
for (var i = 0; i < theService.headersForAllCalls.length; i++)
{
this.addHeader(theService.headersForAllCalls[i]);
}
// here is how to do headers that apply to only one specific call
for (var j = 0; j < theService.headersForOneCall.length; j++)
{
this.addHeader(theService.headersForOneCall[j]);
}
theService.headersForOneCall = null;
this.__encodeSOAPHeader__();
}
}
// do this once, when your application starts up
addSOAPHeaderFix();
// create services in the usual way
var service: mx.services.WebService;
//service = new mx.services.WebService("http://www.swanandmokashi.com/HomePage/WebServices/StockQuotes.asmx?WSDL");
service = new mx.services.WebService("http://localhost/proxy/stockquote.wsdl");
// here are a couple of headers
var header1 = new XML(
'<t:Identity xmlns:t="http://example.org/2001/06/tx">234234</t:Identity>');
var header2 = new XML(
'<t:Transaction xmlns:t="http://example.org/2001/06/tx"> 5</t:Transaction>');
// here is how to add headers that will be applied to all subsequent service calls
service.headersForAllCalls = new Array();
service.headersForAllCalls.push (header1);
// make service calls in the usual way
service.GetStockQuotes("adbe,sunw");
// [optional] you have to do a little bit extra if you want headers that only apply
// to a particular call. This is only reliable if you wait until the service is fully
// initialized (i.e. until the service's onLoad method has been called.)
service.onLoad = function ()
{
// it's now safe to use one-time headers
// these headers will be deleted (see code above) after being added to the method call.
service.headersForOneCall = new Array();
service.headersForOneCall.push (header2);
service.GetStockQuotes("macr,ibm");
// the one-time headers will not appear in this call
service.GetStockQuotes("abcd,efgh");
}
SaphuA
%Europe/Berlin %894 %2005, 22:28
Mjah idd een beetje extra info zou niet verkeerd zijn.
Als je wilt dat wij moeite voor jou doen kun je er best zelf ook wat moeite insteken.
ScriptSuite
%Europe/Berlin %468 %2005, 12:15
@Roenes: Het voorbeeld dat 'mateo)' is precies waar het om gaat.
Alleen zit daar geen voorbeeld van de daadwerkelijk SOAP header bij.
@mateo): Daar ben ik nu anderhalve week mee bezig. Op http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_19226 staan zelfs de originele technotes van mm. (dit stukje begrijp ik wel ;) ).
Wat echter onduidelijk is welke auth request de SOAP verwacht (dat is idg niet na te gaan).
// Stock Quote service; be advised that the headers that we send are
// not actually recognized by that service.
En daar gaat het mij nu om.
In mijn geval...... welke headers moeten nu verzonden worden.
Ik heb ook een voorbeeld van de verwachte header, maar ik kom er dan weer niet uit "hoe" deze in te bouwen.
Althans....., alle pogingen tot nu toe nog niet geslaagd.
De SOAP auth request is als volgt:
POST /Service.asmx HTTP/1.1
Host: foo.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.foo.com/Login"
<?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:Header>
<AuthHeaderCS xmlns="http://www.foo.com">
<Username>string</Username>
<Password>string</Password>
</AuthHeaderCS>
</soap:Header>
<soap:Body>
<Login xmlns="http://www.foo.com">
<username>string</username>
<password>string</password>
<sourcename>string</sourcename>
</Login>
</soap:Body>
</soap:Envelope>
@SaphuA : Daar heb je gelijk in, eens kijken of je nu de moeite kunt doen...
SaphuA
%Europe/Berlin %512 %2005, 13:18
Ben blij dat je toch even wat moeite gedaan hebt :) Ik probeerde je niet te beledigen, maar het is gewoon vervelend dat veel mensen denken dat iedereen maar meteen alles voor ze doet op een forum; want ze weten er toch wel alles vanaf.
Anywayz, kan je helaas niet helpen; heb nog steeds geen idee wat een soap header is.
Greetz
mateo)
%Europe/Berlin %947 %2005, 23:44
de vereiste soap headers moet je opvragen bij degene die de web service aanbiedt. die kan je vervolgens toevoegen op de manier waarop de headers in dat voorbeeldscript worden toegevoegd. dus in plaats van de headers die nu als voorbeeld worden toegevoegd moet je jouw headers zetten. pas trouwens wel op met die soap-toestand. verdoe je tijd er niet aan als het de bedoeling is een swf online te zetten die zijn data van een andere server vandaan trekt via soap. in de meeste gevallen is het nodig dat de site waar de web service staat een bestandje ter authenticatie neer moet zetten om de standaard security van flash gerust te stellen, een zogenaamde policy file (lees ook deze post daarover: http://www.flashfocus.nl/forum/showthread.php?t=3257&goto=newpost) en dat gaat natuurlijk in tegen alles waar soap voor staat. beter is het om te kiezen voor flash remoting (amf), ook wat de snelheid betreft. lees daarover bijvoorbeeld:http://www.flash-remoting.com/articles/fr2004pt1.cfm. of ga direct naar http://www.amfphp.org.
ScriptSuite
%Europe/Berlin %373 %2005, 09:58
Iedereen bedankt voor de tips, ik ben er uit..
mateo)
%Europe/Berlin %432 %2005, 11:22
met amfphp? gekozen voor nusoap? vertel...
ScriptSuite
%Europe/Berlin %371 %2005, 09:54
FLash <==> SOAP , verder geen enkele gateway.
Het zat 'm alleen in die auth. header, en dat is nu gepiept ;).
Verder werkt het als een speer en zal het niet lang duren voordat er thuis ook wat webservices geïnstalleerd gaan worden.
gbolssens
%Europe/Berlin %374 %2005, 09:59
waarschijnlijk een superstomme vraag:
Wat is SOAP?
mateo)
%Europe/Berlin %421 %2005, 11:06
heel in het kort: communicatie tussen twee servers met xml-berichtjes. soap is in feite een afspraak hoe die xml eruit moet zien.
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.