aspose file tools*
The moose likes Web Services and the fly likes how to invoke web service implemented in MS.NET Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "how to invoke web service implemented in MS.NET" Watch "how to invoke web service implemented in MS.NET" New topic
Author

how to invoke web service implemented in MS.NET

tom chansky
Greenhorn

Joined: Nov 01, 2004
Posts: 28
I'm a new to web services.

I tried to create a java client using Apache Axis to call a Stock Quotes web service, which can be found in "http://ws.invesbot.comstockquotes.asmx". The following are part of the codes.

...
String endpointURL = "http://ws.invesbot.com/stockquotes.asmx?WSDL";
String input = args[0];
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpointURL) );
call.setOperationName( new QName("http://ws.invesbot.com/", "GetQuotes") );
call.addParameter( "symbol", XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING);
String ret = (String) call.invoke( new Object[] { input } );
...

When I ran that class, "java -cp .:$AXISCLASSPATH MyJavaClient goog", I got a response of "java.net.ConnectException: Connection timed out". Why?? I thought a java SOAP client can invoke web services implemented in any platforms.

But, I have no problems in calling the web services samples provided by Axis from my localhost.

Any ideas???
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42277
    
  64
The endpoint address wouldn't include the "?WSDL" part.


Ping & DNS - my free Android networking tools app
tom chansky
Greenhorn

Joined: Nov 01, 2004
Posts: 28
got rid of "?WSDL", but i got the same error msg.

in Axis user's guide, i saw something about WSDL2Java. Do i have to transform that wsdl file to java for the purpose of binding before my java client can talk to a MS.NET web service?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42277
    
  64
WSDL2java creates a JAX-RPC client, but since you already have a SAAJ client, you should be all set. The whole point of web services is that it shouldn't matter what language the client and the server are written in; as long as they conform to WSI Basic Profile, they should be able to interact just fine.
tom chansky
Greenhorn

Joined: Nov 01, 2004
Posts: 28
if i go to that web service site and ivoke their "GetQuotes" operation, everything is fine.

So, how come I can't call that operation from a command-line client? Is there something that I'm missing??
tom chansky
Greenhorn

Joined: Nov 01, 2004
Posts: 28
does it have something to with proxy setting? if true, how to set this up in Axis?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42277
    
  64
Looking at the WSDL a bit more closely, I noticed that /GetQuotes is actually an HTTP operation, not a SOAP operation. So the request must not be SOAP, but HTTP. If you go to this URL, you'll get an XML file (also not SOAP) back with information. Some of the other calls are proper SOAP operations, though.
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by tom chansky:

When I ran that class, "java -cp .:$AXISCLASSPATH MyJavaClient goog", I got a response of "java.net.ConnectException: Connection timed out". Why?? I thought a java SOAP client can invoke web services implemented in any platforms.


Did you tried again....
I got some free time today...so i tried to access this services from java console and its works fine.
I did wsdl2java, then tried to consume the service GetQuotes and it returned me the complexobject as result.

Tips..
1.Try to run the wsdl2java again...
2. check for proxy.... (did you get connection timeout for any other webservices),??
3. did you tried to access this service using .NET? I did and it worked.


Spritle Software Blogs
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by Ulf Dittmer:
Looking at the WSDL a bit more closely, I noticed that /GetQuotes is actually an HTTP operation, not a SOAP operation. So the request must not be SOAP, but HTTP. If you go to this URL, you'll get an XML file (also not SOAP) back with information. Some of the other calls are proper SOAP operations, though.


Ulf...
.NET as the habit to emit xml for browser based direct url invokation. The service reply back SOAP only and not raw xml as HTTP.

You can test it here http://www.mgateway.com/scripts/mgwms32.dll?MGWLPN=EXTC&wlapp=wsdlValidator&eXtcCalledFrom=MGateway
Sonal Jogi
Greenhorn

Joined: Oct 19, 2004
Posts: 23
Hi,

Even i am getting the same problem with all the web services exposed on net. Did anyonw find the solution? We access internet through a proxy. How to do proxy settings in Axis?

Thanks in advance,
sonal
 
Don't get me started about those stupid light bulbs.
 
subject: how to invoke web service implemented in MS.NET