You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Juan Pablo Pizarro <ju...@gmail.com> on 2010/12/20 13:20:50 UTC

Timestamp/Body - signatureParts

Hello All, I' trying to call a .net web service with spring - cxf
configuration. I getting the following exception:

General security error (WSEncryptBody/WSSignEnvelope: Element to
encrypt/sign not found:
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd,
Timestamp) (the same with Body part).

The error is clear.. but I call the same service with soapUI and it works
with timestamp and body in the Parts configuration.

Then, I suppose that timestamp and body will be there (signatureParts).

My client-beans.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:jaxws="http://cxf.apache.org/jaxws"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:p="http://cxf.apache.org/policy"
    xmlns:cxf="http://cxf.apache.org/core"
    xmlns:wsa="http://cxf.apache.org/ws/addressing"
    xmlns:http="http://cxf.apache.org/transports/http/configuration"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
    http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
    http://schemas.xmlsoap.org/ws/2005/02/rm/policy
http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd
    http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
       ">

    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml"
/>
    <import resource="classpath:META-INF/cxf/cxf-extension-policy.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-ws-security.xml"
/>

    <cxf:bus>
        <cxf:features>
            <p:policies />
            <cxf:logging />
            <wsa:addressing />
        </cxf:features>
    </cxf:bus>

    <http:conduit name="http://wss.aduanas.gub.uy/.*">
        <http:client Connection="Keep-Alive"
        AllowChunking="false"
        ConnectionTimeout="120000"
        ReceiveTimeout="120000"
        ContentType="application/soap+xml;charset=UTF-8"/>
    </http:conduit>

    <bean id="wsclient" class="org.tempuri.IStock"
factory-bean="wsFactory"    factory-method="create" />

    <bean id="wsFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
        <property name="serviceClass" value="org.tempuri.IStock" />
        <property name="address" value="
http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc" />

        <property name="outInterceptors">
            <list>
                <bean
class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" />
                <ref bean="wss4jOutInterceptor" />
            </list>
        </property>
    </bean>

    <bean id="wss4jOutInterceptor"
class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
        <constructor-arg>
            <map>
                <entry key="action" value="Signature" />
                <entry key="signaturePropFile"
value="Client_Sign.properties" />
                <entry key="user"
value="le-60dca1be-5393-48b3-bbc3-0dfb1ab40d25" />
                <entry key="passwordType" value="PasswordDigest" />
                <entry key="mustUnderstand" value="false" />
                <entry key="signatureKeyIdentifier" value="DirectReference"
/>

                <entry key="passwordCallbackRef">
                    <ref bean="signaturePwdCallback" />
                </entry>
                <entry key="signatureParts"    value="{Element}{
http://www.w3.org/2005/08/addressing}Action;{Element}{http://www.w3.org/2005/08/addressing}ReplyTo;{Element}{http://www.w3.org/2005/08/addressing}MessageID;{Element}{http://www.w3.org/2005/08/addressing}To;{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;{Content}{http://www.w3.org/2003/05/soap-envelope}Body"
/>
            </map>
        </constructor-arg>
    </bean>

    <bean id="signaturePwdCallback" class="org.jpp.ws.client.ClientCallback"
/>

</beans>

The wsdl:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="MenStock" targetNamespace="http://tempuri.org/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="
http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:wsu="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsam="
http://www.w3.org/2007/05/addressing/metadata"
    xmlns:tns="http://tempuri.org/" xmlns:wsa="
http://schemas.xmlsoap.org/ws/2004/08/addressing"
    xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="
http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="
http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
    xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="
http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="
http://schemas.xmlsoap.org/ws/2004/09/mex">
    <wsp:Policy wsu:Id="CustomBinding_IStock_policy">
        <wsp:ExactlyOne>
            <wsp:All>
                <sp:AsymmetricBinding
                    xmlns:sp="
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy>
                        <sp:InitiatorToken>
                            <wsp:Policy>
                                <sp:X509Token
                                    sp:IncludeToken="
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient
">
                                    <wsp:Policy>
                                        <sp:WssX509V3Token10 />
                                    </wsp:Policy>
                                </sp:X509Token>
                            </wsp:Policy>
                        </sp:InitiatorToken>
                        <sp:RecipientToken>
                            <wsp:Policy>
                                <sp:X509Token
                                    sp:IncludeToken="
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
                                    <wsp:Policy>
                                        <sp:WssX509V3Token10 />
                                    </wsp:Policy>
                                </sp:X509Token>
                            </wsp:Policy>
                        </sp:RecipientToken>
                        <sp:AlgorithmSuite>
                            <wsp:Policy>
                                <sp:Basic256 />
                            </wsp:Policy>
                        </sp:AlgorithmSuite>
                        <sp:Layout>
                            <wsp:Policy>
                                <sp:Lax />
                            </wsp:Policy>
                        </sp:Layout>
                        <sp:IncludeTimestamp />
                        <sp:OnlySignEntireHeadersAndBody />
                    </wsp:Policy>
                </sp:AsymmetricBinding>
                <sp:Wss10 xmlns:sp="
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy>
                        <sp:MustSupportRefKeyIdentifier />
                        <sp:MustSupportRefIssuerSerial />
                    </wsp:Policy>
                </sp:Wss10>
                <sp:Trust10 xmlns:sp="
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy>
                        <sp:MustSupportIssuedTokens />
                        <sp:RequireClientEntropy />
                        <sp:RequireServerEntropy />
                    </wsp:Policy>
                </sp:Trust10>
                <wsaw:UsingAddressing />
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>
    <wsp:Policy wsu:Id="CustomBinding_IStock_MensajeStock_Input_policy">
        <wsp:ExactlyOne>
            <wsp:All>
                <sp:SignedParts
                    xmlns:sp="
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <sp:Body />
                    <sp:Header Name="To" Namespace="
http://www.w3.org/2005/08/addressing" />
                    <sp:Header Name="From" Namespace="
http://www.w3.org/2005/08/addressing" />
                    <sp:Header Name="FaultTo" Namespace="
http://www.w3.org/2005/08/addressing" />
                    <sp:Header Name="ReplyTo" Namespace="
http://www.w3.org/2005/08/addressing" />
                    <sp:Header Name="MessageID" Namespace="
http://www.w3.org/2005/08/addressing" />
                    <sp:Header Name="RelatesTo" Namespace="
http://www.w3.org/2005/08/addressing" />
                    <sp:Header Name="Action" Namespace="
http://www.w3.org/2005/08/addressing" />
                </sp:SignedParts>
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>
    <wsp:Policy wsu:Id="CustomBinding_IStock_MensajeStock_output_policy">
        <wsp:ExactlyOne>
            <wsp:All>
                <sp:SignedParts
                    xmlns:sp="
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <sp:Body />
                    <sp:Header Name="To" Namespace="
http://www.w3.org/2005/08/addressing" />
                    <sp:Header Name="From" Namespace="
http://www.w3.org/2005/08/addressing" />
                    <sp:Header Name="FaultTo" Namespace="
http://www.w3.org/2005/08/addressing" />
                    <sp:Header Name="ReplyTo" Namespace="
http://www.w3.org/2005/08/addressing" />
                    <sp:Header Name="MessageID" Namespace="
http://www.w3.org/2005/08/addressing" />
                    <sp:Header Name="RelatesTo" Namespace="
http://www.w3.org/2005/08/addressing" />
                    <sp:Header Name="Action" Namespace="
http://www.w3.org/2005/08/addressing" />
                </sp:SignedParts>
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>
    <wsdl:types>
        <xsd:schema targetNamespace="http://tempuri.org/Imports">
            <xsd:import
                schemaLocation="
http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc?xsd=xsd0"
                namespace="http://tempuri.org/" />
            <xsd:import
                schemaLocation="
http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc?xsd=xsd1"
                namespace="
http://schemas.microsoft.com/2003/10/Serialization/" />
            <xsd:import
                schemaLocation="
http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc?xsd=xsd2"
                namespace="http://schemas.datacontract.org/2004/07/WCF_Stock"
/>
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="IStock_MensajeStock_InputMessage">
        <wsdl:part name="parameters" element="tns:MensajeStock" />
    </wsdl:message>
    <wsdl:message name="IStock_MensajeStock_OutputMessage">
        <wsdl:part name="parameters" element="tns:MensajeStockResponse" />
    </wsdl:message>
    <wsdl:portType name="IStock">
        <wsdl:operation name="MensajeStock">
            <wsdl:input wsaw:Action="http://tempuri.org/IStock/MensajeStock"
                message="tns:IStock_MensajeStock_InputMessage" />
            <wsdl:output wsaw:Action="
