RE: WS-Policy issues when upgrading from Axis2 1.6.0 to Axis2 1.6.2

Martin Gainty <[email protected]>
Newsgroups gmane.text.xml.axis.user
Message-ID <[email protected]>
if the imported documents conform to wsdl-1.1 spec ..here is the code
public static AxisService createClientSideAxisService(URL wsdlURL,
			QName wsdlServiceName, String portName, Options options)
			throws AxisFault {
		try {
			InputStream in = wsdlURL.openConnection().getInputStream();
			Document doc = XMLUtils.newDocument(in);
			WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
			reader.setFeature("javax.wsdl.importDocuments", true);
			Definition wsdlDefinition = reader.readWSDL(getBaseURI(wsdlURL
					.toString()), doc);
			if (wsdlDefinition != null) {
				wsdlDefinition.setDocumentBaseURI(getDocumentURI(wsdlURL
						.toString()));
			}
			return createClientSideAxisService(wsdlDefinition, wsdlServiceName,
					portName, options);






Name
Description
Default Value


javax.wsdl.verbose
If set to true, status messages will be displayed.

true


javax.wsdl.importDocuments
If set to true, imported WSDL documents will be retrieved and processed.

true
All feature names must be fully-qualified, Java package style. All names starting with javax.wsdl. are reserved for features defined by the JWSDL specification. It is recommended that implementation- specific features be fully-qualified to match the package name of that implementation. For example: com.abc.featureName 
 
 
put your complete testcase into JIRA and we'll take a look

Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

 
Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.

  




From: [email protected]
To: [email protected]
Subject: WS-Policy issues when upgrading from Axis2 1.6.0 to Axis2 1.6.2
Date: Mon, 25 Feb 2013 22:54:57 +0000





Hello,
 
I am running into WS Policy parsing issues when upgrading Axis2 from 1.6.0 to 1.6.2. The policies that successfully load (via WSDL11ToAxisServiceBuilder.processPoliciesInDefintion) in version 1.6.0 do not work when I go to 1.6.2. I do notice that in 1.6.2, Axis now uses PolicyBuilder (Neethi) which was not the case in 1.6.0. Is there any change with respect to policy parsing that I should  be aware of? I would appreciate any help.
 
Here is the stack trace:
 
Caused by: java.lang.NullPointerException
        at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.getEventType(XMLStreamReaderWrapper.java:108)
        at org.apache.axiom.util.stax.dialect.BEAStreamReaderWrapper.getEncoding(BEAStreamReaderWrapper.java:90)
        at org.apache.axiom.om.impl.builder.StAXBuilder.<init>(StAXBuilder.java:125)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.<init>(StAXOMBuilder.java:104)
        at org.apache.axiom.om.impl.llom.factory.AbstractOMMetaFactory.createOMBuilder(AbstractOMMetaFactory.java:103)
        at org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(OMXMLBuilderFactory.java:295)
        at org.apache.neethi.builders.converters.DOMToOMConverter.convert(DOMToOMConverter.java:36)
        at org.apache.neethi.builders.converters.DOMToOMConverter.convert(DOMToOMConverter.java:32)
        at org.apache.neethi.builders.converters.ConverterRegistry.convert(ConverterRegistry.java:159)
        at org.apache.neethi.AssertionBuilderFactoryImpl.invokeBuilder(AssertionBuilderFactoryImpl.java:135)
        at org.apache.neethi.AssertionBuilderFactoryImpl.build(AssertionBuilderFactoryImpl.java:117)
        at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:224)
        at org.apache.neethi.PolicyBuilder.getAllOperator(PolicyBuilder.java:184)
        at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:217)
        at org.apache.neethi.PolicyBuilder.getExactlyOneOperator(PolicyBuilder.java:180)
        at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:215)
        at org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:174)
        at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:124)
        at org.apache.neethi.PolicyEngine.getPolicy(PolicyEngine.java:111)
        at org.apache.axis2.util.PolicyUtil.getPolicyComponent(PolicyUtil.java:173)
        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.processPoliciesInDefintion(WSDL11ToAxisServiceBuilder.java:3120)
        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.processPoliciesInDefintion(WSDL11ToAxisServiceBuilder.java:3098)
        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:374)
        at org.apache.axis2.description.AxisService.createClientSideAxisService(AxisService.java:2369)
        at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:211)
 
