I will step back, let's get it working with Spring and then I can always take
Spring out. Here is the output in the log, it clearly loads the cxf.xml file
so we know what config I did specify is loaded. There is no body in the
message which seems odd to me. I am working to get some logging on in one of
the apps that works to trace the packets between the client/server.
Any pointer to a good example for this case would be useful. CXF Client, STS
and WCF C# web service.
[org.apache.cxf.bus.spring.BusApplicationContext] - Refreshing
org.apache.cxf.bus.spring.BusApplicationContext@14a55f2: startup date [Thu Jan
16 15:25:29 EST 2014]; root of context hierarchy
[org.apache.cxf.bus.spring.BusApplicationContext] - Loaded configuration file
resources/cxf.xml.
[org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefinitionReader] -
Loading XML bean definitions from file [resources\cxf.xml]
[org.springframework.beans.factory.support.DefaultListableBeanFactory] -
Pre-instantiating singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@1250ff2:
defining beans
[cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.wstx_msv_validation.WoodstoxValidationImpl,cxf.config0,*.http-conduit,{http://..../}SymbolService.jaxws-client.proxyFactory,{...}SymbolService.jaxws-client];
root of factory hierarchy
[org.apache.cxf.service.factory.ReflectionServiceFactoryBean] - Creating
Service {http://......./}SymbolService from WSDL: .../SymbolService?wsdl
2014-01-16 15:25:31,856 WARN
[main][org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl] - No assertion
builder for type
{http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1}BinaryEncoding
registered.
2014-01-16 15:25:31,859 WARN
[main][org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl] - No assertion
builder for type
{http://schemas.microsoft.com/ws/2006/05/framing/policy}SslTransportSecurity
registered.
2014-01-16 15:25:31,860 WARN
[main][org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider]
- Failed to build the policy
'SymbolServiceTcp_policy':org.apache.neethi.builders.PrimitiveAssertion cannot
be cast to org.apache.cxf.ws.security.policy.model.Token
2014-01-16 15:25:31,990 INFO
[main][org.apache.cxf.service.factory.ReflectionServiceFactoryBean] - Creating
Service {http://www.w3.org/2009/09/ws-mex}MetadataExchangeService from class
org.apache.cxf.ws.mex.MetadataExchange
2014-01-16 15:25:32,238 INFO
[main][org.apache.cxf.services.MetadataExchangeService.MetadataExchangePort.MetadataExchange]
- Outbound Message
---------------------------
ID: 1
Address: http://........../SecurityTokenService/mex
Encoding: UTF-8
Http-Method: POST
Content-Type: application/soap+xml
Headers: {Accept=[*/*], Connection=[Keep-Alive],
SOAPAction=["http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"]}
Payload: <soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><Action
xmlns="http://www.w3.org/2005/08/addressing">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</Action><MessageID
xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:79a48dbb-5f51-48ef-84f6-89a09be35b2f</MessageID><To
xmlns="http://www.w3.org/2005/08/addressing">http://....SecurityTokenService/mex</To><ReplyTo
xmlns="http://www.w3.org/2005/08/addressing"><Address>http://www.w3.org/2005/08/addressing/anonymous</Address></ReplyTo></soap:Header><soap:Body/></soap:Envelope>
--------------------------------------
2014-01-16 15:25:32,242 WARN
[main][org.apache.cxf.phase.PhaseInterceptorChain] - Interceptor for
{http://www.w3.org/2009/09/ws-mex}MetadataExchangeService#{http://www.w3.org/2009/09/ws-mex}Get2004
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:565)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:474)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:377)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:330)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
at $Proxy64.get2004(Unknown Source)
at
org.apache.cxf.ws.security.trust.AbstractSTSClient.configureViaEPR(AbstractSTSClient.java:509)
at
org.apache.cxf.ws.security.trust.STSUtils.getClient(STSUtils.java:115)
at
org.apache.cxf.ws.security.policy.interceptors.IssuedTokenInterceptorProvider$IssuedTokenOutInterceptor.issueToken(IssuedTokenInterceptorProvider.java:447)
at
org.apache.cxf.ws.security.policy.interceptors.IssuedTokenInterceptorProvider$IssuedTokenOutInterceptor.handleMessage(IssuedTokenInterceptorProvider.java:150)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:565)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:474)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:377)
Java
public static void main(String[] args) throws Exception {
SpringBusFactory bf = new SpringBusFactory();
Bus bus = bf.createBus("resources/cxf.xml");
BusFactory.setDefaultBus(bus);
SymbolService_Service factory = new SymbolService_Service();
SymbolService ss = factory.getSymbolServiceHttp();
ArrayOfSymbolContract stuff = ss.queryForAll();
System.out.println(ss);
}
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<cxf:bus>
<cxf:features>
<cxf:logging/>
</cxf:features>
</cxf:bus>
<http-conf:conduit name="*.http-conduit">
<http-conf:client ContentType="application/soap+xml"/>
</http-conf:conduit>
<jaxws:client name="{http://.........../}SymbolService"
createdFromAPI="true">
<jaxws:properties>
<entry key="ws-security.sts.client">
<bean class="org.apache.cxf.ws.security.trust.STSClient">
<constructor-arg ref="cxf"/>
<property name="wsdlLocation" value="http://.........?wsdl"/>
<property name="serviceName"
value="{http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice/}SecurityTokenService"/>
<property name="endpointName"
value="{http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice/}UsernameAuthStsBinding_IWSTrust13Syn"/>
<property name="requiresEntropy" value="false"/>
<property name="properties">
<map>
<entry key="ws-security.username" value="foo"/>
<entry key="ws-security.callback-handler"
value="playcxf.ClientCallbackHandler"/>
<entry key="ws-security.signature.properties"
value="clientKeystore.properties"/>
</map>
</property>
</bean>
</entry>
</jaxws:properties>
</jaxws:client>
</beans>