2010-07-21 95 views
1

我寫了一個簡單的Java文件Calculator.java如下軸webservice的錯誤

public class Calculator { 
    public int add(int a, int b) { 
     return a+b; 
    } 
    public int subtract(int a, int b) { 
     return a-b; 
    } 
} 

現在,我把它改名爲Calculator.jws並把它放在我的web應用程序的根目錄。 (與WEB-INF目錄在同一個目錄中)。當我嘗試使用http://localhost:8680/webappcontextroot/Calculator.jws訪問此web服務,我得到一個消息說

「有一個Web服務在這裏。點擊查看WSDL」

當我點擊鏈接查看WSDL文件我得到一個錯誤,

AXIS錯誤

無法生成WSDL!

有在這個位置

當我寫了一個客戶端調用Web服務無SOAP服務,我得到一個軸故障

- Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled. 
Exception in thread "main" AxisFault 
faultCode: {http://xml.apache.org/axis/}Server.NoService 
faultSubcode: 
faultString: The AXIS engine could not find a target service to invoke! targetService is null 
faultActor: 
faultNode: 
faultDetail: 
    {http://xml.apache.org/axis/}hostname:D78D46BS 

軸引擎找不到目標服務調用! targetService爲空

WSDL文件似乎丟失;但是oreilly教程告訴你所要做的只是將你的java文件複製到一個.jws文件中,並將其放入你的web應用程序中,並且webservice已準備好使用。

有人可以幫助我嗎?

回答

1

完全依賴於錯誤消息,似乎您的類路徑中缺少mailapi.jar和activation.jar庫。將這些文件放在您的axis.jar所在的文件夾中,然後重新啓動Web服務器。