Renaming the argument name in JAX-WS

后端 未结 1 2123
予麋鹿
予麋鹿 2021-02-14 21:45

I created a web service using JAX-WS in RSA 7.5 and Websphere 7 using bottom-up approach. When I open the WSDL in SOAP UI, then the arguments section is appearing like this:

相关标签:
1条回答
  • 2021-02-14 21:59

    You put the @XMLElement(required=true) above the variables in your class that are being returned from your service. I just learned about that option about a month ago. So right above where you declare empName put the tag and required.

    To rename the parameters of your service use the @WebParam(name="<name you want in soap>") in front of each input variable to the service.

    For example, if you have a service method called get(String name) it would look something like get(@WebParam(name = "name") String name)


    You are correct, now that I read your comment again. The services I support use Objects in the input and output, which is why I put the XMLElement tag in the class of those objects.

    You need to put the tag in the class that declares your variables that are passed in or returned to the service. If those happen to be declared in your service class that is fine. The main point is that you put that XMLElement tag above the variable declaration, versus putting it on a getter or setter.

    This tutorial shows some examples of the usage. JAXB tutorial

    0 讨论(0)
提交回复
热议问题