I am creating a WebService in Java using JAXWS RI. The WSDL file is created when deploying the application WAR automatically. The problem is that I want the arguments (that each operation recieves) in the WSDL file to have significant names, but they appear as arg0, arg1, arg2 ... Is there a way to define the names for this parameters and don't use the default names?
I have implemented the following:
The WebService Interface
@WebService
@SOAPBinding(style = Style.RPC)
public interface WS2 {
@WebMethod String confirmaXML(String lrt_id);
}
The WebService Interface Implementation
@WebService(endpointInterface = "vital.tde.ws2.WS2")
public class WS2Imp implements WS2{
public String confirmaXML(String lrt_id) {
String respuesta = null;
//CODE
return respuesta;
}
sun-jaxws.xml
<?xml version="1.0" encoding="UTF-8"?>
<endpoints
xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"
version="2.0">
<endpoint name="WS2" implementation="vital.tde.ws2.WS2Imp" url-pattern="/WS2" />
</endpoints>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>WS2</display-name>
<listener>
<listener-class>
com.sun.xml.ws.transport.http.servlet.WSServletContextListener
</listener-class>
</listener>
<servlet>
<servlet-name>WS2</servlet-name>
<servlet-class>
com.sun.xml.ws.transport.http.servlet.WSServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>WS2</servlet-name>
<url-pattern>/WS2</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>120</session-timeout>
</session-config>
</web-app>