aspose file tools*
The moose likes Linux / UNIX and the fly likes Invoke web service method from Unix command line Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Invoke web service method from Unix command line" Watch "Invoke web service method from Unix command line" New topic
Author

Invoke web service method from Unix command line

Mahita Ande
Greenhorn

Joined: Sep 26, 2012
Posts: 16
Hi,
I have a java web service running on Unix machine with an exposed web method to get number of users logged into another application. I am trying to invoke the web method using 'wget' command from the Unix command prompt to get the users info. But I only see the the connection was established and the bytes were downloaded. I do not see any return value. I am not sure if the method is executed to gather information about users. Please advise what modifiers should I use invoke the web method using wget or if there is any other command that would accomplish this.

Thank you,
Mahita
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41816
    
  62
From your description it's not clear whether this call supplies all the parameters necessary to execute the WS call, but wget writes whatever response it gets to a file in the current directory - so check if there are any new files, and what's in them.


Ping & DNS - my free Android networking tools app
Mahita Ande
Greenhorn

Joined: Sep 26, 2012
Posts: 16
The web method does not take any parameters. Signature of the web method is public void GetCPUUsed(). When i look into the files created by wget I do not see the returned value anywhere making me suspect if the method was executed to return the value.

Please advise.

Thank you,
Mahita
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41816
    
  62
Well, what is in those files? wget doesn't know the first thing about WS, it only understands HTTP.
Mahita Ande
Greenhorn

Joined: Sep 26, 2012
Posts: 16
Hi,
I exposed a method GetCPUUsage in my web service which returns a CPUUsed on system. When i use wget to call this method I have a file downloaded. Here is the content of the file.

<html>
<head><title>
Web Services
</title></head>
<body>
<h1>Web Services</h1>
<table width='100%' border='1'>
<tr>
<td>
Endpoint
</td>
<td>
Information
</td>
</tr>
<tr>
<td>
<table border="0"><tr><td>Service Name:</td><td>{http://Unix.Monitors.Pulse/}UnixService</td></tr><tr><td>Port Name:</td><td>{http://Unix.Monitors.Pulse/}UnixPort</td></tr></table>
</td>
<td>
<table border="0"><tr><td>Address:</td><td>http://dev05:40005/UnixMonitor/UnixMonitorService</td></tr><tr><td>WSDL:</td><td><a href="http://dev05:40005/UnixMonitor/UnixMonitorService?wsdl">http://dev05:40005/UnixMonitor/UnixMonitorService?wsdl</a></td></tr><tr><td>Implementation class:</td><td>Pulse.Monitors.Unix.Unix</td></tr></table>
</td>
</tr>
</table>
</body>
</html>

I do not see the returned value swhich gives me the CPUUsage anywhere in the file.

Thank you,
Mahita
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41816
    
  62
That looks like a WSDL - meaning, you're accessing a SOAP WS, not a REST WS. wget can't do that (unless it can somehow send content in the HTTP body, which I doubt).
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16055
    
  21

It's not a WSDL, but it is a description of presented services. And thus, it probably means that the URL that you used was not correct and should be formed in the way that the sample indicates.



[Thumbnail for service.jpg]



Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invoke web service method from Unix command line