• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: SOAP (is very dirty)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SOAP (is very dirty)


  • Subject: Re: SOAP (is very dirty)
  • From: "Adam Bell" <email@hidden>
  • Date: Sun, 30 Apr 2006 13:02:32 -0300



On 4/30/06, Björn Lundin <email@hidden> wrote:

30 apr 2006 kl. 14.16 skrev Gary (Lists):

"Björn Lundin" skrev:

29 apr 2006 kl. 00.57 skrev Gary (Lists):
I am trying to utilize the service definition found here:

< http://www.xmethods.net/sd/2001/CurrencyExchangeService.wsdl>

This perhaps does not help you, but it may make you feel better :-)

Ja! Tack! ;)

Always nice to read the language of the bold and brave ;-)

I know you don't want a temperature unit converter, but this one works.

set t1 to 100
tell application " http://services.soaplite.com/temper.cgi"
set returnValue to call soap {method name:"c2f", method namespace uri:¬
" http://www.soaplite.com/Temperatures", parameters:{temp: t1}, SOAPAction:""}
end tell

display dialog returnValue

meaning the syntax you had last in original mail, proberbly is ok

I think your syntax is ok; the exchange server is down. I use this script (which normally works quite well) to get US/Canadian exchange rates. Now it times out. (It uses growl for the answer, but easy to convert to a dialog)

set c1 to "united states"
set c2 to "canada"
-- get the rate
--set countryList to {"canada"}
set mn to "getRate"
set mnsurl to "urn:xmethods-CurrencyExchange"
set exch_rates to {}
try
    with timeout of 60 seconds
        --repeat with c2 in countryList
        tell application "http://services.xmethods.net:9090/soap/servlet "
            set theResult to ¬
                call soap {method name:mn, parameters:{country1:c1, country2:c2}, method namespace uri:mnsurl}
        end tell
        set end of exch_rates to {(contents of c2), (theResult as number)}
        --end repeat
    end timeout
on error
    tell application "GrowlHelperApp"
        notify with name "ExchRates" title "Exchanger Rate Unavailable" description "Server not Responding" application name "ExchRates" image from location alias "ACB-G5_1:Users:bellac:Pictures: Dollar.png"
    end tell
    return
end try

set theRate to (item 2 of item 1 of exch_rates)
set invRate to round_truncate(100 * (1 / theRate), 3)
set msg1 to "$" & theRate & " ± $0.02"
set msg2 to invRate & "¢ ± 2¢"

tell application "GrowlHelperApp"
-- my notification goes here
end tell

on round_truncate(this_number, decimal_places)
    if decimal_places is 0 then
        set this_number to this_number + 0.5
        return number_to_text(this_number div 1)
    end if
   
    set the rounding_value to "5"
    repeat decimal_places times
        set the rounding_value to "0" & the rounding_value
    end repeat
    set the rounding_value to ("." & the rounding_value) as number
   
    set this_number to this_number + rounding_value
   
    set the mod_value to "1"
    repeat decimal_places - 1 times
        set the mod_value to "0" & the mod_value
    end repeat
    set the mod_value to ("." & the mod_value) as number
   
    set second_part to (this_number mod 1) div the mod_value
    if the length of (the second_part as text) is less than the ¬
        decimal_places then
        repeat decimal_places - ¬
            (the length of (the second_part as text)) times
            set second_part to ("0" & second_part) as string
        end repeat
    end if
   
    set first_part to this_number div 1
    set first_part to number_to_text(first_part)
    set this_number to (first_part & "." & second_part)
   
    return this_number
end round_truncate

on number_to_text(this_number)
    set this_number to this_number as text
    if this_number contains "E+" then
        set x to the offset of "." in this_number
        set y to the offset of "+" in this_number
        set z to the offset of "E" in this_number
        set the decimal_adjust to characters (y - (length of this_number)) thru ¬
            -1 of this_number as string as number
        if x is not 0 then
            set the first_part to characters 1 thru (x - 1) of this_number as string
        else
            set the first_part to ""
        end if
        set the second_part to characters (x + 1) thru (z - 1) of this_number as string
        set the converted_number to the first_part
        repeat with i from 1 to the decimal_adjust
            try
                set the converted_number to ¬
                    the converted_number & character i of the second_part
            on error
                set the converted_number to the converted_number & "0"
            end try
        end repeat
        return the converted_number
    else
        return this_number
    end if
end number_to_text
 


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden

This email sent to email@hidden




--
Some minds remain open long enough for a truth to both enter and leave without processing.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: SOAP (is very dirty) (From: "Gary (Lists)" <email@hidden>)
 >Re: SOAP (is very dirty) (From: Björn Lundin <email@hidden>)

  • Prev by Date: Correct syntax for GUI Scripting 'click at' command
  • Next by Date: Re: Stopping dialogue window from appearing on launch
  • Previous by thread: Re: SOAP (is very dirty)
  • Next by thread: Folder Size Applescript
  • Index(es):
    • Date
    • Thread