Specifying an argument name in a web service operation

As mentioned earlier, when WSDL was created for our Course web service, the argument for the getCourse operation name was created as arg0. You can verify this by browsing to http://localhost:8080/CourseMgmtWSProject/courseService?xsd=1 and checking the getCourse type:

<xs:complexType name="getCourse"> 
     <xs:sequence> 
         <xs:element name="arg0" type="xs:int"/> 
     </xs:sequence> 
</xs:complexType> 

Thus, the client-side-generated code (by wsimport) in CourseManagementService.getCourse also names the argument as arg0. It would be nice to give a meaningful name to arguments. This could be done easily be adding the @WSParam annotation in our web service implementation class, CourseManagementService ...

Get Java EE 8 Development with Eclipse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.