eclipse-ee4j / metro-wsit

metro-wsit
https://eclipse-ee4j.github.io/metro-wsit/
BSD 3-Clause "New" or "Revised" License
6 stars 22 forks source link

throw new PolicyViolationException("ERROR: No security header found in the message"); #459

Open 9611667063 opened 3 months ago

9611667063 commented 3 months ago

Hello @glassfishrobot @Tomas-Kraus I am facing below issue throw new PolicyViolationException("ERROR: No security header found in the message"); below is my wsdl <?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsc="http://localhost:8000/ibis/ws/1698157283592/Webservice111" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" targetNamespace="http://localhost:8000/ibis/ws/1698157283592/Webservice111">

<!-- Types section -->
<types>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
               elementFormDefault="qualified"
               targetNamespace="http://localhost:8000/ibis/ws/1698157283592/Webservice111">
        <xs:element name="sayHello" type="xs:string"/>
        <xs:element name="sayHelloResponse" type="xs:string"/>
    </xs:schema>
</types>

<!-- Messages -->
<message name="Header">
    <part name="messageAddressing" element="wsc:MessageAddressing"/>
</message>
<message name="sayHelloRequest">
    <part name="parameters" element="wsc:sayHello"/>
</message>
<message name="sayHelloResponse">
    <part name="parameters" element="wsc:sayHelloResponse"/>
</message>

<!-- PortType -->
<portType name="WebservicePortType">
    <operation name="sayHello">
        <input message="wsc:sayHelloRequest"/>
        <output message="wsc:sayHelloResponse"/>
    </operation>
</portType>

<!-- Binding -->
<binding name="WebserviceBinding" type="wsc:WebservicePortType">
    <wsp:PolicyReference URI="#WebserviceBindingPolicy"/>
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="sayHello">
        <soap:operation soapAction="sayHello"/>
        <input>
            <soap:header message="wsc:Header" part="messageAddressing" use="literal"/>
            <wsp:PolicyReference URI="#SigningSecurityPolicy"/>
            <soap:body use="literal"/>
        </input>
        <output>
            <wsp:PolicyReference URI="#EmptySecurityPolicy"/>
            <soap:body use="literal"/>
        </output>
    </operation>
</binding>

<!-- Service -->
<service name="Webservice">
    <port name="WebservicePort" binding="wsc:WebserviceBinding">
        <soap:address location="http://localhost:8000/ibis/ws/Webservice"/>
    </port>
</service>

<!-- Policies -->
<wsp:Policy wsu:Id="WebserviceBindingPolicy">
    <wsp:ExactlyOne>
        <wsp:All>
            <wsam:Addressing wsp:Optional="false"/>
            <sp:AsymmetricBinding>
                <wsp:Policy>
                    <sp:InitiatorToken>
                        <wsp:Policy>
                            <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never">
                                <wsp:Policy>
                                    <sp:WssX509V3Token10/>
                                    <sp:RequireThumbprintReference/>
                                </wsp:Policy>
                            </sp:X509Token>
                        </wsp:Policy>
                    </sp:InitiatorToken>
                    <sp:RecipientToken>
                        <wsp:Policy>
                            <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient">
                                <wsp:Policy>
                                    <sp:WssX509V3Token10/>
                                </wsp:Policy>
                            </sp:X509Token>
                        </wsp:Policy>
                    </sp:RecipientToken>
                      <sp:AlgorithmSuite signatureAlgorithm="SHA256withRSA">
                <wsp:Policy>
                    <sp:Basic256Sha256/>
                </wsp:Policy>
            </sp:AlgorithmSuite>
                    <sp:Layout>
                        <wsp:Policy>
                            <sp:Strict/>
                        </wsp:Policy>
                    </sp:Layout>
                    <sp:IncludeTimestamp/>
                    <sp:OnlySignEntireHeadersAndBody/>
                </wsp:Policy>
            </sp:AsymmetricBinding>
            <sp:Wss11>
                <wsp:Policy>
                    <sp:MustSupportRefIssuerSerial/>
                    <sp:MustSupportRefThumbprint/>
                    <sp:MustSupportRefEncryptedKey/>
                </wsp:Policy>
            </sp:Wss11>
            <sp:Trust13>
                <wsp:Policy>
                    <sp:MustSupportIssuedTokens/>
                    <sp:RequireClientEntropy/>
                    <sp:RequireServerEntropy/>
                </wsp:Policy>
            </sp:Trust13>
        </wsp:All>
    </wsp:ExactlyOne>
</wsp:Policy>

<wsp:Policy wsu:Id="SigningSecurityPolicy">
    <sp:SignedParts>
        <sp:Body/>
    </sp:SignedParts>
</wsp:Policy>

<wsp:Policy wsu:Id="EmptySecurityPolicy">
    <sp:EncryptedParts>
        <sp:Body/>
    </sp:EncryptedParts>
</wsp:Policy>