i'm trying to study about how to access external web services. I have created a Web Service Client in eclipse for the following web service:
http://www.webservicex.net/ws/WSDetails.aspx?WSID=9&CATID=2
And I tried to access this web service with the next code:
public static void main(String[] args) {
try{
StockQuoteLocator locator = new StockQuoteLocator();
locator.setEndpointAddress("StockQuoteSoap", "http://www.webservicex.net/stockquote.asmx");
StockQuoteSoapStub stock = new StockQuoteSoapStub(locator);
System.out.println(stock.getQuote("TEVA"));
} catch (Exception e){
e.printStackTrace();
}
}
But i'm keep getting the error:
06/02/2012 11:29:51 org.apache.axis.utils.JavaUtils isAttachmentSupported
WARNING: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
AxisFault
faultCode: {http://xml.apache.org/axis/}Server.NoEndpoint
faultSubcode:
faultString: No endpoint
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}exceptionName:org.apache.axis.NoEndPointException
{http://xml.apache.org/axis/}stackTrace:No endpoint
at NET.webserviceX.www.StockQuoteSoapStub.getQuote(StockQuoteSoapStub.java:93)
at Main.main(Main.java:17)
{http://xml.apache.org/axis/}hostname:MICHALEDR-DTW7
No endpoint
at NET.webserviceX.www.StockQuoteSoapStub.getQuote(StockQuoteSoapStub.java:93)
at Main.main(Main.java:17)
Can you please help me fix it?
It clearly says that those classes are missing in your classpath.
Add activation.jar and javamail.jar to your classpath.