This is a sample services file. I am only showing a single operation, but I have multiple operations, each with its own policy:
<service name="WSSecurityTestService" targetNamespace="http://wssecuritytest.impl.webservices.test.com">
  <schema schemaNamespace="http://wssecuritytest.impl.webservices.test.com"/>
  <parameter name="ServiceClass">com.test.webservices.impl.wssecuritytest.WSSecurityTestService</parameter>
  <parameter name="useOriginalwsdl">true</parameter>
  <parameter name="wsdlFile">WSSecurityTestService.wsdl</parameter>
  <parameter name="modifyUserWSDLPortAddress">true</parameter>
  <module ref="addressing"/>
  <messageReceivers>
    <messageReceiver class="com.test.webservices.receivers.JAXBInOnlyMessageReceiver" mep="http://www.w3.org/ns/wsdl/in-only"/>
    <messageReceiver class="com.test.webservices.receivers.JAXBInOnlyMessageReceiver" mep="http://www.w3.org/ns/wsdl/robust-in-only"/>
    <messageReceiver class="com.test.webservices.receivers.JAXBMessageReceiver" mep="http://www.w3.org/ns/wsdl/in-out"/>
  </messageReceivers>
<operation mep="http://www.w3.org/ns/wsdl/in-out" name="testSAMLTokenSignedNoFault">
    <actionMapping>urn:test:WSSecurityTestService#testSAMLTokenSignedNoFault</actionMapping>
    <outputActionMapping>urn:testSAMLTokenSignedNoFaultResponse</outputActionMapping>
    <faultActionMapping faultName="RecoverableFault">urn:testSAMLTokenSignedNoFaultRecoverableFault</faultActionMapping>
    <faultActionMapping faultName="UnrecoverableFault">urn:testSAMLTokenSignedNoFaultUnrecoverableFault</faultActionMapping>
    <messageReceiver class="com.test.webservices.receivers.JAXBMessageReceiver" mep="http://www.w3.org/ns/wsdl/in-out"/>
    <module ref="rampart"/>
    <wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="SAMLPolicy">
      <wsp:ExactlyOne>
        <wsp:All>
          <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
            <wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
              <sp:InitiatorToken>
                <wsp:Policy>
                  <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
                    <wsp:Policy>
                      <sp:RequireThumbprintReference/>
                      <sp:WssX509V1Token10/>
                    </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:RequireThumbprintReference/>
                      <sp:WssX509V3Token10/>
                    </wsp:Policy>
                  </sp:X509Token>
                </wsp:Policy>
              </sp:RecipientToken>
              <sp:AlgorithmSuite>
                <wsp:Policy>
                  <sp:TripleDesRsa15/>
                </wsp:Policy>
              </sp:AlgorithmSuite>
              <sp:Layout>
                <wsp:Policy>
                  <sp:Strict/>
                </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 xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
              <sp:MustSupportRefKeyIdentifier/>
              <sp:MustSupportRefIssuerSerial/>
            </wsp:Policy>
          </sp:Wss10>
          <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
            <sp:Body/>
          </sp:SignedParts>
          <rampart:RampartConfig xmlns:rampart="http://ws.apache.org/rampart/policy">
            <rampart:user>interca</rampart:user>
            <rampart:passwordCallbackClass>com.test.security2.webservices.WSS4JPWCallback</rampart:passwordCallbackClass>
            <rampart:timestampPrecisionInMilliseconds>true</rampart:timestampPrecisionInMilliseconds>
            <rampart:timestampTTL>300</rampart:timestampTTL>
            <rampart:timestampMaxSkew>300</rampart:timestampMaxSkew>
            <rampart:nonceLifeTime>300</rampart:nonceLifeTime>
            <rampart:signatureCrypto>
              <rampart:crypto provider="com.test.security2.csf.webservices.WSS4JCSFCryptoImpl">
                …
              </rampart:crypto>
            </rampart:signatureCrypto>
          </rampart:RampartConfig>
        </wsp:All>
      </wsp:ExactlyOne>
    </wsp:Policy>
  </operation>
</service>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.