如何发布rpc-encoded格式的webservice

天天都在码字 2011-12-28 11:46:37
如题所示。
因为公司做项目要考虑 同格式的webservice调用是否会有问题存在,因此要做一些不同格式的webservice之间的调用测试。
目前使用cxf2.2,默认情况下发布出的webservice格式是document/literal;
通过在接口上添加标注@SOAPBinding(style = SOAPBinding.Style.RPC),通过查看wsdl文件可以看出 webservice格式为rpc/literal;

但是通过添加如下配置:
@SOAPBinding(style = SOAPBinding.Style.RPC,use=SOAPBinding.Use.ENCODED),后发布的webservice格式是rpc/literal,而我需要的格式为rpc/encoded;
是配置错误么?求大神指点。
package webservice.web;

import java.util.Date;
import java.util.List;

import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
@SOAPBinding(style = SOAPBinding.Style.RPC,use=SOAPBinding.Use.ENCODED)
@WebService
public interface IService {
public Bean print(Bean bean1 ,Bean bean2);

public List getList();

public Date getDate();
}

wsdl:

<wsdl:definitions name="IServiceService" targetNamespace="http://web.webservice/"><wsdl:message name="getDate">
</wsdl:message><wsdl:message name="getDateResponse"><wsdl:part name="return" type="xsd:dateTime">
</wsdl:part></wsdl:message><wsdl:portType name="IService"><wsdl:operation name="getDate"><wsdl:input message="tns:getDate" name="getDate">
</wsdl:input><wsdl:output message="tns:getDateResponse" name="getDateResponse">
</wsdl:output></wsdl:operation></wsdl:portType><wsdl:binding name="IServiceServiceSoapBinding" type="tns:IService"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="getDate"><soap:operation soapAction="" style="rpc"/><wsdl:input name="getDate"><soap:body namespace="http://web.webservice/" use="literal"/></wsdl:input><wsdl:output name="getDateResponse"><soap:body namespace="http://web.webservice/" use="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service name="IServiceService"><wsdl:port binding="tns:IServiceServiceSoapBinding" name="IServicePort"><soap:address location="http://localhost:8080/cxftest/services/s1"/></wsdl:port></wsdl:service></wsdl:definitions>
...全文
119 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