File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to invoke web service implemented in MS.NET

 
tom chansky
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The endpoint address wouldn't include the "?WSDL" part.
 
tom chansky
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does it have something to with proxy setting? if true, how to set this up in Axis?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic