Re: still having trouble with SOAP
Re: still having trouble with SOAP
- Subject: Re: still having trouble with SOAP
- From: Matt Neuburg <email@hidden>
- Date: Sat, 03 Sep 2005 18:25:06 -0700
On or about 9/2/05 7:35 PM, thus spake "Mark J. Reed" <email@hidden>:
> 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.
Could you file it? I'm not competent; I don't understand the bug and
wouldn't be able to describe it correctly. I had an intuition that it had to
do with namespaces, but at that point my eyes started to glaze over...!
So, meanwhile, can I correctly state in the MS of my book revision that
"call soap" sometimes generates badly-formed XML? m.
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
AppleScript: the Definitive Guide -
http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt
Take Control of Word 2004, Tiger, and more -
http://www.takecontrolbooks.com/tiger-customizing.html
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
_______________________________________________
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