THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||
---|---|---|---|---|
| ||||
<jaxws:client name="{http://cxf.apache.org/}MyService" createdFromAPI="true">
<jaxws:properties>
<entry key="ws-security.sts.client">
<!-- direct STSClient config and creation -->
<bean class="org.apache.cxf.ws.security.trust.STSClient">
<constructor-arg ref="cxf"/>
<property name="wsdlLocation" value="target/wsdl/trust.wsdl"/>
<property name="serviceName" value="{http://cxf.apache.org/securitytokenservice}SecurityTokenService"/>
<property name="endpointName" value="{http://cxf.apache.org/securitytokenservice}SecurityTokenEndpoint"/>
<property name="properties">
<map>
<entry key="ws-security.username" value="joe"/>
<entry key="ws-security.callback-handler" value="interop.client.KeystorePasswordCallback"/>
<entry key="ws-security.signature.properties" value="etc/alice.properties"/>
<entry key="ws-security.encryption.properties" value="etc/bob.properties"/>
</map>
</property>
</bean>
</entry>
</jaxws:properties>
</jaxws:client>
|
Remember the jaxws:client createdFromAPI attribute is set to true if you created the client programmatically via the CXF API's--i.e., Endpoint.publish() or Service.getPort().
This also works for "code first" cases as you can do:
...