I am a new bee to we services, I have developed a web service and published on my local hosttrying to invoke the method inside a web service in separate maven project. I am using the below code to invoked the call:
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);
but this is giving me the following exception:
port: CallWebService does not contain operation: add at com.sun.xml.rpc.client.dii.ConfiguredCall.configureCall(ConfiguredCall.java:115) at com.sun.xml.rpc.client.dii.ConfiguredCall.configureCall(ConfiguredCall.java:86) at com.Rahul.call.callWebService.callingWebService(callWebService.java:35) at com.Rahul.Testing.Test1.callTest(Test1.java:17) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
Anyhelp is much appreciated
MyWSDL file looks like this