in my last post:
java webservices wsimport - parsing WSDL [ERROR] Server returned HTTP response code: 401 for URL: http://?wsdl needs authorization
i created a webservice client by using the commandline tool wsimport. in the generated code i noticed that one of the methods looked like this:
@WebEndpoint(name = "AdminWebService")
public AdminWebService getAdminWebService(WebServiceFeature... features) {
return super.getPort(new QName("http://server3.wservice3", "AdminWebService"), AdminWebService.class, features);
}
notice the three dots (ellipsis) in the method parameters:
getAdminWebService(WebServiceFeature... features)
i wondered if this was an error, but it's also in the api:
http://docs.oracle.com/javase/6/docs/api/javax/xml/ws/class-use/WebServiceFeature.html
then i found the java documentation about Arbitrary Number of Arguments:
You can use a construct called varargs to pass an arbitrary
number of values to a method. You use varargs when you don't know how
many of a particular type of argument will be passed to the method. It's
a shortcut to creating an array manually...
To use varargs, you follow the type of the last parameter by an
ellipsis (three dots, ...), then a space, and the parameter name. The
method can then be called with any number of that parameter, including
none.
IT, computer and programming tutorials and tips that i couldnt find anywhere else using google, from my daily work as a Senior Developer of solutions using Java and Linux.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment