• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

calling asp webservice from tomcat 5 based app

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a java web app running in Tomcat 5, I want to start calling webservices written in ASP .NET from the Java application.

What do I need (Do I need to install AXIS or SOAP ) ? and How do I do it ( and if you have a simple example) ?.

I have never done any webservices before...

Thanks in advance
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the webservice you need to call is SOAP based and has a WSDL (Web Services Descriptive Langauge) document, you should be able to create a Java client with the AXIS2 toolkit. In theory, the language used to write the service should make no difference.

Wikipedia has a convenient summary of the role of WSDL.

The AXIS2 download is full of examples.

Bill
 
Elias Ta
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bill..
This is what I did and failed ( It won't even get to the first line in the try block) , can you please suggest anything? Thanks so much..

1. I downloaded Axis into my tomcat/webapps/axis
2. set my classpath as
C:\axis\axis-1_4\lib\axis.jar;C:\axis\axis-1_4\lib\axis-ant.jar;C:\axis\axis-1_4\lib\commons-discovery-0.2.jar;C:\axis\axis-1_4\lib\commons-logging-1.0.4.jar;C:\axis\axis-1_4\lib\jaxrpc.jar;C:\axis\axis-1_4\lib\saaj.jar;C:\axis\axis-1_4\lib\wsdl4j-1.5.1.jar;

3. Went through check list for proper installation and confirmed that I have all required classes found..

4. The webservice url is http://services.lpcorp.com/TestService/testservice.asmx

and I use the following client to call..

package com.servicelane.helpers;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;

import org.apache.log4j.Category;
public class AxisClient {

private static Category message;
public String getTestMath() {
String retString = "";
try {
message.info("about to call endpoint");
String endpoint = "http://services.lpcorp.com/TestService testservice.asmx";

Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName("TestMath");
Integer i1 = new Integer(5);
Integer i2 = new Integer(9);

Integer ret = (Integer) call.invoke( new Object[] { i1, i2 } );
retString = ret.toString();
} catch (Exception e) {
message.info("Exception in trying to getTestmath is :" + e);
}
return retString;

} //end of local method
} // end of class
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

failed ( It won't even get to the first line in the try block) , can you please suggest anything?



No - Because you dont say what actually happened!

If you never got to the start of the try, how do you know getTestMath() was even called.
 
Elias Ta
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay please help me with how to build a client for a webservice..
This is where I am
1. I downloaded Axis2 and went through with samples being able to deploy the services bla bla.. I didn't do anything but to follow the steps
2. I can't seem to understand building the client. They have five ways of doing it but I don't know what they are talking about..

Can you please give me a sample of client for a webservice that is on
http://services.lpcorp.com/TestService/testservice.asmx

I appreciate your help..
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd start by pointing Axis' wsdl2java tool at the WSDL of the web service you've deployed. That will create a number of Java classes that can be used to build a client. The Axis Quick Start Guide talks about how to use the tool.
 
I miss the old days when I would think up a sinister scheme for world domination and you would show a little emotional support. So just look at this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic