WebServiceアノテーションがクラスに存在しません:com.java1234.service.IUserService



Webservice Annotation Is Not Present Class



クライアントに行ってクラスを見つけ、エラーに注意してください

さらに、WebServiceアノテーション



webService作成プロセスを添付します



1. 2つのプロジェクトを別々に作成し、Webサービスを右クリックします

2.webserviceClientは、サーバーを直接起動してwsdlにアクセスします

package com.java1234.service import java.io.IOException import java.net.MalformedURLException import java.net.URL import javax.xml.namespace.QName import javax.xml.ws.Service public class Test { public static void main(String[] args) throws Exception { URL url = new URL('http://localhost:9998/userService?wsdl') / / Create a service name //1.namespaceURI - namespace address //2.localPart - the service view name QName qname = new QName('http://impl.service.java1234.com/', 'userService') / / Create a service view / / Parameter explanation: //1.wsdlDocumentLocation - wsdl address //2.serviceName - the name of the service Service service = Service.create(url, qname) / / Get the service implementation class IUserService mobileCodeWSSoap = service.getPort(IUserService.class) / / Call the query method String result = mobileCodeWSSoap.sayHello('nihao') System.out.println(result) /* IUserServiceProxy helloPxy = new IUserServiceProxy() IUserService service = helloPxy.getIUserService() String res = service.sayHello('123212') System.out.println(res)*/ } }