【发布时间】:2014-02-24 11:15:01
【问题描述】:
我尝试了 mkyong 网站上的示例代码,并尝试了参数组合。 我尝试将 javax.jws.soap.SOAPBinding.Use.LITERAL 更改为 javax.jws.soap.SOAPBinding.Use.ENCODED 以获得 RPC 样式服务接口。
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);
}
唯一的变化是 use = Use.LITERAL 现在我有 use = Use.ENCODED。
然而,生成的 WSDL 似乎根本没有改变。
在这两种情况下创建的 WSDL 仍将 <soap:body> 使用属性显示为“文字”。
<soap:body use="literal"
我的接口声明是否有错误?
<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>
这是正确的吗?我不应该期待use="Encoded"吗?
【问题讨论】:
标签: web-services soap wsdl