http://tempuri.org/IStock/MensajeStockResponse"
                message="tns:IStock_MensajeStock_OutputMessage" />
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="CustomBinding_IStock" type="tns:IStock">
        <wsp:PolicyReference URI="#CustomBinding_IStock_policy" />
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="MensajeStock">
            <soap12:operation soapAction="
http://tempuri.org/IStock/MensajeStock"
                style="document" />
            <wsdl:input>
                <wsp:PolicyReference
                    URI="#CustomBinding_IStock_MensajeStock_Input_policy" />
                <soap12:body use="literal" />
            </wsdl:input>
            <wsdl:output>
                <wsp:PolicyReference
                    URI="#CustomBinding_IStock_MensajeStock_output_policy"
/>
                <soap12:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="MenStock">
        <wsdl:port name="CustomBinding_IStock"
binding="tns:CustomBinding_IStock">
            <soap12:address location="
http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc" />
            <wsa10:EndpointReference>
                <wsa10:Address>
http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc</wsa10:Address>
                <Identity xmlns="
http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
                    <Dns>wss.aduanas.gub.uy</Dns>
                </Identity>
            </wsa10:EndpointReference>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

Any suggestion or link to avoid my error?

Thanks!

Re: Timestamp/Body - signatureParts

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

As your action part is like
<entry key="action" value="Signature" />
there's no Timestamp action, so there would be no Timestamp soap  
security header,  but your signatureParts want to sign Timestamp soap  
security header, which is nonexistent.

Freeman

On 2010-12-20, at 下午8:20, Juan Pablo Pizarro wrote:

