java CXF 2.2.12:如何在客户端关闭架构验证
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7744796/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
CXF 2.2.12: How to turn off schema validation on the client side
提问by Dan Barber
I would like to turn off schema validation for JAXB-bound messages. I am dealing with the client-side CXF code (WSDL first generation). I have tried using
我想关闭 JAXB 绑定消息的模式验证。我正在处理客户端 CXF 代码(WSDL 第一代)。我试过使用
<jaxws:client name="{http://apache.org/hello_world_soap_http}SoapPort"
createdFromAPI="true">
<jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
</jaxws:client>
Without success (see reference CXF FAQ). I've had difficulty finding a programmatic way of settings this property. I've also explored short-circuiting CXF and accessing the parser, unmarshaller, etc.
没有成功(请参阅参考CXF 常见问题解答)。我很难找到设置此属性的编程方式。我还探索了短路 CXF 和访问解析器、解组器等。
Thanks for your help.
谢谢你的帮助。
采纳答案by MJar
To turn off the schema validation you should set the schema-validation-enabled
property to false
.
要关闭架构验证,您应该将该schema-validation-enabled
属性设置为false
.
According to documentation referred by you (CXF FAQ).
根据您提供的文档(CXF 常见问题解答)。
To enable schema validation (all requests and responses will be validated against schema) set
启用模式验证(所有请求和响应都将根据模式进行验证)设置
<entry key="schema-validation-enabled" value="true" />
To disable schema validation (none of the requests nor responses will be validated against schema) do nothing cause it is the default behavior or set
禁用架构验证(不会针对架构验证任何请求或响应)不执行任何操作,因为它是默认行为或设置
<entry key="schema-validation-enabled" value="false" />
回答by Bassel Kh
Or from the code as follows:
或者从代码如下:
Client client = ClientProxy.getClient(XYZSOAPEndPoint);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setAllowChunking(false);
http.setClient(policy);
((BindingProvider)XYZSOAPEndPoint).getRequestContext().put("schema-validation-enabled",true);
回答by Artoghrul Salimli
@SchemaValidation(type = SchemaValidation.SchemaValidationType.NONE)
put this annotation to your endpoint implementation class
@SchemaValidation(type = SchemaValidation.SchemaValidationType.NONE)
将此注释放入您的端点实现类
回答by Syam Kumar
@SchemaValidation(type = SchemaValidation.SchemaValidationType.NONE)
public EndpointImpl endpoint(Bus bus, DirectConnectService accountServiceEndpoint) {
}
put this validation in your endpoint configuration class
将此验证放在您的端点配置类中