Solved

Consume a web service from the command line?

Posted on 2006-07-24
3
274 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Information security is a multi-billion dollar industry. Just as lucrative is the black market industry which trades stolen identities, credit card numbers and software exploits all over the world. Nothing is hack-proof. The best one can do is make …
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

13 Experts available now in Live!

Get 1:1 Help Now