我創建了罰款運行一個簡單的Web服務: 接口:JAX web服務不CodenameOne項目工作
@WebService
@SOAPBinding(style = Style.RPC)
public interface HelloService {
@WebMethod
void sayHello();
}
實現的服務:
@WebService(endpointInterface = "mypackage.HelloService")
public class HelloServiceImpl implements HelloService {
@Override
public void sayHello() {
System.out.println("Hello world");
}
出版商:
public class HelloServicePublisher {
public static void main(String[] args) {
Endpoint.publish("http://localhost:8080/hello", new HelloServiceImpl());
}
}
當我使用下面的客戶端代碼創建一個普通的JAVA項目時,它完美地工作:
public class Client {
public static void main(String[] args) throws Exception {
URL url = new URL("http://localhost:8080/hello?wsdl");
// 1st argument service URI, refer to wsdl document above
// 2nd argument is service name, refer to wsdl document above
QName qname = new QName("http://server/", "HelloServiceImplService");
Service service = Service.create(url, qname);
HelloService server = service.getPort(HelloService.class);
server.sayHello();
}
}
這個編譯和運行良好。當我非常相同的客戶端代碼複製到一個純新項目CN1,我在service.getPort()調用得到一個零點例外:
at com.sun.xml.internal.ws.model.RuntimeModeler.getPortTypeName(Unknown Source)
at com.sun.xml.internal.ws.model.RuntimeModeler.getPortTypeName(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
at javax.xml.ws.Service.getPort(Unknown Source)
所以現在的問題是:在創建時,究竟什麼是不同的CN1項目與普通Java項目相比較?它與代碼無關,因爲這很明顯。 欣賞任何提示。
感謝和問候
嗯,好吧。不完全是我想聽到的,但至少是一個堅定的聲明。我對CN1和webservices都是新手,所以首先我按照我希望他們的樣子在服務器端上運行我的Web服務。現在我必須將其重寫爲任何CN1支持的Web服務。 但是,這是一個偉大的經驗,學習和有史以來這麼慢,我越來越得到這一切如何工作。感謝你的幫助! – Lequi