Solved

Consume a web service from the command line?

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
Apple's Mac OS X has become an official member of the malware club. The Flashback Trojan has affected over half million Macs, worldwide. It is behavior that ultimately gets malware onto a person’s computer. Obsolete or out-of-date software helps…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

617 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