Apache CXF is a convenient services framework, e.g. for integrating SOAP-based web services in a Java application. It offers SpringFramework integration, which together takes away much complexity of using such services.We can achieve time out for SOAP client using Conduits in Apache CXF.
Conduit simply means channel or pipe. HTTP conduits are channels allow us to apply certain HTTP related properties or attributes which can affect the way messages are exchanged between endpoints. The conduit is always defined by the client or consumer of the service.
Conduit simply means channel or pipe. HTTP conduits are channels allow us to apply certain HTTP related properties or attributes which can affect the way messages are exchanged between endpoints. The conduit is always defined by the client or consumer of the service.
Conduit configuration in Spring DSL :
In order to use the HTTP configuration elements, you will need to add the lines shown below to the beans element of your endpoint's configuration file. In addition, you will need to add the configuration elements' namespace to the xsi:schemaLocation attribute.
< beans ... xmlns:http-conf="http://cxf.apache.org/transports/http/configuration ... xsi:schemaLocation="... ..."> |
You configure an HTTP client using the http-conf:conduit element and its children. The http-conf:conduit element takes a single attribute, name, that specifies the WSDL port element that corresponds to the endpoint. The value for the name attribute takes the form portQName.http-conduit.All the ReceiveTimeouts specified in milliseconds.
<
http-conf:conduit
name
=
"*.http-conduit"
>
<!-- you can also using the wild card to specify
the http-conduit that you want to configure -->
<!-- This configuration will set global timeout for all SOAP calls
-->
<
http-conf:client
ReceiveTimeout
=
"50"
/>
</
http-conf:conduit
>
...
</
http-conf:conduit
>
<!-- This configuration will set Service based timeout for SOAP calls
-->
<!--
Add configuration for an endpoint that is specified by the WSDL fragment.
http://widgets.widgetvendor.net is wsdl target namespace and
widgetSOAPPort is the operation specified in WSDL inside portType name tag name-->
<
http-conf:client
ReceiveTimeout
=
"50"
/>
</
http-conf:conduit
>
<!--
Add configuration for an endpoint that is specified by the WSDL fragment.
<!-- This configuration will also set Service based timeout for SOAP calls
-->
<
http-conf:client
ReceiveTimeout
=
"50"
/>
</
http-conf:conduit>
Based on above configuration we can set the timeout for SOAP clients globally and Services wise.
We can't set the timeout on operation wise(Methods specified inside each service) use of conduit.
No comments:
Post a Comment