Solved

Consume a web service from the command line?

Posted on 2006-07-24
3
278 Views
Last Modified: 2010-04-14
I'd like to consume a .NET web service from the command line, ideally, from within a shell script.  I could use automator, but it's limited to 10.4.  The plan is to get hardware information about a machine and then contact the web servive which records the information.
0
Comment
Question by:magronef
  • 2
3 Comments
 
LVL 24

Expert Comment

by:slyong
ID: 17191281
Hi,

Are you using SOAP or XML-RPC?
0
 

Author Comment

by:magronef
ID: 17192069
I'm using SOAP.
0
 
LVL 24

Accepted Solution

by:
slyong earned 125 total points
ID: 17196683
You can use AppleScript (ref: http://developer.apple.com/documentation/AppleScript/Conceptual/soapXMLRPC/chapter2/chapter_2_section_3.html)

set theText to "The spirit is willing but the flesh is weak."
set direction to "en_fr"
tell application "http://services.xmethods.net:80/perl/soaplite.cgi"
    set resultText to call soap {method name:"BabelFish", ¬
        method namespace uri:"urn:xmethodsBabelFish", ¬
        parameters:{translationmode:direction as string, ¬
        sourcedata:theText as string}, ¬
        SOAPAction:"urn:xmethodsBabelFish#BabelFish"}
end tell

If you want to call it from the shell, you can use osascript command (ref: http://developer.apple.com/documentation/Darwin/Reference/Manpages/man1/osascript.1.html)

Just add a line to the AppleScript above to return the value (assuming it is saved as soap.scpt):
return resultText

and from the shell do:
$ osascript soap.scpt
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Create a default user profile for Mac OS X 10.7/10.8 Create a user account on OS X that will be a template for every other user of that computer. I usually call it “profile” and make it an administrator account for the time being. 1. Install a…
iCloud Drive was introduced after iOS 8 was launched last year. This drive is Apple’s online storage device that lets users sync their files and access them from all their Apple devices.   There is a lot of data that is not automatically backed up…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now