私はサービスの初心者です。Web サービスを開発し、ローカル ホストで公開して、別の Maven プロジェクトで Web サービス内のメソッドを呼び出そうとしています。以下のコードを使用して呼び出しを呼び出しています。
String targetNamespace = "http://Webservice.Rahul.com/";
QName serviceName = new QName(targetNamespace,"CallWebserviceImplService");
//portName - Qualified name for the target service endpoint
QName portName = new QName(targetNamespace,"CallWebService");
//operationName - Qualified Name of the operation for which the Call object is to be created.
QName operationName = new QName("add");
// Specify the location of the WSDL file
URL wsdlDocumentLocation = (on local host)
// Create an instance of service factory
ServiceFactory serviceFactory = ServiceFactory.newInstance();
//Create a service object to act as a factory for proxies.
Service service = serviceFactory.createService(wsdlDocumentLocation, serviceName);
Call call = (Call) service.createCall(portName,operationname);
call.setProperty("javax.xml.rpc.soap.operation.style","rpc");
String name=(String) call.invoke(operationName, null);
しかし、これは私に次の例外を与えています:
port: CallWebService には操作が含まれていません: com.sun.xml.rpc.client.dii.ConfiguredCall.configureCall(ConfiguredCall.java:115) に追加 com.sun.xml.rpc.client.dii.ConfiguredCall.configureCall(ConfiguredCall) に追加.java:86) で com.Rahul.call.callWebService.callingWebService(callWebService.java:35) で com.Rahul.Testing.Test1.callTest(Test1.java:17) で sun.reflect.NativeMethodAccessorImpl.invoke0(ネイティブ メソッド) ) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) で
どんな助けでも大歓迎です
MyWSDL ファイルは次のようになります