• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to test webservice using a client

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

I am using tomcat version 5 and Axis 1_2RC2 .I have successfully deployed the web service http://localhost:8080/axis/helloWorld.jws .But i am unable to test the service .I have written a client code as follows :
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.Options;

import javax.xml.rpc.ParameterMode;

public class CalcClient
{
public static void main(String[] args) throws Exception
{



String endpoint = "http://localhost:8080/axis/HelloServer.jws";





String method = "sayHelloTo";



Service service = new Service();
Call call = (Call) service.createCall();

call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName( method );
call.addParameter( "op1", XMLType.XSD_STRING, ParameterMode.IN );
call.setReturnType( XMLType.XSD_STRING );
String ret = (String)call.invoke("","sayHelloTo",new Object [] {args[0]});
System.out.println(ret);
}
}

But when I try to execute this I am getting the following exceptions :

- Unable to find required classes (javax.activation.DataHandler and javax.mail.i
nternet.MimeMultipart). Attachment support is disabled.
Exception in thread "main" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.net.ConnectException: Connection refused: connect
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: Conne
ction refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSoc
ketFactory.java:138)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSoc
ketFactory.java:99)
at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:1
31)
at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.ja
va:370)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:88)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
y.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:147)
at org.apache.axis.client.Call.invokeEngine(Call.java:2719)
at org.apache.axis.client.Call.invoke(Call.java:2702)
at org.apache.axis.client.Call.invoke(Call.java:2378)
at org.apache.axis.client.Call.invoke(Call.java:2301)
at CalcClient.main(CalcClient.java:32)

{http://xml.apache.org/axis/}hostname:BCD-DDTQ

java.net.ConnectException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSoc
ketFactory.java:138)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSoc
ketFactory.java:99)
at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:1
31)
at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.ja
va:370)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:88)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
y.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:147)
at org.apache.axis.client.Call.invokeEngine(Call.java:2719)
at org.apache.axis.client.Call.invoke(Call.java:2702)
at org.apache.axis.client.Call.invoke(Call.java:2378)
at org.apache.axis.client.Call.invoke(Call.java:2301)
at CalcClient.main(CalcClient.java:32)

Can some please help as I am a newcomer to the web services .
Thanks
Parijat
 
Ranch Hand
Posts: 548
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
connection refused exception will come when u r behind a firewall and other proxy related issues. if so try below code in your client program:

System.setProperty("http.proxyHost", "<your proxy ip>");
System.setProperty("http.proxyPort", "<your proxy port>");
 
Parijat Mukherjee
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Priya ,

But I am not behind any firewall or proxy .Again the error saying "- Unable to find required classes (javax.activation.DataHandler and javax.mail.i
nternet.MimeMultipart)." is not understood as I have already set the classpath for activation.jar and mail.jar which has the above mentioned classes .
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Parijat Mukherjee:
Hi ,
I am using tomcat version 5 and Axis 1_2RC2 .I have successfully deployed the web service http://localhost:8080/axis/helloWorld.jws .But i am unable to test the service .



Can you see the wsdl file by using http://localhost:8080/axis/helloWorld.jws?wsdl ??
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Parijat,

You must start your Tomcat before running the AdminClient through java command.
As that class has a URL as command line argument http://localhost:8080/axis/services/AdminService
so the client needs to connect to the servlet.

Also, just for additional information, the command is,

java -classpath .;%CLASSPATH% org.apache.axis.client.AdminClient <.wsdd file path> -l http://localhost:8080/axis/services/AdminService

Best of luck !!!

Regards,
Ganesh A. Baviskar
 
reply
    Bookmark Topic Watch Topic
  • New Topic