【问题标题】:Creating Java web service client创建 Java Web 服务客户端
【发布时间】:2012-02-06 09:31:51
【问题描述】:

我正在研究如何访问外部网络服务。 我在 Eclipse 中为以下 Web 服务创建了一个 Web 服务客户端:

http://www.webservicex.net/ws/WSDetails.aspx?WSID=9&CATID=2

我尝试使用以下代码访问此 Web 服务:

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();
    }   
}

但我不断收到错误:

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)

你能帮我解决一下吗?

【问题讨论】:

    标签: java web-services apache wsdl axis


    【解决方案1】:

    它清楚地表明您的类路径中缺少这些类。

    将activation.jar 和javamail.jar 添加到您的类路径中。

    【讨论】:

    • 这不是答案。上面有两个问题,你只是修复警告,而不是错误。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-04
    • 1970-01-01
    • 1970-01-01
    • 2010-11-09
    • 2010-09-17
    相关资源
    最近更新 更多