JAXB schema validation not occurring in outbound message with CXF 2.3.1

安稳与你 提交于 2019-12-08 19:31:27

I've had similar problems (CXF 2.2.7) and was able to solve it by adding the serviceName and endpointName attributes to my <jaxws:client> bean definition. check out the section "Configuring a Spring Client (Option 1)" here: https://cwiki.apache.org/CXF20DOC/jax-ws-configuration.html for more information on the attributes.

Note: I also have the wsdlLocation attribute defined as well. This is likely necessary for CXF to find the XSDs used by the service.

Here's an example of what I have:

<jaxws:client id="client"
              serviceClass="com.example.ServiceInterface"
              address="http://example.com/endpoint"
              wsdlLocation="WEB-INF/wsdl/SampleWSDLFile.wsdl"
              serviceName="s:SampleService"
              endpointName="s:SampleServicePort"
              xmlns:s="http://www.example.com/some/namesapce">
...
</jaxws:client>

I also noticed when I had this problem the whole schema was printed to my log file by the org.apache.cxf.wsdl.EndpointReferenceUtils class every time the client was invoked. This behavior went away when I setup my client bean like the one above. I wonder if you're seeing something like that too...

Another detail I should mention is that I had a lot of unexpected behavior from CXF when I didn't use all the CXF-provided libraries outlined in the WHICH_JARS file. I would also try adding them to the build so they override any server or Java provided libraries. You can always remove them later if they aren't necessary.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!