Re: XML-RPC call fails with -916 error
Re: XML-RPC call fails with -916 error
- Subject: Re: XML-RPC call fails with -916 error
- From: Ron Bishop <email@hidden>
- Date: Fri, 15 Feb 2002 09:04:28 -0600
Your script seems to connect for me, but doesn't pass the information.
You seem to have the parameters set incorrectly - they should be set as
such. Notice the variable "myText" is not in brackets.
set myText to "My frstt naem is John"
tell application "
http://www.stuffeddog.com/speller/speller-rpc.cgi"
set returnValue to call xmlrpc {method name:"speller.spellCheck",
parameters:myText}
end tell
Once that was corrected, I received the results back from the internet
service. Here is the original script from the Apple Site if anyone else
is interested. I simply copied it, pasted it into Script Debugger,
compiled it, and then it ran without a problem. Make sure you're
connected to the net and try that. As it's running have the Apple Events
Log open so you can watch what is happening.
---- Main script ----------------------------------------
-- Supply default text to spell check.
set spellCheckText to "My frst naem is John"
----Query user for different text to check.
set dialogResult to display dialog B,
"Enter a phrase to spell check:" default answer spellCheckText
if button returned of dialogResult is "OK" then
set spellCheckText to text returned of dialogResult
-- Call spellCheck handler.
set resultList to spellCheck(spellCheckText)
(*
The returned data looks something like this:
{{suggestions:{"fast", "fest", "first", "fist", "Forst",
"frat", "fret", "frist", "frit", "frost", "frot", "fust"},
location:4, |word|:"frst"}, {suggestions:{"haem", "na em",
"na-em", "naam", "nae", "nae m", "nae-m", "nael", "Naim",
"nam", "name", "neem"}, location:9, |word|:"naem"}}
*)
-- Make list of words to spellcheck.
set wordList to every word of spellCheckText
-- Give user chance to correct each misspelled word.
repeat with eachItem in resultList
set newWord to choose from list suggestions of eachItem B,
with prompt "You misspelled \"" & |word| of eachItem & B,
"\"" without multiple selections allowed
-- If user selected a corrected word, insert it into list
if (newWord as string) is not equal to "false" then
set wordIndex to B,
findIt(every word of spellCheckText, location of eachItem)
copy newWord to item wordIndex of wordList
end if
end repeat
-- Disply corrected text.
set spellCheckText to ""
repeat with oneWord in wordList
set spellCheckText to spellCheckText & oneWord & " "
end repeat
display dialog "Corrected text: " & spellCheckText
end if
-- spellCheck handler ------------------------------------------
-- This handler makes the remote procedure call.
on spellCheck(sentence)
tell application "
http://www.stuffeddog.com/speller/speller-rpc.cgi"
return call xmlrpc {method name:"speller.spellCheck",
parameters:sentence} B,
end tell
end spellCheck
-- findIt handler ------------------------------------
-- The "textList" parameter is a list of the words in the original text.
-- The "index" parameter is the character index of a misspelled word.
-- This handler returns the word at that index.
-- For example, the misspelled word at character index four is "frst".
-- Its word index is 2 (the 2nd word in the original text).
on findIt(textList, index)
set curLength to 0
set ixWord to 1
repeat with oneWord in textList
set curLength to curLength + (length of oneWord) + 1
if curLength b % index then
exit repeat
end if
set ixWord to ixWord + 1
end repeat
log ixWord
return ixWord
end findIt
Ethan Wilde's book, AppleScript for Applications has a good example of
AppleScript and SOAP. Also the the site www.xmethods.com has been
helpful to me. This looks to really add to what AppleScript can do.
Good luck,
On Thursday, February 14, 2002, at 08:24 PM, Yosuke Ichikawa wrote:
Having been told that AppleScript now supports a wonderful protocol
called
xml-rpc, I'm trying out some simple sample scripts. But I can't get them
to
work. Can someone tell this web services newbie what might be wrong?
The two scripts I've tried are both taken directly from tutorials.
One from an Oreilly article;
http://www.oreillynet.com/lpt/a//mac/2002/02/01/applescript_macosx.html
tell application "http://time.xmlrpc.com/RPC2"
set returnValue to call xmlrpc ,
{method name:"currentTime.getCurrentTime"}
set theDate to (returnValue as date) + (3 * hours)
end tell
Another from an Apple document;
http://developer.apple.com/techpubs/macosx/Carbon/interapplicationcomm/s
oapX
MLRPC/chapter2/index.html
set myText to "My frstt naem is John"
tell application "http://www.stuffeddog.com/speller/speller-rpc.cgi"
set returnValue to call xmlrpc ,
{method name:"speller.spellCheck", parameters:{myText}}
end tell
In both scripts, I get a type -916 error at the call xmlrpc part.
- I do have an internet connection on 10.1.2, and have no problem
viewing on
IE the sites the scripts are trying to call.
- One thing is that our LAN does not support SSL connection. Could this
be
it?
- I've searched the list archives but I couldn't find the answer there.
Thanks in advance,
Yosuke Ichikawa
Ron Bishop
Macintosh Systems Administrator
The Kansas City Star
1729 Grand Boulevard
Kansas City, Missouri 64108
(816) 234 - 4943
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.