Re: still having trouble with SOAP
Re: still having trouble with SOAP
- Subject: Re: still having trouble with SOAP
- From: Michael Grant <email@hidden>
- Date: Thu, 9 Jul 2009 21:44:50 -0500
Anyone know a working (and AppleScript-accessible) currency exchange
rate server? This one seems to have blinked out a couple of years ago.
Thanks,
Michael
On Sat, Sep 3, 2005 at 12:42 PM, wrote:
> On 3 Sep 2005, at 17:26, Simon Topliss wrote:
>
>> On 2 Sep 2005, at 19:52, Matt Neuburg wrote:
>>
>>> [Resent because no one responded and I have not seen it show up in the
>>> list
>>> digest. Those who insist that SOAP works, please help me out here!]
>>>
>>> I'm still having trouble with AppleScript's implementation of SOAP. I'm
>>> trying to call the service described here:
>>>
>>> http://www.xmlme.com/WSShakespeare.asmx?op=GetSpeech
>>>
>>> Here is my AppleScript code, which is not working:
>>>
>>> tell application "http://www.xmlme.com/WSShakespeare.asmx"
>>> call soap {method name:"GetSpeech",
>>> SOAPAction:"http://xmlme.com/WebServices/GetSpeech",
>>> parameters:{|Request|:"poor and content is rich"}, method namespace
>>> uri:"http://xmlme.com/WebServices"}
>>> end tell
>>>
>>> What I need to form, according to the authorities, is a request that
>>> looks
>>> like this:
>>>
>>> POST /WSShakespeare.asmx HTTP/1.1
>>> Host: www.xmlme.com
>>> Content-Type: text/xml; charset=utf-8
>>> Content-Length: length
>>> SOAPAction: "http://xmlme.com/WebServices/GetSpeech"
>>>
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>> <soap:Body>
>>> <GetSpeech xmlns="http://xmlme.com/WebServices">
>>> <Request>string</Request>
>>> </GetSpeech>
>>> </soap:Body>
>>> </soap:Envelope>
>>>
>>> What I'm actually sending (snooped with Interarchy) looks more like this:
>>>
>>> POST /WSShakespeare.asmx HTTP/1.1
>>> User-Agent: Mac OS X; WebServicesCore.framework (1.1.0)
>>> Host: www.xmlme.com
>>> Content-Type: text/xml
>>> Soapaction: "http://xmlme.com/WebServices/GetSpeech"
>>> Content-Length: 608
>>> Connection: close
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <SOAP-ENV:Envelope
>>> xmlns:xsd="http://www.w3.org/1999/XMLSchema"
>>> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
>>> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>>> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
>>> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
>>> <SOAP-ENV:Body>
>>> <m:GetSpeech xmlns:m="http://xmlme.com/WebServices">
>>> <Request xsi:type="xsd:string">poor and content is
>>> rich</Request>
>>> </m:GetSpeech>
>>> </SOAP-ENV:Body>
>>> </SOAP-ENV:Envelope>
>>>
>>> Not very much alike, are they? Yet it seems to me I'm getting correct
>>> every
>>> parameter I'm allowed to supply. Another thing I notice that might be a
>>> problem is that my header is called Soapaction, whereas the proper
>>> capitalization is called SOAPAction; I don't know whether http headers
>>> are
>>> case-sensitive, I'm just looking for every possible source of error.
>>>
>>> I can't help feeling that the schema for SOAP has changed dramatically
>>> and
>>> that AppleScript's implementation is failing to keep up. But perhaps
>>> someone
>>> can show me how to call this service successfully using AppleScript? Thx
>>> -
>>> m.
>>
>> Matt, not sure if you saw my reply to your other SOAP thread, but the
>> service your trying to get is a MS.NET web service. The server *must* be
>> configured correctly for it to work with AppleScript's implementation of
>> SOAP.
>>
>> The default setting for MS.NET is document-literal. You need to use the
>> SoapRpcMethod attribute (from the System.Web.Services.Protocols namespace)
>> before your webmethod like this: <WebMethod(),SoapRpcMethod()> your
>> webmethod here.
>
> Matt, I've managed find one that works correctly with AS on xmethods web
> site. It's only the 'RPC' style web services that work correctly with AS,
> the DOC ones don't.
>
> SOAP_call("http://services.xmethods.net:80/soap", "getRate",
> "urn:xmethods-CurrencyExchange", {country1:"UK", country2:"US"}, "")
>
> on SOAP_call(SOAP_Endpoint_URL, method_name, method_namespace_URI,
> method_parameters, SOAP_action)
> try
> using terms from application "http://www.apple.com/placebo"
> tell application SOAP_Endpoint_URL
> set this_result to call soap ¬
> {method name:method_name ¬
> , method namespace uri:method_namespace_URI ¬
> , parameters:method_parameters ¬
> , SOAPAction:SOAP_action}
> end tell
> end using terms from
> return {true, this_result}
> on error error_message number error_number
> if the error_number is -916 then ¬
> set the error_message to "The script was unable to establish a connection to
> the Internet."
> return {false, error_message}
> end try
> end SOAP_call
>
> Simon _______________________________________________
> 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
>
--
You have to be happy with what you have to be happy with what you have
to be happy with.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden