Hi,
It looks like your "securityTo" doesn't set up any
WSS4J{In|Out}Interceport, so the out come message isn't encrypted.
Please add that part configuration first, and you may need filter the
soap header before send the message to "securityTo".
On 11/10/10 2:17 PM, Wang Jinglong wrote:
I have 3 steps to do this:
1.start camel.
2.start outbound server
3.run client
camel and outbound server with spring.
camel server spring config:
<cxf:cxfEndpoint id="security"
serviceClass="com.tongtech.ti.cxf.demo.security.service.ISecuriyDemo"
address="http://localhost:8080/sec"
wsdlURL="com/tongtech/ti/cxf/demo/security/security.wsdl"
serviceName="s:ISecuriyService"
xmlns:s="http://demo.ti.tongtech.com/security/">
<!-- Server InInterceptor -->
<cxf:inInterceptors>
<bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<constructor-arg>
<map>
<entry value="Timestamp Signature Encrypt">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.ACTION" />
</key>
</entry>
<entry
value="com.tongtech.ti.cxf.demo.security.X509.server.UTPasswordServerCallBack">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.PW_CALLBACK_CLASS"
/>
</key>
</entry>
<entry value="cert/Server_SignVerf.properties">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.SIG_PROP_FILE"
/>
</key>
</entry>
<entry value="cert/Server_Decrypt.properties">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.DEC_PROP_FILE"
/>
</key>
</entry>
</map>
</constructor-arg>
</bean>
</cxf:inInterceptors>
<!-- Server OutInterceptor! -->
<cxf:outInterceptors>
<bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
<constructor-arg>
<map>
<entry value="Timestamp Signature Encrypt">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.ACTION" />
</key>
</entry>
<entry value="serverprivatekey">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.USER" />
</key>
</entry>
<entry value="clientpublickey">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.ENCRYPTION_USER"
/>
</key>
</entry>
<entry
value="com.tongtech.ti.cxf.demo.security.X509.server.UTPasswordServerCallBack">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.PW_CALLBACK_CLASS"
/>
</key>
</entry>
<entry value="cert/Server_Decrypt.properties">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.SIG_PROP_FILE"
/>
</key>
</entry>
<entry value="cert/Server_SignVerf.properties">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.ENC_PROP_FILE"
/>
</key>
</entry>
</map>
</constructor-arg>
</bean>
</cxf:outInterceptors>
</cxf:cxfEndpoint>
<cxf:cxfEndpoint id="securityTo"
serviceClass="com.tongtech.ti.cxf.demo.security.service.out.ISecuriyDemo"
address="http://localhost:9080/sec"
wsdlURL="com/tongtech/ti/cxf/demo/security/securityOut.wsdl"
serviceName="s:ISecuriyService"
xmlns:s="http://demo.ti.tongtech.com/security/">
</cxf:cxfEndpoint>
<bean id="client"
class="com.tongtech.ti.cxf.demo.security.X509.client.Client"/>
<camelContext id="security_context"
xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="cxf:bean:security" />
<to uri="cxf:bean:securityTo" />
</route>
</camelContext>
outbound server spring config:
<jaxws:server name="Sercurity"
serviceClass="com.tongtech.ti.cxf.demo.security.service.out.ISecuriyDemo"
address="http://localhost:9080/sec"
wsdlLocation="com/tongtech/ti/cxf/demo/security/securityOut.wsdl"
serviceName="s:ISecuriyService"
xmlns:s="http://demo.ti.tongtech.com/security/">
<jaxws:serviceBean>
<bean
class="com.tongtech.ti.cxf.demo.security.service.out.ISecuriyDemoImpl" />
</jaxws:serviceBean>
<jaxws:inInterceptors>
<bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<constructor-arg>
<map>
<entry value="Timestamp Signature Encrypt">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.ACTION" />
</key>
</entry>
<entry
value="com.tongtech.ti.cxf.demo.security.X509.server.UTPasswordServerCallBack">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.PW_CALLBACK_CLASS"
/>
</key>
</entry>
<entry value="cert/Server_SignVerf.properties">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.SIG_PROP_FILE"
/>
</key>
</entry>
<entry value="cert/Server_Decrypt.properties">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.DEC_PROP_FILE"
/>
</key>
</entry>
</map>
</constructor-arg>
</bean>
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
<constructor-arg>
<map>
<entry value="Timestamp Signature Encrypt">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.ACTION" />
</key>
</entry>
<entry value="serverprivatekey">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.USER" />
</key>
</entry>
<entry value="clientpublickey">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.ENCRYPTION_USER"
/>
</key>
</entry>
<entry
value="com.tongtech.ti.cxf.demo.security.X509.server.UTPasswordServerCallBack">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.PW_CALLBACK_CLASS"
/>
</key>
</entry>
<entry value="cert/Server_Decrypt.properties">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.SIG_PROP_FILE"
/>
</key>
</entry>
<entry value="cert/Server_SignVerf.properties">
<key>
<util:constant
static-field="org.apache.ws.security.handler.WSHandlerConstants.ENC_PROP_FILE"
/>
</key>
</entry>
</map>
</constructor-arg>
</bean>
</jaxws:outInterceptors>
</jaxws:server>
client is java code:
ISecuriyService ss = new ISecuriyService(wsdlURL, SERVICE_NAME);
ISecuriyDemo port = ss.getISecuriyServicePort();
org.apache.cxf.endpoint.Client client = ClientProxy.getClient(port);
Endpoint cxfEp = client.getEndpoint();
// Clint Out
Map<String, Object> outProp = new HashMap<String, Object>();
outProp.put(WSHandlerConstants.ACTION, WSHandlerConstants.TIMESTAMP
+ " " + WSHandlerConstants.SIGNATURE + " "
+ WSHandlerConstants.ENCRYPT);
outProp.put(WSHandlerConstants.USER, "clientprivatekey");
outProp.put(WSHandlerConstants.ENCRYPTION_USER, "serverpublickey");
outProp.put(WSHandlerConstants.PW_CALLBACK_CLASS,
UTPasswordClientCallBack.class.getName());
outProp.put(WSHandlerConstants.SIG_PROP_FILE,
"cert/Client_Sign.properties");
outProp.put(WSHandlerConstants.ENC_PROP_FILE,
"cert/Client_Encrypt.properties");
cxfEp.getOutInterceptors().add(new WSS4JOutInterceptor(outProp));
// Client In(Return)
Map<String, Object> inProp = new HashMap<String, Object>();
inProp.put(WSHandlerConstants.ACTION, WSHandlerConstants.TIMESTAMP
+ " " + WSHandlerConstants.SIGNATURE + " "
+ WSHandlerConstants.ENCRYPT);
inProp.put(WSHandlerConstants.PW_CALLBACK_CLASS,
UTPasswordClientCallBack.class.getName());
inProp.put(WSHandlerConstants.DEC_PROP_FILE,
"cert/Client_Sign.properties");
inProp.put(WSHandlerConstants.SIG_PROP_FILE,
"cert/Client_Encrypt.properties");
cxfEp.getInInterceptors().add(new WSS4JInInterceptor(inProp));
{
System.out.println("Invoking input...");
java.lang.String _input_in = "Input Value!";
java.lang.String _input__return = port.input(_input_in);
System.out.println("input.result=" + _input__return);
}
System.exit(0);
}
client outbound is OK
Outbound Message
---------------------------
ID: 1
Address: http://localhost:8080/sec
Encoding: UTF-8
Content-Type: text/xml
Headers: {SOAPAction=["http://demo.ti.tongtech.com/security/input"],
Accept=[*/*]}
Payload: <soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"><soap:Header><wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
soap:mustUnderstand="1"><xenc:EncryptedKey
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
Id="EncKeyId-C892C3DEF48D9D312B12893692122755"><xenc:EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/><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"><ds:X509Data>
<ds:X509IssuerSerial>
<ds:X509IssuerName>CN=tongtech.com,C=CN</ds:X509IssuerName>
<ds:X509SerialNumber>1288107035</ds:X509SerialNumber>
</ds:X509IssuerSerial>
</ds:X509Data></wsse:SecurityTokenReference>
</ds:KeyInfo><xenc:CipherData><xenc:CipherValue>PWn3xKniypUQNKaSRn9NlrU0BZ/OLXW+KUHuh4q6MrldUWyolkLx3qaGRjpW2WeZeW1WXLGIj0N6EX+MWfx4uX1HEktmcZOA7XSFTPoGLxWqhEDBc4K0depEPD+AMe7WtJkJiIqgis3ZVIGIlbWXnxdLxkUsrxCkKZTbXql8uL2ZR5strVPO+0vIHfckrVvi7RARH4600QHy78C2lSy+pIYkVcsymS7jWkc74dXYp1ZDRRfCwCLhCiBb88WicC6b387kgjjYjaozIycFvyY5Kde5cgy+dN+K/RSC4O0mPwbrYU6Fppvkk+jshrzlvwMLNsZuXmF7ZZANljRTOcXJnA==</xenc:CipherValue></xenc:CipherData><xenc:ReferenceList><xenc:DataReference
URI="#EncDataId-4"/></xenc:ReferenceList></xenc:EncryptedKey><ds:Signature
xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="Signature-2">
<ds:SignedInfo>
<ds:CanonicalizationMethod
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#id-3">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>HSig0sWSVObUJW5zxTSkoLTbvE0=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
Iv/gKsHOXgaHIw7gx/nvdIQhp/FM64bdWBbqkrLFXbQ0MYfFmfjgWGoLiYMHwlbvuIyh3EuHw3OS
bBB68C7qaQFPmrIr8u0Z2fYK8TGdo+cs72UWICdC2WT6PHg2BKGIsxhP4lkcL+V+6WWNcKCs4Cak
XyyegZ6km3zyOraXFIJzHmA8pW9g/no5UcPVKHcZFcTCLgPjRSAokY35mtMvI3+rYplPh+ZUMXLF
8akFQLXmsNOoBu0iU1NRb1VSKqhDO/RfGddIqOamuvx+/JFULDWT6Hnq2VQZA9viC4HBQZjUXNJV
J+xQCCx/+0jbCGq3Eh2UECpDKmO+PQIq0jb4IA==
</ds:SignatureValue>
<ds:KeyInfo Id="KeyId-C892C3DEF48D9D312B12893692105452">
<wsse:SecurityTokenReference
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"
wsu:Id="STRId-C892C3DEF48D9D312B12893692105483"><ds:X509Data>
<ds:X509IssuerSerial>
<ds:X509IssuerName>CN=tongtech.com,C=CN</ds:X509IssuerName>
<ds:X509SerialNumber>1288107001</ds:X509SerialNumber>
</ds:X509IssuerSerial>
</ds:X509Data></wsse:SecurityTokenReference>
</ds:KeyInfo>
</ds:Signature><wsu:Timestamp
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="Timestamp-1"><wsu:Created>2010-11-10T06:06:50.458Z</wsu:Created><wsu:Expires>2010-11-10T06:11:50.458Z</wsu:Expires></wsu:Timestamp></wsse:Security></soap:Header><soap:Body
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="id-3"><xenc:EncryptedData
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Id="EncDataId-4"
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"><wsse:Reference
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
URI="#EncKeyId-C892C3DEF48D9D312B12893692122755"/></wsse:SecurityTokenReference>
</ds:KeyInfo><xenc:CipherData><xenc:CipherValue>aH5ylkPVykkXfmfdqdHxIHFEpDtHPXIRGXonDCdKK+bysSr/TTUne249VcVPwGmJa2SXk3gWnEcu
ois4qI8mkM+Hc0HoQZgHzXpUuIbfQYlYcLE+dvBoC3oPML9vxDp193U2iKJY9YD1GW7Q5r7l+sMu
LfGl3P+TODloRLxMAtjKIrfApIl0/EjvUWTkqq+D5KH7854dU0V+xE5hXnRKOEDwy/69QraQBDm6
s3Nu9c/MNZe2TAYBCnDoiMkpagvCXKo9S2Edx4ukJYHYA6jg6DYdwODZ/KprXyqpJc0mQt3TYjPK
SFIN1kihLgbezTBclhckiaotqiY6mjgg2UjSAEti0NtbGyI1Qfjw49uFpMdoliZ7Wxnc2kRiBErk
gwiOitgerukU4Uas50NK2O9ONYZSc3Bbhrp3ZZEYxA9R7hI=</xenc:CipherValue></xenc:CipherData></xenc:EncryptedData></soap:Body></soap:Envelope>
camel server inbound is OK
Inbound Message
----------------------------
ID: 1
Address: /sec
Encoding: UTF-8
Content-Type: text/xml; charset=UTF-8
Headers: {content-type=[text/xml; charset=UTF-8],
connection=[keep-alive], transfer-encoding=[chunked],
Host=[localhost:8080],
SOAPAction=["http://demo.ti.tongtech.com/security/input"],
User-Agent=[Apache CXF 2.4.0-SNAPSHOT], Content-Type=[text/xml;
charset=UTF-8], Accept=[*/*], Pragma=[no-cache], Cache-Control=[no-cache]}
Payload: <soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"><soap:Header><wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
soap:mustUnderstand="1"><xenc:EncryptedKey
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
Id="EncKeyId-C892C3DEF48D9D312B12893692122755"><xenc:EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/><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"><ds:X509Data>
<ds:X509IssuerSerial>
<ds:X509IssuerName>CN=tongtech.com,C=CN</ds:X509IssuerName>
<ds:X509SerialNumber>1288107035</ds:X509SerialNumber>
</ds:X509IssuerSerial>
</ds:X509Data></wsse:SecurityTokenReference>
</ds:KeyInfo><xenc:CipherData><xenc:CipherValue>PWn3xKniypUQNKaSRn9NlrU0BZ/OLXW+KUHuh4q6MrldUWyolkLx3qaGRjpW2WeZeW1WXLGIj0N6EX+MWfx4uX1HEktmcZOA7XSFTPoGLxWqhEDBc4K0depEPD+AMe7WtJkJiIqgis3ZVIGIlbWXnxdLxkUsrxCkKZTbXql8uL2ZR5strVPO+0vIHfckrVvi7RARH4600QHy78C2lSy+pIYkVcsymS7jWkc74dXYp1ZDRRfCwCLhCiBb88WicC6b387kgjjYjaozIycFvyY5Kde5cgy+dN+K/RSC4O0mPwbrYU6Fppvkk+jshrzlvwMLNsZuXmF7ZZANljRTOcXJnA==</xenc:CipherValue></xenc:CipherData><xenc:ReferenceList><xenc:DataReference
URI="#EncDataId-4"/></xenc:ReferenceList></xenc:EncryptedKey><ds:Signature
xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="Signature-2">
<ds:SignedInfo>
<ds:CanonicalizationMethod
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#id-3">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>HSig0sWSVObUJW5zxTSkoLTbvE0=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
Iv/gKsHOXgaHIw7gx/nvdIQhp/FM64bdWBbqkrLFXbQ0MYfFmfjgWGoLiYMHwlbvuIyh3EuHw3OS
bBB68C7qaQFPmrIr8u0Z2fYK8TGdo+cs72UWICdC2WT6PHg2BKGIsxhP4lkcL+V+6WWNcKCs4Cak
XyyegZ6km3zyOraXFIJzHmA8pW9g/no5UcPVKHcZFcTCLgPjRSAokY35mtMvI3+rYplPh+ZUMXLF
8akFQLXmsNOoBu0iU1NRb1VSKqhDO/RfGddIqOamuvx+/JFULDWT6Hnq2VQZA9viC4HBQZjUXNJV
J+xQCCx/+0jbCGq3Eh2UECpDKmO+PQIq0jb4IA==
</ds:SignatureValue>
<ds:KeyInfo Id="KeyId-C892C3DEF48D9D312B12893692105452">
<wsse:SecurityTokenReference
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"
wsu:Id="STRId-C892C3DEF48D9D312B12893692105483"><ds:X509Data>
<ds:X509IssuerSerial>
<ds:X509IssuerName>CN=tongtech.com,C=CN</ds:X509IssuerName>
<ds:X509SerialNumber>1288107001</ds:X509SerialNumber>
</ds:X509IssuerSerial>
</ds:X509Data></wsse:SecurityTokenReference>
</ds:KeyInfo>
</ds:Signature><wsu:Timestamp
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="Timestamp-1"><wsu:Created>2010-11-10T06:06:50.458Z</wsu:Created><wsu:Expires>2010-11-10T06:11:50.458Z</wsu:Expires></wsu:Timestamp></wsse:Security></soap:Header><soap:Body
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="id-3"><xenc:EncryptedData
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Id="EncDataId-4"
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"><wsse:Reference
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
URI="#EncKeyId-C892C3DEF48D9D312B12893692122755"/></wsse:SecurityTokenReference>
</ds:KeyInfo><xenc:CipherData><xenc:CipherValue>aH5ylkPVykkXfmfdqdHxIHFEpDtHPXIRGXonDCdKK+bysSr/TTUne249VcVPwGmJa2SXk3gWnEcu
ois4qI8mkM+Hc0HoQZgHzXpUuIbfQYlYcLE+dvBoC3oPML9vxDp193U2iKJY9YD1GW7Q5r7l+sMu
LfGl3P+TODloRLxMAtjKIrfApIl0/EjvUWTkqq+D5KH7854dU0V+xE5hXnRKOEDwy/69QraQBDm6
s3Nu9c/MNZe2TAYBCnDoiMkpagvCXKo9S2Edx4ukJYHYA6jg6DYdwODZ/KprXyqpJc0mQt3TYjPK
SFIN1kihLgbezTBclhckiaotqiY6mjgg2UjSAEti0NtbGyI1Qfjw49uFpMdoliZ7Wxnc2kRiBErk
gwiOitgerukU4Uas50NK2O9ONYZSc3Bbhrp3ZZEYxA9R7hI=</xenc:CipherValue></xenc:CipherData></xenc:EncryptedData></soap:Body></soap:Envelope>
--------------------------------------
outbound throw exception:
Outbound Message
---------------------------
ID: 2
Address: http://localhost:9080/sec
Encoding: UTF-8
Content-Type: text/xml
Headers: {connection=[keep-alive], transfer-encoding=[chunked],
Host=[localhost:8080],
SOAPAction=["http://demo.ti.tongtech.com/security/input"],
User-Agent=[Apache CXF 2.4.0-SNAPSHOT], Accept=[*/*], Pragma=[no-cache],
Cache-Control=[no-cache]}
Payload: <soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><wsse:Security
soap:mustUnderstand="1"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><xenc:EncryptedKey
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
Id="EncKeyId-C892C3DEF48D9D312B12893692122755"><xenc:EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/><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"><ds:X509Data>
<ds:X509IssuerSerial>
<ds:X509IssuerName>CN=tongtech.com,C=CN</ds:X509IssuerName>
<ds:X509SerialNumber>1288107035</ds:X509SerialNumber>
</ds:X509IssuerSerial>
</ds:X509Data></wsse:SecurityTokenReference>
</ds:KeyInfo><xenc:CipherData><xenc:CipherValue>PWn3xKniypUQNKaSRn9NlrU0BZ/OLXW+KUHuh4q6MrldUWyolkLx3qaGRjpW2WeZeW1WXLGIj0N6EX+MWfx4uX1HEktmcZOA7XSFTPoGLxWqhEDBc4K0depEPD+AMe7WtJkJiIqgis3ZVIGIlbWXnxdLxkUsrxCkKZTbXql8uL2ZR5strVPO+0vIHfckrVvi7RARH4600QHy78C2lSy+pIYkVcsymS7jWkc74dXYp1ZDRRfCwCLhCiBb88WicC6b387kgjjYjaozIycFvyY5Kde5cgy+dN+K/RSC4O0mPwbrYU6Fppvkk+jshrzlvwMLNsZuXmF7ZZANljRTOcXJnA==</xenc:CipherValue></xenc:CipherData><xenc:ReferenceList><xenc:DataReference
URI="#EncDataId-4"/></xenc:ReferenceList></xenc:EncryptedKey><ds:Signature
xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="Signature-2">
<ds:SignedInfo>
<ds:CanonicalizationMethod
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#id-3">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>HSig0sWSVObUJW5zxTSkoLTbvE0=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
Iv/gKsHOXgaHIw7gx/nvdIQhp/FM64bdWBbqkrLFXbQ0MYfFmfjgWGoLiYMHwlbvuIyh3EuHw3OS
bBB68C7qaQFPmrIr8u0Z2fYK8TGdo+cs72UWICdC2WT6PHg2BKGIsxhP4lkcL+V+6WWNcKCs4Cak
XyyegZ6km3zyOraXFIJzHmA8pW9g/no5UcPVKHcZFcTCLgPjRSAokY35mtMvI3+rYplPh+ZUMXLF
8akFQLXmsNOoBu0iU1NRb1VSKqhDO/RfGddIqOamuvx+/JFULDWT6Hnq2VQZA9viC4HBQZjUXNJV
J+xQCCx/+0jbCGq3Eh2UECpDKmO+PQIq0jb4IA==
</ds:SignatureValue>
<ds:KeyInfo Id="KeyId-C892C3DEF48D9D312B12893692105452">
<wsse:SecurityTokenReference
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"
wsu:Id="STRId-C892C3DEF48D9D312B12893692105483"><ds:X509Data>
<ds:X509IssuerSerial>
<ds:X509IssuerName>CN=tongtech.com,C=CN</ds:X509IssuerName>
<ds:X509SerialNumber>1288107001</ds:X509SerialNumber>
</ds:X509IssuerSerial>
</ds:X509Data></wsse:SecurityTokenReference>
</ds:KeyInfo>
</ds:Signature><wsu:Timestamp
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="Timestamp-1"><wsu:Created>2010-11-10T06:06:50.458Z</wsu:Created><wsu:Expires>2010-11-10T06:11:50.458Z</wsu:Expires></wsu:Timestamp></wsse:Security></soap:Header><soap:Body><ns2:input
xmlns:ns2="http://demo.ti.tongtech.com/security/"><in>Input
Value!</in></ns2:input></soap:Body></soap:Envelope>
--------------------------------------
2010-11-10 14:07:56 org.apache.camel.processor.Logger log
严重: Failed delivery for exchangeId:
ID-NoGrief-MPC-55174-1289369185031-0-2. Exhausted after delivery
attempt: 1 caught: java.net.SocketTimeoutException: Read timed out
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:766)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1072)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2197)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:2171)
at
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$2.run(AutomaticWorkQueueImpl.java:253)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
2010-11-10 14:07:56 org.apache.cxf.phase.PhaseInterceptorChain
doDefaultLogging
警告: Interceptor for
{http://demo.ti.tongtech.com/security/}ISecuriyService#{http://demo.ti.tongtech.com/security/}input
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Read timed out
at
org.apache.camel.component.cxf.CxfConsumer$1.checkFailure(CxfConsumer.java:223)
at
org.apache.camel.component.cxf.CxfConsumer$1.setResponseBack(CxfConsumer.java:200)
at
org.apache.camel.component.cxf.CxfConsumer$1.asyncInvoke(CxfConsumer.java:120)
at org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:68)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:93)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
at
org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:222)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:70)
at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:311)
at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:280)
at
org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:922)
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:860)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:185)
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114)
at org.eclipse.jetty.server.Server.handleAsync(Server.java:397)
at
org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:601)
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:410)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:510)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
at
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:766)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1072)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2197)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:2171)
at
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$2.run(AutomaticWorkQueueImpl.java:253)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
... 1 more
outbound server dont do anythink..
于 2010/11/8 12:03, Willem Jiang 写道:
I can't give you more answer just from the stack trace that you gave.
Please provide a simple test case for this issue.
BTW, you can take a look at this page[1] for tracking the CXF endpoint
in out message.
[1]http://cxf.apache.org/docs/debugging-and-logging.html
On 11/8/10 11:08 AM, Jinglong Wang wrote:
*Hi,*
*I use cxf-camel with X509 security, but cxf-camel cant outbound.*
*the exception is:*
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:766)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1072)
at
java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2197)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:2171)
at
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$2.run(AutomaticWorkQueueImpl.java:253)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
... 1 more
*single with cxf is ok.*
**
*outbound server is started..*
**
*thanks*
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang