Search code examples
springjax-ws

JAX-WS and curly braces syntax


All over the Internet I find code examples of JAX-WS beans being defined in this fashion:

<jaxws:client name="{http://cxf.apache.org/}MyService" createdFromAPI="true">

What is the meaning of the curly braces here exactly?


Solution

  • You might need to specify individual examples of where you've seen it, but from what you've shared here, this seems to be erroneous use of that naming convention. See, the schema for the Spring-CXF XML configuration document supports two types of "name" attributes:

    1. name: use this to name just the bean within the spring context - treat it no differently as you would adding id to a spring bean. No need for a namespace or prefixing of any kind

    2. serviceName: this name should come from the WSDL as part of the name attribute from the definitions root element. It's this one that uses the QName format - what you have here as {http://cxf.apache.org/}MyService which the CXF API will try to match with what's in the WSDL of the SOAP service you're consuming.

    TL;DR: that naming convention with the URL prefix doesn't belong on the name attribute but on the serviceName attribute and its value ought to come from the WSDL file.