Let's discuss options for the hotfix offline.

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of jamiebadman
Sent: Tuesday, May 08, 2007 4:53 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Setting ByteArray to a specific string value ?



Thanks for the info. Does this mean that until the hotfix is 
released, there's no way I can call this webservice from Flex? 
Unfortunately time constraints on this mean I need to find a way to 
do this asap so waiting for a fix won't be an option. Don't suppose 
this fix is already in Flash 9 is it ? I could possibly create a 
function in Flash for the call to the webservice then embed the 
Flash in Flex and call the Flash function from the Flex... would 
that work ?!

BTW - an earlier post suggested I try writeUTFBytes - unfortunately 
it doesn't seem to work. Here's what happens...

My string in Flex, for example, might be 'FRED'... so I do this:

var bAryObj:ByteArray = new ByteArray();
var password:String = "FRED";
bAryObj.writeUTFBytes(password);

If I look in bAryObj I can see it is 4 bytes in size.

So I then call the webservice and look at the packet sent to it via 
Ethereal which shows me this:

<ns0:password xmlns:ns0="http://xxx.yyy.com <http://xxx.yyy.com> ">
R1JFRA==
</ns0:password>

And then of course the service fails with invalid username/password.

So what is happening is, the bAryObj is being 64-bit encoded before 
it gets sent to the service. Normally this would be fine - but 
unfortunately in this case, I do not want the encoding to take 
place - because the string I have is already encoded.

I thought maybe I could decode it then pass THAT value across so it 
then gets encoded back to the original but unfortunately the decoded 
version does not seem to be a string at all; it's a true binary 
array.

Any ideas ?

Jamie.

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Peter Farland" <[EMAIL PROTECTED]> 
wrote:
>
> The new WebService implementation due out soon in Flex 2.0.1 
Hotfix 2
> (developed during the LCDS 2.5 timeframe) should fix this problem.
> 
> FWIW, there is a Base64Encoder in rpc.swc that is not yet 
documented
> (but will be in the next version of Flex). Here's how you can use 
it
> now:
> 
> import mx.utils.Base64Encoder;
> 
> // ...
> 
> var encoder:Base64Encoder = new Base64Encoder();
> encoder.encode(myPassword);
> var encodedPassword:String = encoder.drain();
> 
> 
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>

[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of jamiebadman
> Sent: Friday, May 04, 2007 6:46 AM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Setting ByteArray to a specific string 
value ?
> 
> 
> 
> Ok, I'm not even sure if the topic is right... here's what I'm 
> trying to do...
> 
> I need to call a webservice which has as a parameter a base 64 
> binary field. This needs to contain a password field in an 
encrypted 
> (string) form. This has been provided to me as a string and it is 
> this exact value I need to send to the webservice.
> 
> So I tried first sending it as a string but when I run ethereal 
> (which shows me what's actually being sent to the webservice) I 
see 
> that no data is being sent for the password.
> 
> So I tried using ByteArray instead - and this shows data being 
sent -
> but not the data I tried to store in the ByteArray... I tried 
> storing the string into the ByteArray using writeUTF, 
> writeMultiByte, looping through the string and storing each char 
> code in each ByteArray element... no luck as yet - the value of 
the 
> ByteArray being sent to the Service always seems to have a value 
> different from the value I'm trying to set it to!
> 
> I'm certain this is a case of pure ignorance on my part - does 
> anyone both understand what I'm trying to do and also understand 
why 
> it's not right ?! If so... help!!!!
> 
> Thanks,
> 
> Jamie.
>



 

Reply via email to