[ https://issues.apache.org/jira/browse/CXF-8050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16851726#comment-16851726 ]
Colm O hEigeartaigh commented on CXF-8050: ------------------------------------------ There are a number of changes required to get this to work: # The root cause is that the published WSDL does not contain the security policy that you have defined locally. Instead the published WSDL is generated locally. You can fix this in EndpointConfig via e.g. new EndpointImpl(bus, helloWorldImpl, null, "wsdl/helloworld.wsdl"); # You don't need the RemoveMustUnderstandHeader interceptor at all # Your HelloWorldImpl is missing the correct namespaces. It should have an annotation with something like: @WebService(serviceName = "HelloWorld_Service", portName = "HelloWorld_Port", targetNamespace = "http://test.com/services/helloworld", endpointInterface = "com.test.services.helloworld.HelloWorldPortType") # In ClientConfig, you need to set the correct servicename on the JaxWSProxyFactoryBean + also specify the correct WSDL, e.g. jaxWsProxyFactoryBean.setServiceName(new QName("http://test.com/services/helloworld", "HelloWorld_Service")); jaxWsProxyFactoryBean.setWsdlLocation("wsdl/helloworld.wsdl"); # In HelloWorldClient, helloWorldProxy.sayHello(person); needs to be moved below where you are setting the username + password on the context. > UsernameToken issue when is used JaxWsProxyFactoryBean > ------------------------------------------------------ > > Key: CXF-8050 > URL: https://issues.apache.org/jira/browse/CXF-8050 > Project: CXF > Issue Type: Bug > Reporter: Tsvetoslav > Priority: Major > Attachments: cxf-jaxws-spring-boot_WS-Policy.zip > > > Hello, > > I'm developing CXF soap Web Service using "cxf-spring-boot-starter-jaxws" > plugin. > I'm trying to add UsernameToken using WS-Policy(not Interceptor). > # I extended my WSDL file and "ws-security.callback-handler" in my endpoint > property. > # In my WS-Client com.test.client.DemoWSClient when I use @WebServiceClient > I successfully managed to add Username and Password using > ((BindingProvider)port).getRequestContext(). > # When I tried to do the same for my Integration test using > JaxWsProxyFactoryBean - com.test.client.ClientConfig and > com.test.client.HelloWorldClient nothing is happened although I used the same > code. > I have created very small demo project > [^cxf-jaxws-spring-boot_WS-Policy.zip] which I attached you for easier issue > debugging . Based on the console can be seen what's the generated SOAP > messages > * First(working) case - Run the application and run the > Client(com.test.client.DemoWSClient) like standalone Java Application > * Second(doesn't working) - Build the application > > Note: If I use Interceptor everything work fine. > Thank you in advance! > > BR, > Tsetso -- This message was sent by Atlassian JIRA (v7.6.3#76005)