...
If you are a Spring user, you'll notice that the jaxws:properties
element follows the Spring Map syntax.
Configuring a
...
Spring Client (Option 1)
Info |
---|
This technique lets you add a Web Services client to your Spring application. You can inject it into other beans, or manually retrieve it from the Spring context for use by non-Spring-aware client code. |
The easiest way to add a Web Services client to a Spring context is to use the <jaxws:client>
element (similar to the <jaxws:endpoint>
element used for the server side). Here's a simple example:
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:client id="helloClient"
serviceClass="demo.spring.HelloWorld"
address="http://localhost:9002/HelloWorld" />
</beans>
|
The attributes available on <jaxws:client>
include:
Name | Type | Description |
---|---|---|
id | String | A unique identified for the client, which is how other beans in the context will reference it |
address | URL | The URL to connect to in order to invoke the service |
serviceClass | Class | The fully-qualified name of the interface that the bean should implement (typically, same as the service interface) |
serviceName | QName | The name of the service to invoke, if this address/WSDL hosts several. It maps to the wsdl:service@name. In the format of "ns:SERVICE_NAME" where ns is a namespace prefix valid at this scope. |
endpointName | QName | The name of the endpoint to invoke, if this address/WSDL hosts several. It maps to the wsdl:port@name. In the format of "ns:ENDPOINT_NAME" where ns is a namespace prefix valid at this scope. |
bindingId | URI | The URI, or ID, of the message binding for the endpoint to use. For SOAP the binding URI(ID) is specified by the JAX-WS specification. For other message bindings the URI is the namespace of the WSDL extensions used to specify the binding. |
bus | Bean Reference | The bus name that will be used in the jaxws endpoint (defaults to |
username | String |
|
password | String |
|
wsdlLocation | URL | A URL to connect to in order to retrieve the WSDL for the service. This is not required. |
It also supports many child elements:
Name | Description |
---|---|
TBD |
|
Configuring a Spring Client (Option 2)
Info |
---|
Building a Client using this configuration is only applicable for those wishing to inject a Client into their Spring ApplicationContext. |
...