Solved

Consume a web service from the command line?

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

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…
This article describes in detail how to set up the iPad in the Enterprise using iPCU aka iPhone Configuration Utility.  This could also be used for the iPhone although I have not detailed out any differences. Preparation as an iPad Administrator:…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

730 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