12 Replies Latest reply on Jan 24, 2013 11:24 AM by Chris Walters

    Problem with policy reference in AS 6

    Daniel Köbbing Newbie

      We're currently using a webservice client with apache-cxf-2.2.9 on AS 5.1.

      apache-cxf is bundled in lib directory of an ear.

       

      Now we want to migrate to AS6 (or at least jboss-cxf-3.4.0 on AS 5.1).

      But trying to run our bean on AS6 we get the following exception:

      javax.xml.ws.soap.SOAPFaultException: #BN_ZS_MM_GET_OPEN_PO can't be resolved.

       

       

      The corresponding wsdl file is as follows (I skip some of the type definitions), it validates ok with wsdlvalidate:

       

      <?xml version="1.0" encoding="utf-8"?>
      <wsdl:definitions targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="urn:sap-com:document:sap:soap:functions:mc-style" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:n1="urn:sap-com:document:sap:rfc:functions">
          <wsdl:documentation>
              <sidl:sidl xmlns:sidl="http://www.sap.com/2007/03/sidl"/>
          </wsdl:documentation>
          <wsp:UsingPolicy wsdl:required="true"/>
          <wsp:Policy wsu:Id="BN_ZS_MM_GET_OPEN_PO">
              <wsaw:UsingAddressing xmlns:wsaw="http://schemas.xmlsoap.org/ws/2004/08/addressing"/><saptrnbnd:OptimizedXMLTransfer uri="http://xml.sap.com/2006/11/esi/esp/binxml" xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/" wsp:Optional="true"/>
              <sapattahnd:Enabled xmlns:sapattahnd="http://www.sap.com/710/features/attachment/">false</sapattahnd:Enabled>
              <wsp:ExactlyOne xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sapsp="http://www.sap.com/webas/630/soap/features/security/policy" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility">
                  <wsp:All>
                      <sp:TransportBinding>
                          <wsp:Policy>
                              <sp:TransportToken>
                                  <wsp:Policy>
                                      <sp:HttpsToken>
                                          <wsp:Policy>
                                              <sp:HttpBasicAuthentication/>
                                          </wsp:Policy>
                                      </sp:HttpsToken>
                                  </wsp:Policy>
                              </sp:TransportToken>
                              <sp:AlgorithmSuite>
                                  <wsp:Policy>
                                      <sp:TripleDesRsa15/>
                                  </wsp:Policy>
                              </sp:AlgorithmSuite>
                              <sp:Layout>
                                  <wsp:Policy>
                                      <sp:Strict/>
                                  </wsp:Policy>
                              </sp:Layout>
                          </wsp:Policy>
                      </sp:TransportBinding>
                  </wsp:All>
              </wsp:ExactlyOne>
          </wsp:Policy>
          <wsp:Policy wsu:Id="IF_ZS_MM_GET_OPEN_PO">
              <sapsession:Session xmlns:sapsession="http://www.sap.com/webas/630/soap/features/session/">
                  <sapsession:enableSession>false</sapsession:enableSession>
              </sapsession:Session>
              <sapcentraladmin:CentralAdministration xmlns:sapcentraladmin="http://www.sap.com/webas/700/soap/features/CentralAdministration/" wsp:Optional="true">
                  <sapcentraladmin:BusinessApplicationID>4718D64C1DBC5D29E1000000AC140016</sapcentraladmin:BusinessApplicationID>
              </sapcentraladmin:CentralAdministration>
          </wsp:Policy>
          <wsp:Policy wsu:Id="OP_ZMmGetOpenPo">
              <sapcomhnd:enableCommit xmlns:sapcomhnd="http://www.sap.com/NW05/soap/features/commit/">false</sapcomhnd:enableCommit><sapblock:enableBlocking xmlns:sapblock="http://www.sap.com/NW05/soap/features/blocking/">true</sapblock:enableBlocking><saptrhnw05:required xmlns:saptrhnw05="http://www.sap.com/NW05/soap/features/transaction/">no</saptrhnw05:required><saprmnw05:enableWSRM xmlns:saprmnw05="http://www.sap.com/NW05/soap/features/wsrm/">false</saprmnw05:enableWSRM>
          </wsp:Policy>
          <wsdl:types>
              <xsd:schema attributeFormDefault="qualified" targetNamespace="urn:sap-com:document:sap:rfc:functions">
                  <xsd:simpleType name="char1">
                      <xsd:restriction base="xsd:string">
                          <xsd:maxLength value="1"/>
                      </xsd:restriction>
                  </xsd:simpleType>
      
                    <!-- some more of this stuff -->
      
                    <xsd:simpleType name="date">
                      <xsd:restriction base="xsd:string">
                          <xsd:maxLength value="10"/><xsd:pattern value="\d\d\d\d-\d\d-\d\d"/>
                      </xsd:restriction>
                  </xsd:simpleType>
              </xsd:schema>
              <xsd:schema attributeFormDefault="qualified" targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style" xmlns:n0="urn:sap-com:document:sap:rfc:functions">
                  <xsd:import namespace="urn:sap-com:document:sap:rfc:functions"/>
                  <xsd:complexType name="ZmmEkgrp">
                      <xsd:sequence>
                          <xsd:element name="Ekgrp" type="n0:char3"/><xsd:element name="Eknam" type="n0:char18"/>
                          <xsd:element name="Ektel" type="n0:char12"/>
                          <xsd:element name="Telfx" type="n0:char31"/>
                      </xsd:sequence>
                  </xsd:complexType>
                  <xsd:complexType name="ZmmEkusr">
                      <xsd:sequence>
                          <xsd:element name="Bname" type="n0:char12"/><xsd:element name="NameText" type="n0:char80"/>
                          <xsd:element name="TelNumber" type="n0:char30"/>
                          <xsd:element name="TelExtens" type="n0:char10"/>
                      </xsd:sequence>
                  </xsd:complexType>
                  <xsd:complexType name="ZmmPodata">
                      <xsd:sequence>
                          <xsd:element name="Lifnr" type="n0:char10"/><xsd:element name="Name1" type="n0:char35"/>
                          <xsd:element name="Name2" type="n0:char35"/>
                              <!-- etc. -->
                          <xsd:element name="THead" type="tns:ZmmPoheadT"/>
                      </xsd:sequence>
                  </xsd:complexType>
                  <xsd:complexType name="ZmmPohead">
                      <xsd:sequence>
                          <xsd:element name="Ebeln" type="n0:char10"/><xsd:element name="Bstyp" type="n0:char1"/>
                          <xsd:element name="Bsart" type="n0:char4"/>
                              <!-- etc. -->
                          <xsd:element name="TItem" type="tns:ZmmPoitemT"/>
                      </xsd:sequence>
                  </xsd:complexType>
                  <xsd:complexType name="ZmmPoitem">
                      <xsd:sequence>
                          <xsd:element name="Ebelp" type="n0:numeric5"/><xsd:element name="Bukrs" type="n0:char4"/>
                          <xsd:element name="Matnr" type="n0:char18"/>
                              <!-- etc. -->
                          <xsd:element name="Lmein" type="n0:unit3"/>
                      </xsd:sequence>
                  </xsd:complexType>
                  <xsd:complexType name="ZmmEkgrpT">
                      <xsd:sequence>
                          <xsd:element name="item" type="tns:ZmmEkgrp" minOccurs="0" maxOccurs="unbounded"/>
                      </xsd:sequence>
                  </xsd:complexType>
                  <xsd:complexType name="ZmmEkusrT">
                      <xsd:sequence>
                          <xsd:element name="item" type="tns:ZmmEkusr" minOccurs="0" maxOccurs="unbounded"/>
                      </xsd:sequence>
                  </xsd:complexType>
                  <xsd:complexType name="ZmmPodataT">
                      <xsd:sequence>
                          <xsd:element name="item" type="tns:ZmmPodata" minOccurs="0" maxOccurs="unbounded"/>
                      </xsd:sequence>
                  </xsd:complexType>
                  <xsd:complexType name="ZmmPoheadT">
                      <xsd:sequence>
                          <xsd:element name="item" type="tns:ZmmPohead" minOccurs="0" maxOccurs="unbounded"/>
                      </xsd:sequence>
                  </xsd:complexType>
                  <xsd:complexType name="ZmmPoitemT">
                      <xsd:sequence>
                          <xsd:element name="item" type="tns:ZmmPoitem" minOccurs="0" maxOccurs="unbounded"/>
                      </xsd:sequence>
                  </xsd:complexType>
                  <xsd:element name="ZMmGetOpenPo">
                      <xsd:complexType>
                          <xsd:sequence>
                              <xsd:element name="IEbeln" type="n0:char10" minOccurs="0"/><xsd:element name="ILiefertagB" type="n0:date" minOccurs="0"/>
                              <xsd:element name="ILiefertagV" type="n0:date" minOccurs="0"/>
                              <xsd:element name="ILifnr" type="n0:char10" minOccurs="0"/>
                              <xsd:element name="IName" type="n0:char35" minOccurs="0"/>
                              <xsd:element name="IWerks" type="n0:char4" minOccurs="0"/>
                          </xsd:sequence>
                      </xsd:complexType>
                  </xsd:element>
                  <xsd:element name="ZMmGetOpenPoResponse">
                      <xsd:complexType>
                          <xsd:sequence>
                              <xsd:element name="EtEkgrp" type="tns:ZmmEkgrpT"/><xsd:element name="EtEkusr" type="tns:ZmmEkusrT"/>
                              <xsd:element name="EtPodata" type="tns:ZmmPodataT"/>
                          </xsd:sequence>
                      </xsd:complexType>
                  </xsd:element>
              </xsd:schema>
          </wsdl:types>
          <wsdl:message name="ZMmGetOpenPo">
              <wsdl:part name="parameters" element="tns:ZMmGetOpenPo"/>
          </wsdl:message>
          <wsdl:message name="ZMmGetOpenPoResponse">
              <wsdl:part name="parameter" element="tns:ZMmGetOpenPoResponse"/>
          </wsdl:message>
          <wsdl:portType name="ZS_MM_GET_OPEN_PO">
              <wsp:Policy>
                  <wsp:PolicyReference URI="#IF_ZS_MM_GET_OPEN_PO"/>
              </wsp:Policy>
              <wsdl:operation name="ZMmGetOpenPo">
                  <wsp:Policy>
                      <wsp:PolicyReference URI="#OP_ZMmGetOpenPo"/>
                  </wsp:Policy>
                  <wsdl:input message="tns:ZMmGetOpenPo"/>
                  <wsdl:output message="tns:ZMmGetOpenPoResponse"/>
              </wsdl:operation>
          </wsdl:portType>
          <wsdl:binding name="ZS_MM_GET_OPEN_PO" type="tns:ZS_MM_GET_OPEN_PO">
              <wsp:Policy>
                  <wsp:PolicyReference URI="#BN_ZS_MM_GET_OPEN_PO"/>
              </wsp:Policy>
              <wsa:EndpointReference xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
                  <wsa:Address/><wsa:ReferenceParameters/>
              </wsa:EndpointReference>
              <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
              <wsdl:operation name="ZMmGetOpenPo">
                  <soap:operation soapAction="" style="document"/>
                  <wsdl:input>
                      <soap:body use="literal"/>
                  </wsdl:input>
                  <wsdl:output>
                      <soap:body use="literal"/>
                  </wsdl:output>
              </wsdl:operation>
          </wsdl:binding>
          <wsdl:service name="ZS_MM_GET_OPEN_PO">
              <wsdl:port name="ZS_MM_GET_OPEN_PO" binding="tns:ZS_MM_GET_OPEN_PO">
                  <soap:address location="http://SAPEntw.test.de:8000/sap/bc/srt/rfc/sap/zs_mm_get_open_po/222/zs_mm_get_open_po/zs_mm_get_open_po"/>
              </wsdl:port>
          </wsdl:service>
      </wsdl:definitions>
      
      

       

      I'm sure I missed something important, but at the moment I'm not able to use the service with cxf.

      Using wsconsume.sh and wsrunclient.sh doesn't help, too - same result. So it doesn't seem to be AS related.

      Using apache-cxf-2.2.9 on jboss AS 5.1 it works like a charm.

       

      Thanks in advance,

      Daniel

        • 2. Problem with policy reference in AS 6
          Daniel Köbbing Newbie

          Thank you for your answer. I already corrected my question regarding AS 5.1 (I had a look at the matrix).

          But the problem itself still persists: The reference to the policy can't be resolved. Is it possible that it is related to the change to jaxws-2.2?

          I have to admit, I'm not a web service specialist (it's easier for me to have a look at jboss or hibernate sources).

           

          Daniel

          • 3. Problem with policy reference in AS 6
            Alessio Soldano Master

            Hi,

            can you please provide the full stacktrace of the exception you get and share some details on your deployment? Those might help to understand where the problem might be.

            • 4. Re: Problem with policy reference in AS 6
              Daniel Köbbing Newbie

              Hello,

               

              I attached the source, the wsdl and the log file...

               

              Daniel

              • 5. Re: Problem with policy reference in AS 6
                Alessio Soldano Master

                OK, I've reproduced your issue. I think the problem is that you're not declaring your policy references correctly. As per http://www.w3.org/TR/2007/REC-ws-policy-attach-20070904/ the wsp:PolicyReference should be used as a direct child of wsdl:binding, wsdl:portType, etc.

                So for instance

                    <wsdl:portType name="ZS_MM_GET_OPEN_PO">
                        <wsp:PolicyReference URI="#IF_ZS_MM_GET_OPEN_PO"/>
                        <wsdl:operation name="ZMmGetOpenPo">
                            <wsp:PolicyReference URI="#OP_ZMmGetOpenPo"/>
                            <wsdl:input message="tns:ZMmGetOpenPo"/>
                            <wsdl:output message="tns:ZMmGetOpenPoResponse"/>
                        </wsdl:operation>
                    </wsdl:portType>
                

                 

                instead of

                    <wsdl:portType name="ZS_MM_GET_OPEN_PO">
                        <wsp:Policy>
                            <wsp:PolicyReference URI="#IF_ZS_MM_GET_OPEN_PO"/>
                        </wsp:Policy>
                        <wsdl:operation name="ZMmGetOpenPo">
                            <wsp:Policy>
                                <wsp:PolicyReference URI="#OP_ZMmGetOpenPo"/>
                            </wsp:Policy>
                            <wsdl:input message="tns:ZMmGetOpenPo"/>
                            <wsdl:output message="tns:ZMmGetOpenPoResponse"/>
                        </wsdl:operation>
                    </wsdl:portType>
                

                 

                Doing the changes above I get beyond the exception mentioned above (I get another error saying that no policy alternative can be supported, but I assume that's something you'll deal with, I didn't investigate what those policies are actually about)

                The reason why the validator was probably not finding the problem above is that PolicyReference inside Policy is actually allowed if you're defining a new policy.

                • 6. Re: Problem with policy reference in AS 6
                  Daniel Köbbing Newbie

                  Thank you very much for your analysis. I'll try to change the wsdl accordingly (altough it's generated by SAP).

                  Interesting though is the fact, that using apache-cxf 2.2.12 works out of the box. The jboss-native stack (AS 5.1.0.GA) seems to work, too. And the current version of jboss-cxf from subversion (based on apache-cxf 2.3.2) also has a different behaviour.

                  • 7. Re: Problem with policy reference in AS 6
                    Alessio Soldano Master

                    The different behaviour seems to be related to the Apache Neethi lib being pulled in. Btw, the tries I mentioned above have been done with the current jbossws-cxf trunk (hence using jbossws-cxf 2.3.2).

                    Please follow-up if you have any more findings on this. Thanks.

                    • 8. Re: Problem with policy reference in AS 6
                      Daniel Köbbing Newbie

                      Your trust in my abilities is really kind but unfortunately I wasn't able to deal with the new issue you mentioned. I looked it up in google but without success. There are some warnings followed by an exception:

                       

                      [org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl] No assertion builder for type {http://schemas.xmlsoap.org/ws/2004/08/addressing}UsingAddressing registered.

                      11:18:20,268 WARN  [org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl] No assertion builder for type {http://www.sap.com/webas/710/soap/features/transportbinding/}OptimizedXMLTransfer registered.

                      11:18:20,268 WARN  [org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl] No assertion builder for type {http://www.sap.com/710/features/attachment/}Enabled registered.

                      11:18:20,268 WARN  [org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl] No assertion builder for type {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}TransportBinding registered.

                      11:18:20,269 WARN  [org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl] No assertion builder for type {http://www.sap.com/webas/630/soap/features/session/}Session registered.

                      11:18:20,269 WARN  [org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl] No assertion builder for type {http://www.sap.com/webas/700/soap/features/CentralAdministration/}CentralAdministration registered.

                      ....

                      Caused by: org.apache.cxf.ws.policy.PolicyException: None of the policy alternatives can be satisfied

                       

                      As I mentioned before there's no such issue using plain cxf-2.3.2. I assume it has something to do with the configuration of the cxf-stack.

                      Perhaps the META-INF/jbossws-cxf.xml in jbossws-cxf-client.jar should be altered?

                      • 9. Problem with policy reference in AS 6
                        daniel_spasojevic Newbie

                        I see the same problems with jbossws-cxf-3.4.0 on AS 5.1.

                         

                        2011-03-22 09:15:01,612 WARN  [org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl] (Timer-5) No assertion builder for type {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}TransportBinding registered.

                        2011-03-22 09:15:01,622 WARN  [org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl] (Timer-5) No assertion builder for type {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}SupportingTokens registered.

                        ...

                        Caused by: org.apache.cxf.ws.policy.PolicyException: None of the policy alternatives can be satisfied

                         

                        I installed using the deploy-jboss510 target. ant tests ran with one failure: ProjectGeneratorTestCase+testGenerator : org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.

                         

                        Are there any other steps required to support these assertions?

                        • 10. Re: Problem with policy reference in AS 6
                          Kevin Zuehlke Newbie

                          I am also getting the same problem with 3.4.1 on AS 6.0.0.Final. This currently runs fine on 4.0.5 AS.

                           

                          14:46:48,018 WARN  [org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl] No assertion builder for type {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}TransportBinding registere

                          d.

                          14:46:48,072 ERROR [stark] None of the policy alternatives can be satisfied.: javax.xml.ws.soap.SOAPFaultException: None of the policy alternatives can be satisfied.

                           

                          Is there something to configure with  the cxf-stack?

                          • 11. Re: Problem with policy reference in AS 6
                            Alessio Soldano Master

                            The WARN mentioned in the messages above basically means that the Apache CXF policy engine could not understand one or more assertions in the actual policy; one or more AssertionBuilder instances need to be registered in the AssertionBuilderRegistry in the bus. This is performed automatically when building the bus. When spring is installed on the application server, this is driven by the cxf-extension-*.xml beans declaration, for instance the wsse stuff is created by the org.apache.cxf.ws.security.policy.WSSecurityPolicyLoader. When spring is not installed, instead, the jbossws-cxf customized bus factory creates an assertion builder registry with the minimal required assertion builder (basically for mtom, addressing and rm), while the vanilla non-spring version of apache cxf 2.3.x does not automatically start any policy related facilities afaik.

                            So some suggestions are:

                            - check the policy assertions mentioned in the WARN messages are actually supposed to be supported by the registered (either manually or automatically) assertion builders in the bus; beware of namespaces, etc.

                            - make sure you don't have cxf jars in your own deployment, unless you really know what you're doing (they can affect which assertion builder is loaded in your bus)

                            - install spring on the application server if you want to use ws-security policy (see the jbossws-cxf documentation)

                            • 12. Re: Problem with policy reference in AS 6
                              Chris Walters Newbie

                              Can someone explain how you were able to resolve this problem ? I am encountering this exact same problem. Thanks.

                               

                              - CW