This is how I configure the client:
// Below portType is a concrete implementation of DocumentRepositoryPortType generated interface // Setting the service URL BindingProvider provider = (BindingProvider) portType; provider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsUrl); // MTOM SOAPBinding soapBinding = (SOAPBinding) provider.getBinding(); soapBinding.setMTOMEnabled(true); // Adding a specific handler List<Handler> handlerChain = binding.getHandlerChain(); handlerChain.add(new JetonAuthentificationHandler()); soapBinding.setHandlerChain(handlerChain); // Getting the client Client client = ClientProxy.getClient(portType); // WS-Adressing EndpointImpl endpoint = (EndpointImpl) client.getEndpoint(); Bus bus = endpoint.getBus(); new WSAddressingFeature().initialize(client, bus); // Setting endpointInfo URL ConduitSelector conduitSelector = client.getConduitSelector(); conduitSelector.getEndpoint().getEndpointInfo().setAddress(super.wsUrl); // Then we add SSL / TLS configuration => not showed here Then we call the service: // With request as content portType.documentRepositoryProvideAndRegisterDocumentSetB(request); On the logs here is what we have (extract of the SOAP Envelope beginning only): INFO: Outbound Message --------------------------- ID: 1 Address: https://172.30.13.61:9043/xds/cxf/DocumentRepository_Service Encoding: UTF-8 Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:0e72f86e-32e7-4259-a577-45c4482f461a"; start="<[email protected]>"; start-info="text/xml" Headers: {SOAPAction=["urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-b"], Accept=[*/*]} Payload: --uuid:0e72f86e-32e7-4259-a577-45c4482f461a Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"; Content-Transfer-Encoding: binary Content-ID: <[email protected]> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><Action xmlns="http://www.w3.org/2005/08/addressing">urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-b</Action><MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:c7a3eac7-054d-48a1-a510-c43e6d3df180</MessageID><To xmlns="http://www.w3.org/2005/08/addressing">https://172.30.13.61:9043/xds/cxf/DocumentRepository_Service</To><ReplyTo xmlns="http://www.w3.org/2005/08/addressing"><Address>http://www.w3.org/2005/08/addressing/anonymous</Address></ReplyTo><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><saml2:Assertion xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" ID="be515324-bccf-4e2b-8667-231b6f46f4a6" IssueInstant="2009-02-02T00:00:00.000Z" Version="2.0"><saml2:Issuer Format="urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName">CN=client, OU=Waid, O=Waid, L=Aix, ST=PACA, C=FR</saml2:Issuer><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> ... -----Message d'origine----- De : Freeman Fang [mailto:[email protected]] Envoyé : mercredi 19 janvier 2011 15:04 À : [email protected] Objet : Re: Unable to set Soap Version to 1.2 Hi, How you configure your client? What the client side looks like, ensure you already specify wsdlLocation for client side. Seems the client side didn't pick up the wsdl to build the service model. Could you please paste the log when you run client? Freeman On 2011-1-19, at 下午9:38, MARTELLI Julien wrote: > Hi, > > Thanks for this quick answer. > > I impacted the momdifications you are talking about and there is no > difference. The client still generates SOAP 1.1 messages.... > > > -----Message d'origine----- > De : Freeman Fang [mailto:[email protected]] > Envoyé : mercredi 19 janvier 2011 10:06 > À : [email protected] > Objet : Re: Unable to set Soap Version to 1.2 > > Hi, > > My comment inline > On 2011-1-19, at 下午4:54, MARTELLI Julien wrote: > >> Hi all, >> >> I am facing a problem with the SOAP message version. >> I am really stuck with this problem so any help would be appreciated. >> >> OK so here is the context. >> >> I have a WSDL file from which I generate sources using the wsdl2java >> CXF Maven plugin. >> Here is an extract of my WSDL file : >> >> <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" >> xmlns="http://schemas.xmlsoap.org/wsdl/" >> xmlns:xsd="http://www.w3.org/2001/XMLSchema >> " >> xmlns:ihe="urn:ihe:iti:xds-b:2007" >> xmlns:rs="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0 >> " >> targetNamespace="urn:ihe:iti:xds-b:2007" >> xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/ >> " >> xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" >> name="DocumentRepository"> >> ... >> <binding name="DocumentRepository_Binding" >> type="ihe:DocumentRepository_PortType"> >> <soap12:binding style="document" >> transport="http://schemas.xmlsoap.org/soap/http >> "/> > I think transport here should be > transport="http://www.w3.org/2003/05/soap/bindings/HTTP/" >> <operation name="DocumentRepository_ProvideAndRegisterDocumentSet- >> b"> >> <soap12:operation >> soapAction="urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-b >> "/> >> <input> >> <soap12:body use="literal"/> >> </input> >> <output> >> <soap12:body use="literal"/> >> </output> >> </operation> >> <operation name="DocumentRepository_RetrieveDocumentSet"> >> <soap12:operation soapAction="urn:ihe:iti: >> 2007:RetrieveDocumentSet >> "/> >> <input> >> <soap12:body use="literal"/> >> </input> >> <output> >> <soap12:body use="literal"/> >> </output> >> </operation> >> </binding> >> ;;; >> <service name="DocumentRepository_Service"> >> <port name="DocumentRepository_Port_Soap12" >> binding="ihe:DocumentRepository_Binding"> >> <soap12:address >> location="https://servicelocation/DocumentRepository_Service >> "/> >> </port> >> </service> >> >> >> On the generated interface there is no annotation concerning the >> Binding : >> >> @WebService(targetNamespace = "urn:ihe:iti:xds-b:2007", name = >> "DocumentRepository_PortType") >> @XmlSeeAlso >> ({oasis.names.tc.ebxml_regrep.xsd.query._3.ObjectFactory.class, >> oasis.names.tc.ebxml_regrep.xsd.rs._3.ObjectFactory.class, >> ObjectFactory.class, >> oasis.names.tc.ebxml_regrep.xsd.lcm._3.ObjectFactory.class, >> oasis.names.tc.ebxml_regrep.xsd.rim._3.ObjectFactory.class}) >> public interface DocumentRepositoryPortType { >> ... >> >> >> Then I use the generated classes to contact the Web Service and my >> client is not configured via Spring but build programmatically. >> >> The problem is that the generated SOAP message is a SOAP 1.1 >> message... >> I am not able to find a way to configure my client to use a SOAP 1.2 >> binding, and I tried to add the annotation >> @BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_MTOM_BINDING) >> on the generated interface (as someone suggested to me on this >> stackoverflow post : > You should add annotation like > @javax.xml.ws.BindingType(value = > "http://www.w3.org/2003/05/soap/bindings/HTTP/ > ") > > You can get more details from the wsdl_first_soap12 example shipped > with kit. > > Freeman >> http://stackoverflow.com/questions/4248098/cxf-how-to-set-soapversion-on-cxf-port-without-spring) >> but it didn't change anything... >> Maybe it's because I configure my client without Spring and thus the >> default Soap 1.1 version is used... >> I really don't know... >> >> >> Do you guys have an idea ? >> >> Thanks in advance ! >> J. > > > -- > Freeman Fang > > ------------------------ > > FuseSource: http://fusesource.com > blog: http://freemanfang.blogspot.com > twitter: http://twitter.com/freemanfang > Apache Servicemix:http://servicemix.apache.org > Apache Cxf: http://cxf.apache.org > Apache Karaf: http://karaf.apache.org > Apache Felix: http://felix.apache.org > -- Freeman Fang ------------------------ FuseSource: http://fusesource.com blog: http://freemanfang.blogspot.com twitter: http://twitter.com/freemanfang Apache Servicemix:http://servicemix.apache.org Apache Cxf: http://cxf.apache.org Apache Karaf: http://karaf.apache.org Apache Felix: http://felix.apache.org
