I was able to reproduce the behavior you described (SOAPAction - "" header) with a call like this:
MyPortService service = new MyPortService(); MyPort port = service.getMyPortSoap11(); MyRequest request = new MyRequest(); MyResponse response = port.subscription( request );
Here are the HTTP headers from the dump server using this call:
POST /MyService/services HTTP/1.1 Content-Type: text/xml; charset=UTF-8 Accept: */* SOAPAction: "" User-Agent: Apache CXF 2.7.6 Cache-Control: no-cache Pragma: no-cache Host: redacted Connection: keep-alive Content-Length: 377
I tried adding an interceptor and making sure that SOAPAction was set as the header, but no matter what I tried, that did not cause the SOAPAction to be sent as part of the HTTP request.
Then I found leadership in this thread and reformatted my call:
ClientProxyFactoryBean factory = new ClientProxyFactoryBean(); factory.setServiceClass( MyPort.class ); factory.setAddress( "http://www.host.com/service" ); factory.setServiceName( new QName( targetNamespace, wsdlBindingName ) ); Object myService = factory.create(); org.apache.cxf.endpoint.Client client = ClientProxy.getClient( myService ); Map<String, List<String>> headers = new HashMap<String, List<String>>(); headers.put("SOAPAction", Arrays.asList("mySoapAction")); client.getRequestContext().put(Message.PROTOCOL_HEADERS, headers); client.invoke( operationName, request );
Here are the HTTP headers from the dump dump call in this style:
POST /MyService/services HTTP/1.1 Content-Type: text/xml; charset=UTF-8 Accept: */* SOAPAction: mySoapAction User-Agent: Apache CXF 2.7.6 Cache-Control: no-cache Pragma: no-cache Host: redacted Connection: keep-alive Content-Length: 377
Hope this helps.
source share