I am new to jax-ws development and I have generated java source files from a wsdl using wsimport. And I need to call a function from one of these source files into my UI program.
The function I need to call looks like:
@WebMethod(operationName = "GetX")
@RequestWrapper(localName = "GetX", targetNamespace = "urn:Control", className = "jaxws.control.GetX")
@ResponseWrapper(localName = "GetXResponse", targetNamespace = "urn:Control", className = "jaxws.control.GetXResponse")
public void myHostGetX(
@WebParam(name = "isActive", targetNamespace = "", mode = WebParam.Mode.OUT)
Holder<Boolean> Active);
Lets say the this funtion is part of a class called Class A.
But if I try invoking this by doing something like,
boolean foo;
ResponseFromWS response = myHostGetX(foo);
I get an error like,
The method myHostGetX(Holder<Boolean>) in the type Class A is not applicable for the arguments (boolean)
How can I call this Holder<Boolean>
?
You need to set the value of the holder. So either:
myHostGetX(new Holder(Boolean.TRUE)); //note plain boolean should work in the constructor.
OR
myHostGetX(new Holder());
OR
Holder holder = new Holder();
holder.value = Boolean.TRUE;
myHostGetX(holder)
Any of those should work. It's worth mentioning that since this is an OUTPUT parameter, the setting of the value should occur within the implementation of that method.