如题所示。
因为公司做项目要考虑 同格式的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>