Help in uderstand how solve "ERROR: Policy for the service could not be obtained"

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Help in uderstand how solve "ERROR: Policy for the service could not be obtained"

carlog
Hi, I'm trying to develop a client for a web service that uses https secure connection and a certificate.

The policy configuration that I have in the client is this:

<wsp:Policy wsu:Id="MedicoDiBasePortBindingPolicy">
                <wsp:ExactlyOne>
                        <wsp:All>
                                <sc:KeyStore wspp:visibility="private" alias="cle"
                                        storepass="changeit" type="JKS"
                                        location="C:\keystore_cle.jks" />
                                <sc:TrustStore wspp:visibility="private" storepass="changeit"
                                        type="JKS"
                                        location="C:\keystore_cle.jks" />
                        </wsp:All>
                </wsp:ExactlyOne>
        </wsp:Policy>

instead in the WSDL of the server part is this:

<wsp1_2:Policy wsu:Id="NsisrPortBindingPolicy">
        <sp:AsymmetricBinding>
                <wsp1_2:Policy>
                        <sp:AlgorithmSuite>
                                <wsp1_2:Policy>
                                        <sp:Basic128 />
                                </wsp1_2:Policy>
                        </sp:AlgorithmSuite>
                        <sp:IncludeTimestamp />
                        <sp:InitiatorToken>
                                <wsp1_2:Policy>
                                        <sp:X509Token
                                                sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
                                                <wsp1_2:Policy>
                                                        <sp:WssX509V3Token10 />
                                                </wsp1_2:Policy>
                                        </sp:X509Token>
                                </wsp1_2:Policy>
                        </sp:InitiatorToken>
                        <sp:Layout>
                                <wsp1_2:Policy>
                                        <sp:Lax />
                                </wsp1_2:Policy>
                        </sp:Layout>
                        <sp:RecipientToken>
                                <wsp1_2:Policy>
                                        <sp:X509Token
                                                sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
                                                <wsp1_2:Policy>
                                                        <sp:WssX509V3Token10 />
                                                </wsp1_2:Policy>
                                        </sp:X509Token>
                                </wsp1_2:Policy>
                        </sp:RecipientToken>
                </wsp1_2:Policy>
        </sp:AsymmetricBinding>
        <sp:SignedParts>
                <sp:Body />
                <sp:Header Namespace="http://www.w3.org/2005/08/addressing"
                        Name="To" />
                <sp:Header Namespace="http://www.nsisr.puglia.it/Schemas/"
                        Name="attributiAutorizzativi" />
                <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
                <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
                <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
                <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
        </sp:SignedParts>
        <sp:Wss10>
                <wsp1_2:Policy>
                        <sp:MustSupportRefIssuerSerial />
                        <sp:MustSupportRefKeyIdentifier />
                </wsp1_2:Policy>
        </sp:Wss10>
        <wsapw3c:UsingAddressing />
</wsp1_2:Policy>


but when I'm trying to invoke the service from the client in the stack trace I have :

GRAVE: Policy is null
22-feb-2013 9.50.22 com.sun.xml.wss.jaxws.impl.SecurityClientTube processClientResponsePacket
GRAVE: WSSTUBE0025: Error in Verifying Security in the Inbound Message.
com.sun.xml.wss.impl.PolicyViolationException: ERROR: Policy for the service could not be obtained
..
Exception in thread "main" javax.xml.ws.WebServiceException: WSSTUBE0025: Error in Verifying Security in the Inbound Message.


Someone can help me in order to understand how solve this problem?
Thanks in advance!

Reply | Threaded
Open this post in threaded view
|

Re: Help in uderstand how solve "ERROR: Policy for the service could not be obtained"

kumarjayanti
can u send a small  reproducible test case (server and client) that does not have all your code. I can then take a look.
On Feb 22, 2013, at 2:51 PM, carlog <[hidden email]> wrote:

> Hi, I'm trying to develop a client for a web service that uses https secure
> connection and a certificate.
>
> The policy configuration that I have in the client is this:
>
> <wsp:Policy wsu:Id="MedicoDiBasePortBindingPolicy">
> <wsp:ExactlyOne>
> <wsp:All>
> <sc:KeyStore wspp:visibility="private" alias="cle"
> storepass="changeit" type="JKS"
> location="C:\keystore_cle.jks" />
> <sc:TrustStore wspp:visibility="private" storepass="changeit"
> type="JKS"
> location="C:\keystore_cle.jks" />
> </wsp:All>
> </wsp:ExactlyOne>
> </wsp:Policy>
>
> instead in the WSDL of the server part is this:
>
> <wsp1_2:Policy wsu:Id="NsisrPortBindingPolicy">
> <sp:AsymmetricBinding>
> <wsp1_2:Policy>
> <sp:AlgorithmSuite>
> <wsp1_2:Policy>
> <sp:Basic128 />
> </wsp1_2:Policy>
> </sp:AlgorithmSuite>
> <sp:IncludeTimestamp />
> <sp:InitiatorToken>
> <wsp1_2:Policy>
> <sp:X509Token
>
> sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
> <wsp1_2:Policy>
> <sp:WssX509V3Token10 />
> </wsp1_2:Policy>
> </sp:X509Token>
> </wsp1_2:Policy>
> </sp:InitiatorToken>
> <sp:Layout>
> <wsp1_2:Policy>
> <sp:Lax />
> </wsp1_2:Policy>
> </sp:Layout>
> <sp:RecipientToken>
> <wsp1_2:Policy>
> <sp:X509Token
>
> sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
> <wsp1_2:Policy>
> <sp:WssX509V3Token10 />
> </wsp1_2:Policy>
> </sp:X509Token>
> </wsp1_2:Policy>
> </sp:RecipientToken>
> </wsp1_2:Policy>
> </sp:AsymmetricBinding>
> <sp:SignedParts>
> <sp:Body />
> <sp:Header Namespace="http://www.w3.org/2005/08/addressing"
> Name="To" />
> <sp:Header Namespace="http://www.nsisr.puglia.it/Schemas/"
> Name="attributiAutorizzativi" />
> <sp:Header Name="MessageID"
> Namespace="http://www.w3.org/2005/08/addressing" />
> <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing"
> />
> <sp:Header Name="RelatesTo"
> Namespace="http://www.w3.org/2005/08/addressing" />
> <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing"
> />
> </sp:SignedParts>
> <sp:Wss10>
> <wsp1_2:Policy>
> <sp:MustSupportRefIssuerSerial />
> <sp:MustSupportRefKeyIdentifier />
> </wsp1_2:Policy>
> </sp:Wss10>
> <wsapw3c:UsingAddressing />
> </wsp1_2:Policy>
>
>
> but when I'm trying to invoke the service from the client in the stack trace
> I have :
>
> GRAVE: Policy is null
> 22-feb-2013 9.50.22 com.sun.xml.wss.jaxws.impl.SecurityClientTube
> processClientResponsePacket
> GRAVE: WSSTUBE0025: Error in Verifying Security in the Inbound Message.
> com.sun.xml.wss.impl.PolicyViolationException: ERROR: Policy for the service
> could not be obtained
> ..
> Exception in thread "main" javax.xml.ws.WebServiceException: WSSTUBE0025:
> Error in Verifying Security in the Inbound Message.
>
>
> Someone can help me in order to understand how solve this problem?
> Thanks in advance!
>
>
>
>
>
> --
> View this message in context: http://metro.1045641.n5.nabble.com/Help-in-uderstand-how-solve-ERROR-Policy-for-the-service-could-not-be-obtained-tp5710166.html
> Sent from the Metro - Users mailing list archive at Nabble.com.