> Hello All, I' trying to call a .net web service with spring - cxf
> configuration. I getting the following exception:
>
> General security error (WSEncryptBody/WSSignEnvelope: Element to
> encrypt/sign not found:
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd 
> ,
> Timestamp) (the same with Body part).
>
> The error is clear.. but I call the same service with soapUI and it  
> works
> with timestamp and body in the Parts configuration.
>
> Then, I suppose that timestamp and body will be there  
> (signatureParts).
>
> My client-beans.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>    xmlns:jaxws="http://cxf.apache.org/jaxws"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xmlns:p="http://cxf.apache.org/policy"
>    xmlns:cxf="http://cxf.apache.org/core"
>    xmlns:wsa="http://cxf.apache.org/ws/addressing"
>    xmlns:http="http://cxf.apache.org/transports/http/configuration"
>    xsi:schemaLocation="
>    http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
>    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
>    http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
>    http://schemas.xmlsoap.org/ws/2005/02/rm/policy
> http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd
>    http://cxf.apache.org/transports/http/configuration
> http://cxf.apache.org/schemas/configuration/http-conf.xsd
>       ">
>
>    <import resource="classpath:META-INF/cxf/cxf.xml" />
>    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>    <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
>    <import resource="classpath:META-INF/cxf/cxf-extension-http- 
> binding.xml"
> />
>    <import resource="classpath:META-INF/cxf/cxf-extension- 
> policy.xml" />
>    <import resource="classpath:META-INF/cxf/cxf-extension-ws- 
> security.xml"
> />
>
>    <cxf:bus>
>        <cxf:features>
>            <p:policies />
>            <cxf:logging />
>            <wsa:addressing />
>        </cxf:features>
>    </cxf:bus>
>
>    <http:conduit name="http://wss.aduanas.gub.uy/.*">
>        <http:client Connection="Keep-Alive"
>        AllowChunking="false"
>        ConnectionTimeout="120000"
>        ReceiveTimeout="120000"
>        ContentType="application/soap+xml;charset=UTF-8"/>
>    </http:conduit>
>
>    <bean id="wsclient" class="org.tempuri.IStock"
> factory-bean="wsFactory"    factory-method="create" />
>
>    <bean id="wsFactory"  
> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>        <property name="serviceClass" value="org.tempuri.IStock" />
>        <property name="address" value="
> http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc" />
>
>        <property name="outInterceptors">
>            <list>
>                <bean
> class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" />
>                <ref bean="wss4jOutInterceptor" />
>            </list>
>        </property>
>    </bean>
>
>    <bean id="wss4jOutInterceptor"
> class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
>        <constructor-arg>
>            <map>
>                <entry key="action" value="Signature" />
>                <entry key="signaturePropFile"
> value="Client_Sign.properties" />
>                <entry key="user"
> value="le-60dca1be-5393-48b3-bbc3-0dfb1ab40d25" />
>                <entry key="passwordType" value="PasswordDigest" />
>                <entry key="mustUnderstand" value="false" />
>                <entry key="signatureKeyIdentifier"  
> value="DirectReference"
> />
>
>                <entry key="passwordCallbackRef">
>                    <ref bean="signaturePwdCallback" />
>                </entry>
>                <entry key="signatureParts"    value="{Element}{
> http://www.w3.org/2005/08/addressing}Action;{Element}{http://www.w3.org/2005/08/addressing 
> }ReplyTo;{Element}{http://www.w3.org/2005/08/addressing}MessageID; 
> {Element}{http://www.w3.org/2005/08/addressing}To;{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd 
> }Timestamp;{Content}{http://www.w3.org/2003/05/soap-envelope}Body"
> />
>            </map>
>        </constructor-arg>
>    </bean>
>
>    <bean id="signaturePwdCallback"  
> class="org.jpp.ws.client.ClientCallback"
> />
>
> </beans>
>
> The wsdl:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions name="MenStock" targetNamespace="http:// 
> tempuri.org/"
>    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="
> http://schemas.xmlsoap.org/wsdl/soap/"
>    xmlns:wsu="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
> "
>    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"  
> xmlns:wsam="
> http://www.w3.org/2007/05/addressing/metadata"
>    xmlns:tns="http://tempuri.org/" xmlns:wsa="
> http://schemas.xmlsoap.org/ws/2004/08/addressing"
>    xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"  
> xmlns:wsap="
> http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
>    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="
> http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
>    xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"  
> xmlns:soap12="
> http://schemas.xmlsoap.org/wsdl/soap12/"
>    xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="
> http://schemas.xmlsoap.org/ws/2004/09/mex">
>    <wsp:Policy wsu:Id="CustomBinding_IStock_policy">
>        <wsp:ExactlyOne>
>            <wsp:All>
>                <sp:AsymmetricBinding
>                    xmlns:sp="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>                    <wsp:Policy>
>                        <sp:InitiatorToken>
>                            <wsp:Policy>
>                                <sp:X509Token
>                                    sp:IncludeToken="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient
> ">
>                                    <wsp:Policy>
>                                        <sp:WssX509V3Token10 />
>                                    </wsp:Policy>
>                                </sp:X509Token>
>                            </wsp:Policy>
>                        </sp:InitiatorToken>
>                        <sp:RecipientToken>
>                            <wsp:Policy>
>                                <sp:X509Token
>                                    sp:IncludeToken="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never 
> ">
>                                    <wsp:Policy>
>                                        <sp:WssX509V3Token10 />
>                                    </wsp:Policy>
>                                </sp:X509Token>
>                            </wsp:Policy>
>                        </sp:RecipientToken>
>                        <sp:AlgorithmSuite>
>                            <wsp:Policy>
>                                <sp:Basic256 />
>                            </wsp:Policy>
>                        </sp:AlgorithmSuite>
>                        <sp:Layout>
>                            <wsp:Policy>
>                                <sp:Lax />
>                            </wsp:Policy>
>                        </sp:Layout>
>                        <sp:IncludeTimestamp />
>                        <sp:OnlySignEntireHeadersAndBody />
>                    </wsp:Policy>
>                </sp:AsymmetricBinding>
>                <sp:Wss10 xmlns:sp="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>                    <wsp:Policy>
>                        <sp:MustSupportRefKeyIdentifier />
>                        <sp:MustSupportRefIssuerSerial />
>                    </wsp:Policy>
>                </sp:Wss10>
>                <sp:Trust10 xmlns:sp="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>                    <wsp:Policy>
>                        <sp:MustSupportIssuedTokens />
>                        <sp:RequireClientEntropy />
>                        <sp:RequireServerEntropy />
>                    </wsp:Policy>
>                </sp:Trust10>
>                <wsaw:UsingAddressing />
>            </wsp:All>
>        </wsp:ExactlyOne>
>    </wsp:Policy>
>    <wsp:Policy  
> wsu:Id="CustomBinding_IStock_MensajeStock_Input_policy">
>        <wsp:ExactlyOne>
>            <wsp:All>
>                <sp:SignedParts
>                    xmlns:sp="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>                    <sp:Body />
>                    <sp:Header Name="To" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="From" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="FaultTo" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="ReplyTo" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="MessageID" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="RelatesTo" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="Action" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                </sp:SignedParts>
>            </wsp:All>
>        </wsp:ExactlyOne>
>    </wsp:Policy>
>    <wsp:Policy  
> wsu:Id="CustomBinding_IStock_MensajeStock_output_policy">
>        <wsp:ExactlyOne>
>            <wsp:All>
>                <sp:SignedParts
>                    xmlns:sp="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>                    <sp:Body />
>                    <sp:Header Name="To" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="From" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="FaultTo" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="ReplyTo" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="MessageID" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="RelatesTo" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="Action" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                </sp:SignedParts>
>            </wsp:All>
>        </wsp:ExactlyOne>
>    </wsp:Policy>
>    <wsdl:types>
>        <xsd:schema targetNamespace="http://tempuri.org/Imports">
>            <xsd:import
>                schemaLocation="
> http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc?xsd=xsd0"
>                namespace="http://tempuri.org/" />
>            <xsd:import
>                schemaLocation="
> http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc?xsd=xsd1"
>                namespace="
> http://schemas.microsoft.com/2003/10/Serialization/" />
>            <xsd:import
>                schemaLocation="
> http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc?xsd=xsd2"
>                namespace="http://schemas.datacontract.org/2004/07/WCF_Stock 
> "
> />
>        </xsd:schema>
>    </wsdl:types>
>    <wsdl:message name="IStock_MensajeStock_InputMessage">
>        <wsdl:part name="parameters" element="tns:MensajeStock" />
>    </wsdl:message>
>    <wsdl:message name="IStock_MensajeStock_OutputMessage">
>        <wsdl:part name="parameters"  
> element="tns:MensajeStockResponse" />
>    </wsdl:message>
>    <wsdl:portType name="IStock">
>        <wsdl:operation name="MensajeStock">
>            <wsdl:input wsaw:Action="http://tempuri.org/IStock/MensajeStock 
> "
>                message="tns:IStock_MensajeStock_InputMessage" />
>            <wsdl:output wsaw:Action="
> http://tempuri.org/IStock/MensajeStockResponse"
>                message="tns:IStock_MensajeStock_OutputMessage" />
>        </wsdl:operation>
>    </wsdl:portType>
>    <wsdl:binding name="CustomBinding_IStock" type="tns:IStock">
>        <wsp:PolicyReference URI="#CustomBinding_IStock_policy" />
>        <soap12:binding transport="http://schemas.xmlsoap.org/soap/ 
> http" />
>        <wsdl:operation name="MensajeStock">
>            <soap12:operation soapAction="
> http://tempuri.org/IStock/MensajeStock"
>                style="document" />
>            <wsdl:input>
>                <wsp:PolicyReference
>                     
> URI="#CustomBinding_IStock_MensajeStock_Input_policy" />
>                <soap12:body use="literal" />
>            </wsdl:input>
>            <wsdl:output>
>                <wsp:PolicyReference
>                     
> URI="#CustomBinding_IStock_MensajeStock_output_policy"
> />
>                <soap12:body use="literal" />
>            </wsdl:output>
>        </wsdl:operation>
>    </wsdl:binding>
>    <wsdl:service name="MenStock">
>        <wsdl:port name="CustomBinding_IStock"
> binding="tns:CustomBinding_IStock">
>            <soap12:address location="
> http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc" />
>            <wsa10:EndpointReference>
>                <wsa10:Address>
> http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc</wsa10:Address>
>                <Identity xmlns="
> http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
>                    <Dns>wss.aduanas.gub.uy</Dns>
>                </Identity>
>            </wsa10:EndpointReference>
>        </wsdl:port>
>    </wsdl:service>
> </wsdl:definitions>
>
> Any suggestion or link to avoid my error?
>
> Thanks!


-- 
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


Re: Timestamp/Body - signatureParts

Posted by Juan Pablo Pizarro <ju...@gmail.com>.
Colm/Freeman, first, thanks for your time.

I change my configurarion and the client but the "no signing" still here.

My client:

...

factory.getClientFactoryBean().setBindingId(SoapBindingFactory.SOAP_12_BINDING);
        IStock client = (IStock) factory.create();
...


My config:

    <bean id="wss4jOutInterceptor"
class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
        <constructor-arg>
            <map>
                <entry key="action" value="Timestamp Signature" />
                <entry key="signaturePropFile"
value="Client_Sign.properties" />
                <entry key="user"
value="le-60dca1be-5393-48b3-bbc3-0dfb1ab40d25" />
                <entry key="passwordType" value="PasswordDigest" />
                <entry key="signatureKeyIdentifier" value="DirectReference"
/>

                <entry key="passwordCallbackRef">
                    <ref bean="signaturePwdCallback" />
                </entry>

                <entry key="signatureParts"
                    value="
                {Element}{
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp
                ;{Element}{http://www.w3.org/2005/08/addressing}Action
                ;{Element}{http://www.w3.org/2005/08/addressing}ReplyTo
                ;{Element}{http://www.w3.org/2005/08/addressing}MessageID
                ;{Element}{http://www.w3.org/2005/08/addressing}To" />

            </map>
        </constructor-arg>
    </bean>



Now it's sending:

    <soap:Header>
        <wsse:Security
            xmlns:wsse="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
"
            soap:mustUnderstand="true">
            <wsse:BinarySecurityToken
                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
"
                EncodingType="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary
"
                ValueType="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3
"

wsu:Id="CertId-9177EABCC0FA1AA58312928552834221">.............
            </wsse:BinarySecurityToken>
            <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="#Timestamp-1">
                        <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>mkDzojDJkFY86TBUBnNH1UD4cB8=</ds:DigestValue>
                    </ds:Reference>
                    <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>rrso6ChGIQLM2bhpMFdkuOSVCgc=</ds:DigestValue>
                    </ds:Reference>
                    <ds:Reference URI="#id-4">
                        <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>0WEomLThsBGRU/QsTKlsKGK5ILI=</ds:DigestValue>
                    </ds:Reference>
                    <ds:Reference URI="#id-5">
                        <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>DMrsmt/9tc0DXPb02amNvm+yrNM=</ds:DigestValue>
                    </ds:Reference>
                    <ds:Reference URI="#id-6">
                        <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>9y0ZTPYC4mYWIF5u5ZGchgHtpHk=</ds:DigestValue>
                    </ds:Reference>
                </ds:SignedInfo>
                <ds:SignatureValue>

jiPW+yf/Eja7st9poDS2NnYq8U9UTErIHmtiRV32H8TSIcDy489rKdv7ZnmaqosBp2cInuzqDROG

hRcOtD0kx8b+HfFy9+TSaJ6tT3LaY8ncPx6e0mohbdBn26sB2L7qOCFORnjr818lKwiAxAFCZkVI
                    yt4bsAI40BKXRYbZMUg=
</ds:SignatureValue>
                <ds:KeyInfo Id="KeyId-9177EABCC0FA1AA58312928552834412">
                    <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-9177EABCC0FA1AA58312928552834443">
                        <wsse:Reference
                            xmlns:wsse="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
"
                            URI="#CertId-9177EABCC0FA1AA58312928552834221"
                            ValueType="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"
/>
                    </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-12-20T14:28:03.404Z</wsu:Created>
                <wsu:Expires>2010-12-20T14:33:03.404Z</wsu:Expires>
            </wsu:Timestamp>
        </wsse:Security>
        <Action xmlns="http://www.w3.org/2005/08/addressing"
            xmlns:wsu="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
"
            wsu:Id="id-3">http://tempuri.org/IStock/MensajeStock</Action>
        <MessageID xmlns="http://www.w3.org/2005/08/addressing"
            xmlns:wsu="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
"

wsu:Id="id-5">urn:uuid:123b43d5-1daa-4a8c-9e5d-945ace98a706</MessageID>
        <To xmlns="http://www.w3.org/2005/08/addressing"
            xmlns:wsu="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
"
            wsu:Id="id-6">
http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc</To>
        <ReplyTo xmlns="http://www.w3.org/2005/08/addressing"
            xmlns:wsu="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
"
            wsu:Id="id-4">
            <Address>http://www.w3.org/2005/08/addressing/anonymous
</Address>
        </ReplyTo>
    </soap:Header>


Any idea?

Thanks!!

2010/12/20 Juan Pablo Pizarro <ju...@gmail.com>

> Freeman, thanks for your answer. I added the timestamp action like:
>
>
>                 <entry key="action" value="Timestamp Signature" />
>
> But isn't work.
>
> I read this:
> http://markmail.org/message/anrftxie56j43bey#query:+page:1+mid:gnojqbxxesel5net+state:results
>
> Is it possible? I mean, I'm wrote the second interceptor and up to now..
> nothing.
>
> <map>
>                 <entry key="action" value="Timestamp Signature" />
>
>                 <entry key="signaturePropFile"
> value="Client_Sign.properties" />
>                 <entry key="user"
> value="le-60dca1be-5393-48b3-bbc3-0dfb1ab40d25" />
>                 <entry key="passwordType" value="PasswordDigest" />
>                 <entry key="signatureKeyIdentifier" value="DirectReference"
> />
>
>                 <entry key="passwordCallbackRef">
>                     <ref bean="signaturePwdCallback" />
>                 </entry>
>
>                 <entry key="signatureParts"    value="
>
> {Element}{WebContent/WEB-INF/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp
> // With the phisical file and the link.
>                 ;{Element}{http://www.w3.org/2005/08/addressing}Action<http://www.w3.org/2005/08/addressing%7DAction>
>
>                 ;{Element}{http://www.w3.org/2005/08/addressing}ReplyTo<http://www.w3.org/2005/08/addressing%7DReplyTo>
>                 ;{Element}{http://www.w3.org/2005/08/addressing}MessageID<http://www.w3.org/2005/08/addressing%7DMessageID>
>                 ;{Element}{http://www.w3.org/2005/08/addressing}To<http://www.w3.org/2005/08/addressing%7DTo>"
> />
>             </map>
>
> 2010/12/20 Colm O hEigeartaigh <co...@apache.org>
>
> The error is that WSS4J can't find the element to sign (Timestamp).
>> You could probably fix this by adding a timestamp action to the
>> WSS4JOutInterceptor configuration:
>>
>>  <entry key="action" value="Timestamp Signature" />
>>
>> Colm.
>>
>> On Mon, Dec 20, 2010 at 12:20 PM, Juan Pablo Pizarro
>> <ju...@gmail.com> wrote:
>> > Hello All, I' trying to call a .net web service with spring - cxf
>> > configuration. I getting the following exception:
>> >
>> > General security error (WSEncryptBody/WSSignEnvelope: Element to
>> > encrypt/sign not found:
>> >
>> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
>> ,
>> > Timestamp) (the same with Body part).
>> >
>> > The error is clear.. but I call the same service with soapUI and it
>> works
>> > with timestamp and body in the Parts configuration.
>> >
>> > Then, I suppose that timestamp and body will be there (signatureParts).
>> >
>> > My client-beans.xml
>> >
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <beans xmlns="http://www.springframework.org/schema/beans"
>> >    xmlns:jaxws="http://cxf.apache.org/jaxws"
>> >    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >    xmlns:p="http://cxf.apache.org/policy"
>> >    xmlns:cxf="http://cxf.apache.org/core"
>> >    xmlns:wsa="http://cxf.apache.org/ws/addressing"
>> >    xmlns:http="http://cxf.apache.org/transports/http/configuration"
>> >    xsi:schemaLocation="
>> >    http://www.springframework.org/schema/beans
>> > http://www.springframework.org/schema/beans/spring-beans.xsd
>> >    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
>> >    http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
>> >    http://schemas.xmlsoap.org/ws/2005/02/rm/policy
>> > http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd
>> >    http://cxf.apache.org/transports/http/configuration
>> > http://cxf.apache.org/schemas/configuration/http-conf.xsd
>> >       ">
>> >
>> >    <import resource="classpath:META-INF/cxf/cxf.xml" />
>> >    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>> >    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>> >    <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
>> >    <import
>> resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml"
>> > />
>> >    <import resource="classpath:META-INF/cxf/cxf-extension-policy.xml" />
>> >    <import
>> resource="classpath:META-INF/cxf/cxf-extension-ws-security.xml"
>> > />
>> >
>> >    <cxf:bus>
>> >        <cxf:features>
>> >            <p:policies />
>> >            <cxf:logging />
>> >            <wsa:addressing />
>> >        </cxf:features>
>> >    </cxf:bus>
>> >
>> >    <http:conduit name="http://wss.aduanas.gub.uy/.*">
>> >        <http:client Connection="Keep-Alive"
>> >        AllowChunking="false"
>> >        ConnectionTimeout="120000"
>> >        ReceiveTimeout="120000"
>> >        ContentType="application/soap+xml;charset=UTF-8"/>
>> >    </http:conduit>
>> >
>> >    <bean id="wsclient" class="org.tempuri.IStock"
>> > factory-bean="wsFactory"    factory-method="create" />
>> >
>> >    <bean id="wsFactory"
>> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>> >        <property name="serviceClass" value="org.tempuri.IStock" />
>> >        <property name="address" value="
>> > http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc" />
>> >
>> >        <property name="outInterceptors">
>> >            <list>
>> >                <bean
>> > class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" />
>> >                <ref bean="wss4jOutInterceptor" />
>> >            </list>
>> >        </property>
>> >    </bean>
>> >
>> >    <bean id="wss4jOutInterceptor"
>> > class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
>> >        <constructor-arg>
>> >            <map>
>> >                <entry key="action" value="Signature" />
>> >                <entry key="signaturePropFile"
>> > value="Client_Sign.properties" />
>> >                <entry key="user"
>> > value="le-60dca1be-5393-48b3-bbc3-0dfb1ab40d25" />
>> >                <entry key="passwordType" value="PasswordDigest" />
>> >                <entry key="mustUnderstand" value="false" />
>> >                <entry key="signatureKeyIdentifier"
>> value="DirectReference"
>> > />
>> >
>> >                <entry key="passwordCallbackRef">
>> >                    <ref bean="signaturePwdCallback" />
>> >                </entry>
>> >                <entry key="signatureParts"    value="{Element}{
>> >
>> http://www.w3.org/2005/08/addressing}Action;{Element}{http://www.w3.org/2005/08/addressing}ReplyTo;{Element}{http://www.w3.org/2005/08/addressing}MessageID;{Element}{http://www.w3.org/2005/08/addressing}To;{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;{Content}{http://www.w3.org/2003/05/soap-envelope}Body<http://www.w3.org/2005/08/addressing%7DAction;%7BElement%7D%7Bhttp://www.w3.org/2005/08/addressing%7DReplyTo;%7BElement%7D%7Bhttp://www.w3.org/2005/08/addressing%7DMessageID;%7BElement%7D%7Bhttp://www.w3.org/2005/08/addressing%7DTo;%7BElement%7D%7Bhttp://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd%7DTimestamp;%7BContent%7D%7Bhttp://www.w3.org/2003/05/soap-envelope%7DBody>
>> "
>> > />
>> >            </map>
>> >        </constructor-arg>
>> >    </bean>
>> >
>> >    <bean id="signaturePwdCallback"
>> class="org.jpp.ws.client.ClientCallback"
>> > />
>> >
>> > </beans>
>> >
>> > The wsdl:
>> >
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <wsdl:definitions name="MenStock" targetNamespace="http://tempuri.org/"
>> >    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="
>> > http://schemas.xmlsoap.org/wsdl/soap/"
>> >    xmlns:wsu="
>> >
>> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
>> > "
>> >    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>> xmlns:wsam="
>> > http://www.w3.org/2007/05/addressing/metadata"
>> >    xmlns:tns="http://tempuri.org/" xmlns:wsa="
>> > http://schemas.xmlsoap.org/ws/2004/08/addressing"
>> >    xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
>> xmlns:wsap="
>> > http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
>> >    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="
>> > http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
>> >    xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
>> xmlns:soap12="
>> > http://schemas.xmlsoap.org/wsdl/soap12/"
>> >    xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="
>> > http://schemas.xmlsoap.org/ws/2004/09/mex">
>> >    <wsp:Policy wsu:Id="CustomBinding_IStock_policy">
>> >        <wsp:ExactlyOne>
>> >            <wsp:All>
>> >                <sp:AsymmetricBinding
>> >                    xmlns:sp="
>> > http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>> >                    <wsp:Policy>
>> >                        <sp:InitiatorToken>
>> >                            <wsp:Policy>
>> >                                <sp:X509Token
>> >                                    sp:IncludeToken="
>> >
>> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient
>> > ">
>> >                                    <wsp:Policy>
>> >                                        <sp:WssX509V3Token10 />
>> >                                    </wsp:Policy>
>> >                                </sp:X509Token>
>> >                            </wsp:Policy>
>> >                        </sp:InitiatorToken>
>> >                        <sp:RecipientToken>
>> >                            <wsp:Policy>
>> >                                <sp:X509Token
>> >                                    sp:IncludeToken="
>> > http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never
>> ">
>> >                                    <wsp:Policy>
>> >                                        <sp:WssX509V3Token10 />
>> >                                    </wsp:Policy>
>> >                                </sp:X509Token>
>> >                            </wsp:Policy>
>> >                        </sp:RecipientToken>
>> >                        <sp:AlgorithmSuite>
>> >                            <wsp:Policy>
>> >                                <sp:Basic256 />
>> >                            </wsp:Policy>
>> >                        </sp:AlgorithmSuite>
>> >                        <sp:Layout>
>> >                            <wsp:Policy>
>> >                                <sp:Lax />
>> >                            </wsp:Policy>
>> >                        </sp:Layout>
>> >                        <sp:IncludeTimestamp />
>> >                        <sp:OnlySignEntireHeadersAndBody />
>> >                    </wsp:Policy>
>> >                </sp:AsymmetricBinding>
>> >                <sp:Wss10 xmlns:sp="
>> > http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>> >                    <wsp:Policy>
>> >                        <sp:MustSupportRefKeyIdentifier />
>> >                        <sp:MustSupportRefIssuerSerial />
>> >                    </wsp:Policy>
>> >                </sp:Wss10>
>> >                <sp:Trust10 xmlns:sp="
>> > http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>> >                    <wsp:Policy>
>> >                        <sp:MustSupportIssuedTokens />
>> >                        <sp:RequireClientEntropy />
>> >                        <sp:RequireServerEntropy />
>> >                    </wsp:Policy>
>> >                </sp:Trust10>
>> >                <wsaw:UsingAddressing />
>> >            </wsp:All>
>> >        </wsp:ExactlyOne>
>> >    </wsp:Policy>
>> >    <wsp:Policy wsu:Id="CustomBinding_IStock_MensajeStock_Input_policy">
>> >        <wsp:ExactlyOne>
>> >            <wsp:All>
>> >                <sp:SignedParts
>> >                    xmlns:sp="
>> > http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>> >                    <sp:Body />
>> >                    <sp:Header Name="To" Namespace="
>> > http://www.w3.org/2005/08/addressing" />
>> >                    <sp:Header Name="From" Namespace="
>> > http://www.w3.org/2005/08/addressing" />
>> >                    <sp:Header Name="FaultTo" Namespace="
>> > http://www.w3.org/2005/08/addressing" />
>> >                    <sp:Header Name="ReplyTo" Namespace="
>> > http://www.w3.org/2005/08/addressing" />
>> >                    <sp:Header Name="MessageID" Namespace="
>> > http://www.w3.org/2005/08/addressing" />
>> >                    <sp:Header Name="RelatesTo" Namespace="
>> > http://www.w3.org/2005/08/addressing" />
>> >                    <sp:Header Name="Action" Namespace="
>> > http://www.w3.org/2005/08/addressing" />
>> >                </sp:SignedParts>
>> >            </wsp:All>
>> >        </wsp:ExactlyOne>
>> >    </wsp:Policy>
>> >    <wsp:Policy wsu:Id="CustomBinding_IStock_MensajeStock_output_policy">
>> >        <wsp:ExactlyOne>
>> >            <wsp:All>
>> >                <sp:SignedParts
>> >                    xmlns:sp="
>> > http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>> >                    <sp:Body />
>> >                    <sp:Header Name="To" Namespace="
>> > http://www.w3.org/2005/08/addressing" />
>> >                    <sp:Header Name="From" Namespace="
>> > http://www.w3.org/2005/08/addressing" />
>> >                    <sp:Header Name="FaultTo" Namespace="
>> > http://www.w3.org/2005/08/addressing" />
>> >                    <sp:Header Name="ReplyTo" Namespace="
>> > http://www.w3.org/2005/08/addressing" />
>> >                    <sp:Header Name="MessageID" Namespace="
>> > http://www.w3.org/2005/08/addressing" />
>> >                    <sp:Header Name="RelatesTo" Namespace="
>> > http://www.w3.org/2005/08/addressing" />
>> >                    <sp:Header Name="Action" Namespace="
>> > http://www.w3.org/2005/08/addressing" />
>> >                </sp:SignedParts>
>> >            </wsp:All>
>> >        </wsp:ExactlyOne>
>> >    </wsp:Policy>
>> >    <wsdl:types>
>> >        <xsd:schema targetNamespace="http://tempuri.org/Imports">
>> >            <xsd:import
>> >                schemaLocation="
>> > http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc?xsd=xsd0"
>> >                namespace="http://tempuri.org/" />
>> >            <xsd:import
>> >                schemaLocation="
>> > http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc?xsd=xsd1"
>> >                namespace="
>> > http://schemas.microsoft.com/2003/10/Serialization/" />
>> >            <xsd:import
>> >                schemaLocation="
>> > http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc?xsd=xsd2"
>> >                namespace="
>> http://schemas.datacontract.org/2004/07/WCF_Stock"
>> > />
>> >        </xsd:schema>
>> >    </wsdl:types>
>> >    <wsdl:message name="IStock_MensajeStock_InputMessage">
>> >        <wsdl:part name="parameters" element="tns:MensajeStock" />
>> >    </wsdl:message>
>> >    <wsdl:message name="IStock_MensajeStock_OutputMessage">
>> >        <wsdl:part name="parameters" element="tns:MensajeStockResponse"
>> />
>> >    </wsdl:message>
>> >    <wsdl:portType name="IStock">
>> >        <wsdl:operation name="MensajeStock">
>> >            <wsdl:input wsaw:Action="
>> http://tempuri.org/IStock/MensajeStock"
>> >                message="tns:IStock_MensajeStock_InputMessage" />
>> >            <wsdl:output wsaw:Action="
>> > http://tempuri.org/IStock/MensajeStockResponse"
>> >                message="tns:IStock_MensajeStock_OutputMessage" />
>> >        </wsdl:operation>
>> >    </wsdl:portType>
>> >    <wsdl:binding name="CustomBinding_IStock" type="tns:IStock">
>> >        <wsp:PolicyReference URI="#CustomBinding_IStock_policy" />
>> >        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
>> />
>> >        <wsdl:operation name="MensajeStock">
>> >            <soap12:operation soapAction="
>> > http://tempuri.org/IStock/MensajeStock"
>> >                style="document" />
>> >            <wsdl:input>
>> >                <wsp:PolicyReference
>> >                    URI="#CustomBinding_IStock_MensajeStock_Input_policy"
>> />
>> >                <soap12:body use="literal" />
>> >            </wsdl:input>
>> >            <wsdl:output>
>> >                <wsp:PolicyReference
>> >
>>  URI="#CustomBinding_IStock_MensajeStock_output_policy"
>> > />
>> >                <soap12:body use="literal" />
>> >            </wsdl:output>
>> >        </wsdl:operation>
>> >    </wsdl:binding>
>> >    <wsdl:service name="MenStock">
>> >        <wsdl:port name="CustomBinding_IStock"
>> > binding="tns:CustomBinding_IStock">
>> >            <soap12:address location="
>> > http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc" />
>> >            <wsa10:EndpointReference>
>> >                <wsa10:Address>
>> > http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc</wsa10:Address>
>> >                <Identity xmlns="
>> > http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
>> >                    <Dns>wss.aduanas.gub.uy</Dns>
>> >                </Identity>
>> >            </wsa10:EndpointReference>
>> >        </wsdl:port>
>> >    </wsdl:service>
>> > </wsdl:definitions>
>> >
>> > Any suggestion or link to avoid my error?
>> >
>> > Thanks!
>> >
>>
>
>

Re: Timestamp/Body - signatureParts

Posted by Juan Pablo Pizarro <ju...@gmail.com>.
Freeman, thanks for your answer. I added the timestamp action like:

                <entry key="action" value="Timestamp Signature" />

But isn't work.

I read this:
http://markmail.org/message/anrftxie56j43bey#query:+page:1+mid:gnojqbxxesel5net+state:results

Is it possible? I mean, I'm wrote the second interceptor and up to now..
nothing.

<map>
                <entry key="action" value="Timestamp Signature" />
                <entry key="signaturePropFile"
value="Client_Sign.properties" />
                <entry key="user"
value="le-60dca1be-5393-48b3-bbc3-0dfb1ab40d25" />
                <entry key="passwordType" value="PasswordDigest" />
                <entry key="signatureKeyIdentifier" value="DirectReference"
/>

                <entry key="passwordCallbackRef">
                    <ref bean="signaturePwdCallback" />
                </entry>

                <entry key="signatureParts"    value="

{Element}{WebContent/WEB-INF/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp
// With the phisical file and the link.
                ;{Element}{http://www.w3.org/2005/08/addressing}Action
                ;{Element}{http://www.w3.org/2005/08/addressing}ReplyTo
                ;{Element}{http://www.w3.org/2005/08/addressing}MessageID
                ;{Element}{http://www.w3.org/2005/08/addressing}To" />
            </map>

2010/12/20 Colm O hEigeartaigh <co...@apache.org>

> The error is that WSS4J can't find the element to sign (Timestamp).
> You could probably fix this by adding a timestamp action to the
> WSS4JOutInterceptor configuration:
>
>  <entry key="action" value="Timestamp Signature" />
>
> Colm.
>
> On Mon, Dec 20, 2010 at 12:20 PM, Juan Pablo Pizarro
> <ju...@gmail.com> wrote:
> > Hello All, I' trying to call a .net web service with spring - cxf
> > configuration. I getting the following exception:
> >
> > General security error (WSEncryptBody/WSSignEnvelope: Element to
> > encrypt/sign not found:
> >
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
> ,
> > Timestamp) (the same with Body part).
> >
> > The error is clear.. but I call the same service with soapUI and it works
> > with timestamp and body in the Parts configuration.
> >
> > Then, I suppose that timestamp and body will be there (signatureParts).
> >
> > My client-beans.xml
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <beans xmlns="http://www.springframework.org/schema/beans"
> >    xmlns:jaxws="http://cxf.apache.org/jaxws"
> >    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >    xmlns:p="http://cxf.apache.org/policy"
> >    xmlns:cxf="http://cxf.apache.org/core"
> >    xmlns:wsa="http://cxf.apache.org/ws/addressing"
> >    xmlns:http="http://cxf.apache.org/transports/http/configuration"
> >    xsi:schemaLocation="
> >    http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
> >    http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> >    http://schemas.xmlsoap.org/ws/2005/02/rm/policy
> > http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd
> >    http://cxf.apache.org/transports/http/configuration
> > http://cxf.apache.org/schemas/configuration/http-conf.xsd
> >       ">
> >
> >    <import resource="classpath:META-INF/cxf/cxf.xml" />
> >    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> >    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> >    <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
> >    <import
> resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml"
> > />
> >    <import resource="classpath:META-INF/cxf/cxf-extension-policy.xml" />
> >    <import
> resource="classpath:META-INF/cxf/cxf-extension-ws-security.xml"
> > />
> >
> >    <cxf:bus>
> >        <cxf:features>
> >            <p:policies />
> >            <cxf:logging />
> >            <wsa:addressing />
> >        </cxf:features>
> >    </cxf:bus>
> >
> >    <http:conduit name="http://wss.aduanas.gub.uy/.*">
> >        <http:client Connection="Keep-Alive"
> >        AllowChunking="false"
> >        ConnectionTimeout="120000"
> >        ReceiveTimeout="120000"
> >        ContentType="application/soap+xml;charset=UTF-8"/>
> >    </http:conduit>
> >
> >    <bean id="wsclient" class="org.tempuri.IStock"
> > factory-bean="wsFactory"    factory-method="create" />
> >
> >    <bean id="wsFactory"
> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
> >        <property name="serviceClass" value="org.tempuri.IStock" />
> >        <property name="address" value="
> > http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc" />
> >
> >        <property name="outInterceptors">
> >            <list>
> >                <bean
> > class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" />
> >                <ref bean="wss4jOutInterceptor" />
> >            </list>
> >        </property>
> >    </bean>
> >
> >    <bean id="wss4jOutInterceptor"
> > class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
> >        <constructor-arg>
> >            <map>
> >                <entry key="action" value="Signature" />
> >                <entry key="signaturePropFile"
> > value="Client_Sign.properties" />
> >                <entry key="user"
> > value="le-60dca1be-5393-48b3-bbc3-0dfb1ab40d25" />
> >                <entry key="passwordType" value="PasswordDigest" />
> >                <entry key="mustUnderstand" value="false" />
> >                <entry key="signatureKeyIdentifier"
> value="DirectReference"
> > />
> >
> >                <entry key="passwordCallbackRef">
> >                    <ref bean="signaturePwdCallback" />
> >                </entry>
> >                <entry key="signatureParts"    value="{Element}{
> >
> http://www.w3.org/2005/08/addressing}Action;{Element}{http://www.w3.org/2005/08/addressing}ReplyTo;{Element}{http://www.w3.org/2005/08/addressing}MessageID;{Element}{http://www.w3.org/2005/08/addressing}To;{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;{Content}{http://www.w3.org/2003/05/soap-envelope}Body<http://www.w3.org/2005/08/addressing%7DAction;%7BElement%7D%7Bhttp://www.w3.org/2005/08/addressing%7DReplyTo;%7BElement%7D%7Bhttp://www.w3.org/2005/08/addressing%7DMessageID;%7BElement%7D%7Bhttp://www.w3.org/2005/08/addressing%7DTo;%7BElement%7D%7Bhttp://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd%7DTimestamp;%7BContent%7D%7Bhttp://www.w3.org/2003/05/soap-envelope%7DBody>
> "
> > />
> >            </map>
> >        </constructor-arg>
> >    </bean>
> >
> >    <bean id="signaturePwdCallback"
> class="org.jpp.ws.client.ClientCallback"
> > />
> >
> > </beans>
> >
> > The wsdl:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <wsdl:definitions name="MenStock" targetNamespace="http://tempuri.org/"
> >    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="
> > http://schemas.xmlsoap.org/wsdl/soap/"
> >    xmlns:wsu="
> >
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
> > "
> >    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:wsam="
> > http://www.w3.org/2007/05/addressing/metadata"
> >    xmlns:tns="http://tempuri.org/" xmlns:wsa="
> > http://schemas.xmlsoap.org/ws/2004/08/addressing"
> >    xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="
> > http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
> >    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="
> > http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
> >    xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="
> > http://schemas.xmlsoap.org/wsdl/soap12/"
> >    xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="
> > http://schemas.xmlsoap.org/ws/2004/09/mex">
> >    <wsp:Policy wsu:Id="CustomBinding_IStock_policy">
> >        <wsp:ExactlyOne>
> >            <wsp:All>
> >                <sp:AsymmetricBinding
> >                    xmlns:sp="
> > http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
> >                    <wsp:Policy>
> >                        <sp:InitiatorToken>
> >                            <wsp:Policy>
> >                                <sp:X509Token
> >                                    sp:IncludeToken="
> >
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient
> > ">
> >                                    <wsp:Policy>
> >                                        <sp:WssX509V3Token10 />
> >                                    </wsp:Policy>
> >                                </sp:X509Token>
> >                            </wsp:Policy>
> >                        </sp:InitiatorToken>
> >                        <sp:RecipientToken>
> >                            <wsp:Policy>
> >                                <sp:X509Token
> >                                    sp:IncludeToken="
> > http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never
> ">
> >                                    <wsp:Policy>
> >                                        <sp:WssX509V3Token10 />
> >                                    </wsp:Policy>
> >                                </sp:X509Token>
> >                            </wsp:Policy>
> >                        </sp:RecipientToken>
> >                        <sp:AlgorithmSuite>
> >                            <wsp:Policy>
> >                                <sp:Basic256 />
> >                            </wsp:Policy>
> >                        </sp:AlgorithmSuite>
> >                        <sp:Layout>
> >                            <wsp:Policy>
> >                                <sp:Lax />
> >                            </wsp:Policy>
> >                        </sp:Layout>
> >                        <sp:IncludeTimestamp />
> >                        <sp:OnlySignEntireHeadersAndBody />
> >                    </wsp:Policy>
> >                </sp:AsymmetricBinding>
> >                <sp:Wss10 xmlns:sp="
> > http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
> >                    <wsp:Policy>
> >                        <sp:MustSupportRefKeyIdentifier />
> >                        <sp:MustSupportRefIssuerSerial />
> >                    </wsp:Policy>
> >                </sp:Wss10>
> >                <sp:Trust10 xmlns:sp="
> > http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
> >                    <wsp:Policy>
> >                        <sp:MustSupportIssuedTokens />
> >                        <sp:RequireClientEntropy />
> >                        <sp:RequireServerEntropy />
> >                    </wsp:Policy>
> >                </sp:Trust10>
> >                <wsaw:UsingAddressing />
> >            </wsp:All>
> >        </wsp:ExactlyOne>
> >    </wsp:Policy>
> >    <wsp:Policy wsu:Id="CustomBinding_IStock_MensajeStock_Input_policy">
> >        <wsp:ExactlyOne>
> >            <wsp:All>
> >                <sp:SignedParts
> >                    xmlns:sp="
> > http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
> >                    <sp:Body />
> >                    <sp:Header Name="To" Namespace="
> > http://www.w3.org/2005/08/addressing" />
> >                    <sp:Header Name="From" Namespace="
> > http://www.w3.org/2005/08/addressing" />
> >                    <sp:Header Name="FaultTo" Namespace="
> > http://www.w3.org/2005/08/addressing" />
> >                    <sp:Header Name="ReplyTo" Namespace="
> > http://www.w3.org/2005/08/addressing" />
> >                    <sp:Header Name="MessageID" Namespace="
> > http://www.w3.org/2005/08/addressing" />
> >                    <sp:Header Name="RelatesTo" Namespace="
> > http://www.w3.org/2005/08/addressing" />
> >                    <sp:Header Name="Action" Namespace="
> > http://www.w3.org/2005/08/addressing" />
> >                </sp:SignedParts>
> >            </wsp:All>
> >        </wsp:ExactlyOne>
> >    </wsp:Policy>
> >    <wsp:Policy wsu:Id="CustomBinding_IStock_MensajeStock_output_policy">
> >        <wsp:ExactlyOne>
> >            <wsp:All>
> >                <sp:SignedParts
> >                    xmlns:sp="
> > http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
> >                    <sp:Body />
> >                    <sp:Header Name="To" Namespace="
> > http://www.w3.org/2005/08/addressing" />
> >                    <sp:Header Name="From" Namespace="
> > http://www.w3.org/2005/08/addressing" />
> >                    <sp:Header Name="FaultTo" Namespace="
> > http://www.w3.org/2005/08/addressing" />
> >                    <sp:Header Name="ReplyTo" Namespace="
> > http://www.w3.org/2005/08/addressing" />
> >                    <sp:Header Name="MessageID" Namespace="
> > http://www.w3.org/2005/08/addressing" />
> >                    <sp:Header Name="RelatesTo" Namespace="
> > http://www.w3.org/2005/08/addressing" />
> >                    <sp:Header Name="Action" Namespace="
> > http://www.w3.org/2005/08/addressing" />
> >                </sp:SignedParts>
> >            </wsp:All>
> >        </wsp:ExactlyOne>
> >    </wsp:Policy>
> >    <wsdl:types>
> >        <xsd:schema targetNamespace="http://tempuri.org/Imports">
> >            <xsd:import
> >                schemaLocation="
> > http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc?xsd=xsd0"
> >                namespace="http://tempuri.org/" />
> >            <xsd:import
> >                schemaLocation="
> > http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc?xsd=xsd1"
> >                namespace="
> > http://schemas.microsoft.com/2003/10/Serialization/" />
> >            <xsd:import
> >                schemaLocation="
> > http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc?xsd=xsd2"
> >                namespace="
> http://schemas.datacontract.org/2004/07/WCF_Stock"
> > />
> >        </xsd:schema>
> >    </wsdl:types>
> >    <wsdl:message name="IStock_MensajeStock_InputMessage">
> >        <wsdl:part name="parameters" element="tns:MensajeStock" />
> >    </wsdl:message>
> >    <wsdl:message name="IStock_MensajeStock_OutputMessage">
> >        <wsdl:part name="parameters" element="tns:MensajeStockResponse" />
> >    </wsdl:message>
> >    <wsdl:portType name="IStock">
> >        <wsdl:operation name="MensajeStock">
> >            <wsdl:input wsaw:Action="
> http://tempuri.org/IStock/MensajeStock"
> >                message="tns:IStock_MensajeStock_InputMessage" />
> >            <wsdl:output wsaw:Action="
> > http://tempuri.org/IStock/MensajeStockResponse"
> >                message="tns:IStock_MensajeStock_OutputMessage" />
> >        </wsdl:operation>
> >    </wsdl:portType>
> >    <wsdl:binding name="CustomBinding_IStock" type="tns:IStock">
> >        <wsp:PolicyReference URI="#CustomBinding_IStock_policy" />
> >        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
> />
> >        <wsdl:operation name="MensajeStock">
> >            <soap12:operation soapAction="
> > http://tempuri.org/IStock/MensajeStock"
> >                style="document" />
> >            <wsdl:input>
> >                <wsp:PolicyReference
> >                    URI="#CustomBinding_IStock_MensajeStock_Input_policy"
> />
> >                <soap12:body use="literal" />
> >            </wsdl:input>
> >            <wsdl:output>
> >                <wsp:PolicyReference
> >                    URI="#CustomBinding_IStock_MensajeStock_output_policy"
> > />
> >                <soap12:body use="literal" />
> >            </wsdl:output>
> >        </wsdl:operation>
> >    </wsdl:binding>
> >    <wsdl:service name="MenStock">
> >        <wsdl:port name="CustomBinding_IStock"
> > binding="tns:CustomBinding_IStock">
> >            <soap12:address location="
> > http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc" />
> >            <wsa10:EndpointReference>
> >                <wsa10:Address>
> > http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc</wsa10:Address>
> >                <Identity xmlns="
> > http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
> >                    <Dns>wss.aduanas.gub.uy</Dns>
> >                </Identity>
> >            </wsa10:EndpointReference>
> >        </wsdl:port>
> >    </wsdl:service>
> > </wsdl:definitions>
> >
> > Any suggestion or link to avoid my error?
> >
> > Thanks!
> >
>

Re: Timestamp/Body - signatureParts

Posted by Colm O hEigeartaigh <co...@apache.org>.
The error is that WSS4J can't find the element to sign (Timestamp).
You could probably fix this by adding a timestamp action to the
WSS4JOutInterceptor configuration:

 <entry key="action" value="Timestamp Signature" />

Colm.

On Mon, Dec 20, 2010 at 12:20 PM, Juan Pablo Pizarro
<ju...@gmail.com> wrote:
> Hello All, I' trying to call a .net web service with spring - cxf
> configuration. I getting the following exception:
>
> General security error (WSEncryptBody/WSSignEnvelope: Element to
> encrypt/sign not found:
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd,
> Timestamp) (the same with Body part).
>
> The error is clear.. but I call the same service with soapUI and it works
> with timestamp and body in the Parts configuration.
>
> Then, I suppose that timestamp and body will be there (signatureParts).
>
> My client-beans.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>    xmlns:jaxws="http://cxf.apache.org/jaxws"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xmlns:p="http://cxf.apache.org/policy"
>    xmlns:cxf="http://cxf.apache.org/core"
>    xmlns:wsa="http://cxf.apache.org/ws/addressing"
>    xmlns:http="http://cxf.apache.org/transports/http/configuration"
>    xsi:schemaLocation="
>    http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
>    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
>    http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
>    http://schemas.xmlsoap.org/ws/2005/02/rm/policy
> http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd
>    http://cxf.apache.org/transports/http/configuration
> http://cxf.apache.org/schemas/configuration/http-conf.xsd
>       ">
>
>    <import resource="classpath:META-INF/cxf/cxf.xml" />
>    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>    <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
>    <import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml"
> />
>    <import resource="classpath:META-INF/cxf/cxf-extension-policy.xml" />
>    <import resource="classpath:META-INF/cxf/cxf-extension-ws-security.xml"
> />
>
>    <cxf:bus>
>        <cxf:features>
>            <p:policies />
>            <cxf:logging />
>            <wsa:addressing />
>        </cxf:features>
>    </cxf:bus>
>
>    <http:conduit name="http://wss.aduanas.gub.uy/.*">
>        <http:client Connection="Keep-Alive"
>        AllowChunking="false"
>        ConnectionTimeout="120000"
>        ReceiveTimeout="120000"
>        ContentType="application/soap+xml;charset=UTF-8"/>
>    </http:conduit>
>
>    <bean id="wsclient" class="org.tempuri.IStock"
> factory-bean="wsFactory"    factory-method="create" />
>
>    <bean id="wsFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>        <property name="serviceClass" value="org.tempuri.IStock" />
>        <property name="address" value="
> http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc" />
>
>        <property name="outInterceptors">
>            <list>
>                <bean
> class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" />
>                <ref bean="wss4jOutInterceptor" />
>            </list>
>        </property>
>    </bean>
>
>    <bean id="wss4jOutInterceptor"
> class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
>        <constructor-arg>
>            <map>
>                <entry key="action" value="Signature" />
>                <entry key="signaturePropFile"
> value="Client_Sign.properties" />
>                <entry key="user"
> value="le-60dca1be-5393-48b3-bbc3-0dfb1ab40d25" />
>                <entry key="passwordType" value="PasswordDigest" />
>                <entry key="mustUnderstand" value="false" />
>                <entry key="signatureKeyIdentifier" value="DirectReference"
> />
>
>                <entry key="passwordCallbackRef">
>                    <ref bean="signaturePwdCallback" />
>                </entry>
>                <entry key="signatureParts"    value="{Element}{
> http://www.w3.org/2005/08/addressing}Action;{Element}{http://www.w3.org/2005/08/addressing}ReplyTo;{Element}{http://www.w3.org/2005/08/addressing}MessageID;{Element}{http://www.w3.org/2005/08/addressing}To;{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;{Content}{http://www.w3.org/2003/05/soap-envelope}Body"
> />
>            </map>
>        </constructor-arg>
>    </bean>
>
>    <bean id="signaturePwdCallback" class="org.jpp.ws.client.ClientCallback"
> />
>
> </beans>
>
> The wsdl:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions name="MenStock" targetNamespace="http://tempuri.org/"
>    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="
> http://schemas.xmlsoap.org/wsdl/soap/"
>    xmlns:wsu="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
> "
>    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsam="
> http://www.w3.org/2007/05/addressing/metadata"
>    xmlns:tns="http://tempuri.org/" xmlns:wsa="
> http://schemas.xmlsoap.org/ws/2004/08/addressing"
>    xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="
> http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
>    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="
> http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
>    xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="
> http://schemas.xmlsoap.org/wsdl/soap12/"
>    xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="
> http://schemas.xmlsoap.org/ws/2004/09/mex">
>    <wsp:Policy wsu:Id="CustomBinding_IStock_policy">
>        <wsp:ExactlyOne>
>            <wsp:All>
>                <sp:AsymmetricBinding
>                    xmlns:sp="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>                    <wsp:Policy>
>                        <sp:InitiatorToken>
>                            <wsp:Policy>
>                                <sp:X509Token
>                                    sp:IncludeToken="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient
> ">
>                                    <wsp:Policy>
>                                        <sp:WssX509V3Token10 />
>                                    </wsp:Policy>
>                                </sp:X509Token>
>                            </wsp:Policy>
>                        </sp:InitiatorToken>
>                        <sp:RecipientToken>
>                            <wsp:Policy>
>                                <sp:X509Token
>                                    sp:IncludeToken="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
>                                    <wsp:Policy>
>                                        <sp:WssX509V3Token10 />
>                                    </wsp:Policy>
>                                </sp:X509Token>
>                            </wsp:Policy>
>                        </sp:RecipientToken>
>                        <sp:AlgorithmSuite>
>                            <wsp:Policy>
>                                <sp:Basic256 />
>                            </wsp:Policy>
>                        </sp:AlgorithmSuite>
>                        <sp:Layout>
>                            <wsp:Policy>
>                                <sp:Lax />
>                            </wsp:Policy>
>                        </sp:Layout>
>                        <sp:IncludeTimestamp />
>                        <sp:OnlySignEntireHeadersAndBody />
>                    </wsp:Policy>
>                </sp:AsymmetricBinding>
>                <sp:Wss10 xmlns:sp="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>                    <wsp:Policy>
>                        <sp:MustSupportRefKeyIdentifier />
>                        <sp:MustSupportRefIssuerSerial />
>                    </wsp:Policy>
>                </sp:Wss10>
>                <sp:Trust10 xmlns:sp="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>                    <wsp:Policy>
>                        <sp:MustSupportIssuedTokens />
>                        <sp:RequireClientEntropy />
>                        <sp:RequireServerEntropy />
>                    </wsp:Policy>
>                </sp:Trust10>
>                <wsaw:UsingAddressing />
>            </wsp:All>
>        </wsp:ExactlyOne>
>    </wsp:Policy>
>    <wsp:Policy wsu:Id="CustomBinding_IStock_MensajeStock_Input_policy">
>        <wsp:ExactlyOne>
>            <wsp:All>
>                <sp:SignedParts
>                    xmlns:sp="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>                    <sp:Body />
>                    <sp:Header Name="To" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="From" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="FaultTo" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="ReplyTo" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="MessageID" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="RelatesTo" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="Action" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                </sp:SignedParts>
>            </wsp:All>
>        </wsp:ExactlyOne>
>    </wsp:Policy>
>    <wsp:Policy wsu:Id="CustomBinding_IStock_MensajeStock_output_policy">
>        <wsp:ExactlyOne>
>            <wsp:All>
>                <sp:SignedParts
>                    xmlns:sp="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>                    <sp:Body />
>                    <sp:Header Name="To" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="From" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="FaultTo" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="ReplyTo" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="MessageID" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="RelatesTo" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                    <sp:Header Name="Action" Namespace="
> http://www.w3.org/2005/08/addressing" />
>                </sp:SignedParts>
>            </wsp:All>
>        </wsp:ExactlyOne>
>    </wsp:Policy>
>    <wsdl:types>
>        <xsd:schema targetNamespace="http://tempuri.org/Imports">
>            <xsd:import
>                schemaLocation="
> http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc?xsd=xsd0"
>                namespace="http://tempuri.org/" />
>            <xsd:import
>                schemaLocation="
> http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc?xsd=xsd1"
>                namespace="
> http://schemas.microsoft.com/2003/10/Serialization/" />
>            <xsd:import
>                schemaLocation="
> http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc?xsd=xsd2"
>                namespace="http://schemas.datacontract.org/2004/07/WCF_Stock"
> />
>        </xsd:schema>
>    </wsdl:types>
>    <wsdl:message name="IStock_MensajeStock_InputMessage">
>        <wsdl:part name="parameters" element="tns:MensajeStock" />
>    </wsdl:message>
>    <wsdl:message name="IStock_MensajeStock_OutputMessage">
>        <wsdl:part name="parameters" element="tns:MensajeStockResponse" />
>    </wsdl:message>
>    <wsdl:portType name="IStock">
>        <wsdl:operation name="MensajeStock">
>            <wsdl:input wsaw:Action="http://tempuri.org/IStock/MensajeStock"
>                message="tns:IStock_MensajeStock_InputMessage" />
>            <wsdl:output wsaw:Action="
> http://tempuri.org/IStock/MensajeStockResponse"
>                message="tns:IStock_MensajeStock_OutputMessage" />
>        </wsdl:operation>
>    </wsdl:portType>
>    <wsdl:binding name="CustomBinding_IStock" type="tns:IStock">
>        <wsp:PolicyReference URI="#CustomBinding_IStock_policy" />
>        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
>        <wsdl:operation name="MensajeStock">
>            <soap12:operation soapAction="
> http://tempuri.org/IStock/MensajeStock"
>                style="document" />
>            <wsdl:input>
>                <wsp:PolicyReference
>                    URI="#CustomBinding_IStock_MensajeStock_Input_policy" />
>                <soap12:body use="literal" />
>            </wsdl:input>
>            <wsdl:output>
>                <wsp:PolicyReference
>                    URI="#CustomBinding_IStock_MensajeStock_output_policy"
> />
>                <soap12:body use="literal" />
>            </wsdl:output>
>        </wsdl:operation>
>    </wsdl:binding>
>    <wsdl:service name="MenStock">
>        <wsdl:port name="CustomBinding_IStock"
> binding="tns:CustomBinding_IStock">
>            <soap12:address location="
> http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc" />
>            <wsa10:EndpointReference>
>                <wsa10:Address>
> http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc</wsa10:Address>
>                <Identity xmlns="
> http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
>                    <Dns>wss.aduanas.gub.uy</Dns>
>                </Identity>
>            </wsa10:EndpointReference>
>        </wsdl:port>
>    </wsdl:service>
> </wsdl:definitions>
>
> Any suggestion or link to avoid my error?
>
> Thanks!
>