Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Consume a web service from the command line?

Posted on 2006-07-24
3
Medium Priority
?
311 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 375 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

Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

Question has a verified solution.

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

Even though Mac OS X has been around for many years now, certain well-liked and eminently useful software apps never made the jump from Mac OS 9 to Mac OS X. Ever used Word Perfect for Mac? Version 3.5 was the last version, built for Mac OS 9. Who c…
A professional opinion on which Apple product to buy, and a tidbit about the WWDC.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

704 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