tomcat - The resource path [cxf-ehcache.xml] is not valid -


i'm trying implement message-level encryption. specifically, body of soap message encrypted. i'm trying encrypt traffic client web service.

the client sends encrypted data successfully:

utf-8 content-type: text/xml headers: {accept=[*/*], soapaction=[""]} payload: <?xml version="1.0" encoding="utf-8"?><soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">   <soap-env:header xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">     <wsse:security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soap:mustunderstand="1">       <xenc:encryptedkey xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" id="ek-2f22184b9eaac6244514331031642721">         <xenc:encryptionmethod algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/>         <ds:keyinfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">           <wsse:securitytokenreference>             <ds:x509data>               <ds:x509issuerserial>                 <ds:x509issuername>cn=testkey</ds:x509issuername>                 <ds:x509serialnumber>1940918168</ds:x509serialnumber>               </ds:x509issuerserial>             </ds:x509data>           </wsse:securitytokenreference>         </ds:keyinfo>         <xenc:cipherdata>           <xenc:ciphervalue>n6hh/rhguv2ycqzxi2sq+x6hnadm/osujsnrvcsxehzw6lpdr+jitcbefdv2huhsq0hbtgjj0dfoa9pociwuazw5wdr2nq8kq85lz4g2l/rhkgbrch19/p2ot0wxhih/qqrhsqdhbg4burlklzw+ma/h8szimfvuz5xymwzkaqcv8puc0r9ykukqrmkvcjis7enbznn0pdafoitkdjyim44/uaxa+clwyspaw1chpetawokclmqtl8wgs9cn8+aycmbc8ksds+durxmwc8ilvcirryvrpayevzix/ne9pe8siqmfgd5ghdfaiopycmf0i1w4/yqdtxzcfixlwnki0w==</xenc:ciphervalue>         </xenc:cipherdata>         <xenc:referencelist>           <xenc:datareference uri="#ed-2f22184b9eaac6244514331031642892"/>         </xenc:referencelist>       </xenc:encryptedkey>     </wsse:security>   </soap-env:header>   <soap:body>     <xenc:encrypteddata xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" id="ed-2f22184b9eaac6244514331031642892" type="http://www.w3.org/2001/04/xmlenc#content">       <xenc:encryptionmethod algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>       <ds:keyinfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">         <wsse:securitytokenreference xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsse11="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd" wsse11:tokentype="http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#encryptedkey">           <wsse:reference uri="#ek-2f22184b9eaac6244514331031642721"/>         </wsse:securitytokenreference>       </ds:keyinfo>       <xenc:cipherdata>         <xenc:ciphervalue>pnhm0fkumohtpm0rgspr0sigeifrz/4dwgwauwe2c6uschfh5a7pdximplovyske9d8ztnxie3tdmfprhls/hpd0vablsga4hagmyrelfkngau8bhxbbfrqimd7e8ue6gv/bbwaga0rgoexpyjqh0w==</xenc:ciphervalue>       </xenc:cipherdata>     </xenc:encrypteddata>   </soap:body> </soap:envelope>  web service response bad: nformaciÓn: inbound message ---------------------------- id: 1 response-code: 500 encoding: utf-8 content-type: text/xml;charset=utf-8 headers: {connection=[close], content-type=[text/xml;charset=utf-8], date=[sun, 31 may 2015 20:12:44 gmt], server=[apache-coyote/1.1], transfer-encoding=[chunked]} payload: <?xml version="1.0" encoding="utf-8"?><soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">   <soap:body>     <soap:fault>       <faultcode>soap:server</faultcode>       <faultstring>the resource path [cxf-ehcache.xml] not valid</faultstring>     </soap:fault>   </soap:body> </soap:envelope>  -------------------------------------- exception in thread "main" javax.xml.ws.soap.soapfaultexception: resource path [cxf-ehcache.xml] not valid     @ org.apache.cxf.jaxws.jaxwsclientproxy.invoke(jaxwsclientproxy.java:158)     @ com.sun.proxy.$proxy37.factorial(unknown source)     @ com.mathutility.test.testmathutility.main(testmathutility.java:57) caused by: org.apache.cxf.binding.soap.soapfault: resource path [cxf-ehcache.xml] not valid 

i using: apache tomcat 8 , apache cxf 2.6.13

it turns out tomcat8 not resources not start /. need prefix default resource (cxf-ehcache.xml) "/". answer given in cxf mail archives.

what need set property ws-security.cache.config.file, in order replace default value (cxf-ehcache.xml) "/cxf-ehcache.xml", explained in cxf documentation.

you can adding property under endpoint bean declaration, within cxf xml configuration :

<jaxws:endpoint      id="your id"    ...        <jaxws:properties>    ...      <entry key="ws-security.cache.config.file"  value="/cxf-ehcache.xml"/>    </jaxws:properties> </jaxws:endpoint> 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -