Re: still having trouble with SOAP
Re: still having trouble with SOAP
- Subject: Re: still having trouble with SOAP
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 2 Sep 2005 22:35:02 -0400
On 9/2/05, Matt Neuburg <email@hidden> wrote:
> I've provided the code I'm using; you try it, and tell *me* what happens for
> *you*. :)
I get this helpful error:
http://www.xmlme.com/WSShakespeare.asmx got an error: Server was
unable to process request. --> Object reference not set to an instance
of an object.
> All I want to know is the correct AppleScript code. I don't care how stupid
> I'm being; just help me out by showing me the right code.
Wasn't claiming you were being stupid. Just trying to debug the XML
in case there's something wrong with what AppleScript is generating.
And there was nothing obvious to me. (Well, the Content-Length is
wrong, which I assume is because of editing on your part).
So I tried copying and pasting the sample code. Worked. Copying and
pasting the AS-generated code (with corrected content length); same
error as running it from AS. OK. So I started systematically
changing the sample code one thing at a time to make it more like the
AS-generated version. Found the problem. and it's not your code -
it's a bug in AppleScript. You may somehow be doing something to
trigger it where other folks aren't, which is why they claim it works,
but I don't see how; your script is dead simple.
Here's the problem. Correct XML:
<GetSpeech xmlns="http://xmlme.com/WebServices">
<Request>string</Request>
</GetSpeech>
Incorrect XML:
<m:GetSpeech xmlns:m="http://xmlme.com/WebServices">
<Request xsi:type="xsd:string">poor and content is rich</Request>
</m:GetSpeech>
See the difference? The sample code makes
http://xmime.com/WebServices the *default* namespace via xmlns=. The
code generated by AS is making it just another namespace with an
associated prefix - in this case "m:". Then it correctly puts the m:
prefix on the GetSpeech element tags - but NOT on the Request element
tags! Thus the XML is not well-formed and the request failed.
The solution is to change <Request to <m:Request and </Request> to
</m:Request> (and add 4 to the Content-Length), or else to get rid of
the ":m" from the xmlns:m, and likewise get rid of the "m:" in front
of the two instances of GetSpeech (and then remove 6 from the content
length).
So, it's a bug - AS is generating bad XML. File it.
--
Mark J. Reed <email@hidden>
_______________________________________________
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