I tried the sample code from mkyong site and played around with combination of parameters. I tried changing the javax.jws.soap.SOAPBinding.Use.LITERAL to javax.jws.soap.SOAPBinding.Use.ENCODED for an RPC style service interface.
package com.mkyong.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding.Use;
import javax.jws.soap.SOAPBinding.ParameterStyle;
//Service Endpoint Interface
@WebService
@SOAPBinding(style = Style.RPC, use = Use.ENCODED, parameterStyle = ParameterStyle.WRAPPED)
public interface HelloWorld{
@WebMethod String getHelloWorldAsString(String name);
}
The only change was instead of use = Use.LITERAL
now I have use = Use.ENCODED
.
However the resulting WSDL does not seem to change at all.
The WSDL created in both cases still shows the <soap:body>
use property as "literal".
<soap:body use="literal"
Is there a mistake somewhere in my declaration of the interface?
<binding name="HelloWorldImplPortBinding" type="tns:HelloWorld">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"></soap:binding>
<operation name="getHelloWorldAsString">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal" namespace="http://ws.mkyong.com/"></soap:body>
</input>
<output>
<soap:body use="literal" namespace="http://ws.mkyong.com/"></soap:body>
</output>
</operation>
</binding>
Is this correct? Should I not be expecting use="Encoded"
?
In few of the WS implementation Use.ENCODED is not implemented. This may be one of the reason why use are getting the same WSDL. rpc/encoded wsdls are not supported in JAXWS 2.0. rpc/encoded is also not supported in JAXWS 2.2. Please refer the below link for the same. https://jax-ws.java.net/2.2.1/docs/annotations.html.