Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 323157 - NullPointerException from WSDLAnalyzer when validating a WSDL
Summary: NullPointerException from WSDLAnalyzer when validating a WSDL
Status: RESOLVED FIXED
Alias: None
Product: WTP Webservices
Classification: WebTools
Component: wst.wsdl (show other bugs)
Version: 3.2.1   Edit
Hardware: PC Windows XP
: P3 normal with 20 votes (vote)
Target Milestone: 3.14   Edit
Assignee: Keith Chong CLA
QA Contact: Keith Chong CLA
URL: https://github.com/eclipse/webtools.w...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-19 11:01 EDT by Mauro Molinari CLA
Modified: 2019-05-23 14:12 EDT (History)
14 users (show)

See Also:
thatnitind: review? (keith.chong.ca)


Attachments
ZIP containing the WSDL and XSD files needed to reproduce (5.55 KB, application/zip)
2010-08-19 11:03 EDT, Mauro Molinari CLA
no flags Details
WSDL and XSD Files attached (1.34 KB, application/zip)
2011-04-11 18:28 EDT, Frank Castro CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mauro Molinari CLA 2010-08-19 11:01:22 EDT
Build Identifier: I20100608-0911

Trying to validate the two provided WSDLs I get a warning at first line of the WSDL editor (source tab):

WS-I: A problem occured while running the WS-I WSDL conformance check: 
 org.eclipse.wst.wsi.internal.analyzer.WSIAnalyzerException: null 
 ------------------------------------------------------------------------------ Nested exception is: java.lang.NullPointerException 
 The WSDLAnalyzer was unable to validate the given WSDL File.

Please note that I'm not sure the provided WSDLs are valid, but I would expect Eclipse to tell me if they are or not.

Reproducible: Always

Steps to Reproduce:
1. create a dynamic web project
2. copy the provided two WSDLs and XSDs in any of the folders of the project created
3. try to validate the WSDLs
Comment 1 Mauro Molinari CLA 2010-08-19 11:03:21 EDT
Created attachment 177006 [details]
ZIP containing the WSDL and XSD files needed to reproduce
Comment 2 Frank Castro CLA 2011-04-11 18:28:12 EDT
Created attachment 192982 [details]
WSDL and XSD Files attached

Eclipse version information:
Eclipse Java EE IDE for Web Developers.

Version: Helios Service Release 2
Build id: 20110218-0911

I am submitting another example of a WSDL Test-v1.wsdl and an XSD TestTypes-v1.0.xsd that Eclipse is giving the same warning on.  The warning is:

WS-I: A problem occured while running the WS-I WSDL conformance check: org.eclipse.wst.wsi.internal.analyzer.WSIAnalyzerException: null 
------------------------------------------------------------------------------ 
Nested exception is: java.lang.NullPointerException The WSDLAnalyzer was unable to validate the given WSDL File.

Please note that SoapUI does not give me this warning.  When I validate the wsdl using SoapUI, it passes without any warnings.

Thank you,

Frank
Comment 3 Rob CLA 2011-04-19 12:59:14 EDT
I got the same error with my WSDL file. The file passed validation using the latest XMLSpy 2011 Enterprise Edition.
Comment 4 Ted Jones CLA 2012-05-11 09:55:13 EDT
I am seeing the same error with this Amazon WSDL: 

http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl

Any updates on when this will be resolved?
Comment 5 Christopher Spires CLA 2012-08-01 11:03:17 EDT
I was able to reproduce the problem.  

I was troubleshooting validation errors in the wsdl files.  The validator was not able to find the schema files.  When I imported an XML catalog, the warnings went away but was replaced with the single warning at the beginning in each wsdl file with the exception of some that had errors.  Some of the wsdl files were displaying errors from validation after the XML Catalog import, and when the errors were corrected , they were replaced with the parser warning:
WS-I: A problem occured while running the WS-I WSDL conformance check: 
 org.eclipse.wst.wsi.internal.analyzer.WSIAnalyzerException: The conformance validation process failed. 
 ------------------------------------------------------------------------------ Nested exception is: 
 java.lang.NullPointerException The WSDLAnalyzer was unable to validate the given WSDL File.

All of the catalog elements in the User Specified Entries are Suffix Entry.  I had to create the XML catalog by hand using the schema copied from OASIS-open.org.  The export XML Catalog feature produces an empty file (no xml header or anything).

<?xml version="1.0" encoding="UTF-8"?>
<er:catalog xmlns:er="urn:oasis:names:tc:entity:xmlns:xml:catalog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:oasis:names:tc:entity:xmlns:xml:catalog ../pathToSchema/XMLCatalogSchema.xsd">
<systemSuffix systemIdSuffix="v2_0/Example.xsd"
			  uri="platform:/resource/path/Example.xsd"/>
</catalog>


in the wsdl the schema locations are relative:
	<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">			
		<xsd:import namespace="http://site/service/" id="ExampleRequest" schemaLocation="../path/v2_0/Example.xsd"/>		
	</xsd:schema>

I did not try other permutation of the XML catalog to see if different catalog entries would behave differently.
Comment 6 Christopher Spires CLA 2012-08-01 11:33:03 EDT
A little more investigation shows that I am only getting the NullPointer exception in the validator when the files successfully validate.  I removed the XML Catalog entry for the Schema files and use the absolute path to the schema files.  After putting in the absolute path, the errors from validation go away is replaced with the NullPointer exception.  So the XML Catalog does not seem related, but the error/warning only appears when the file validates successfully.
Comment 7 Grzegorz Grzybek CLA 2012-11-09 04:09:22 EST
OK, I've finally examined all the details of WSDL WS-I Basic Profile validatiion which ends in NPE.

I've narrowed down the problem two the simplest case when there are TWO wsdl:ports.

The problem is this line:

((WSDLValidatorImpl)validator).init(analyzerContext, profileAssertions,  reportArtifact, getAnalyzerConfig(), reporter, getAnalyzerConfigIndex() == 0)

in org.eclipse.wst.wsi.internal.core.analyzer.BasicProfileAnalyzer in org.eclipse.wst.wsi.source_1.0.500.v201203081939.jar.

This line tells org.eclipse.wst.wsi.internal.core.profile.validator.impl.wsdl.WSDLValidatorImpl to perform "initialization" (which means validating WSDL at definition, typed and imports level) ONLY for first AnalyzerConfig, but in case there are more than one port or service, the method:

org.eclipse.wst.wsi.internal.analyzer.WSDLAnalyzer.addConfigurationToTest(String, String, String, String)

is invoked for each port (source: org.eclipse.wst.wsi.internal.validate.wsdl.WSDLValidator.validate(Document, IValidationInfo))

The problem lies in:

org.eclipse.wst.wsi.internal.core.profile.validator.impl.wsdl.WSDLValidatorImpl.validateArtifact()

which, at the end invokes org.eclipse.wst.wsi.internal.core.profile.validator.impl.wsdl.WSDLValidatorImpl.cleanup() thus clearing the org.eclipse.wst.wsi.internal.core.profile.validator.impl.wsdl.WSDLValidatorImpl.containerMap WHICH CONTAINS ALL WS-I PREREQUISITES needed for further validation.

I see two possible solutions:
1) always perform initialization of org.eclipse.wst.wsi.internal.core.profile.validator.impl.wsdl.WSDLValidatorImpl (replace "getAnalyzerConfigIndex() == 0" with "true") - slower
2) refactor much more code to allow the invoker of WSDLValidatorImpl to get access to "containerMap" (which contains results of previous validation results - prerequisites) before cleaning it up

Please fix this (and https://bugs.eclipse.org/bugs/show_bug.cgi?id=334057) bug! It's very annoying!

regards
Grzegorz Grzybek
Comment 8 Tom Peel CLA 2012-11-29 18:03:57 EST
Had this error, but it goes away when the namespaces have a trailing slash.
Comment 9 Tom Peel CLA 2012-11-29 18:10:58 EST
Change:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation="urn:oasis:names:tc:entity:xmlns:xml:catalog ../pathToSchema/XMLCatalogSchema.xsd">

to

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance/" xsi:schemaLocation="urn:oasis:names:tc:entity:xmlns:xml:catalog ../pathToSchema/XMLCatalogSchema.xsd">

Note trailing slash on xmlns:xsi.
Don't change a urn!!
Comment 10 Grzegorz Grzybek CLA 2012-11-30 00:55:25 EST
This way you make xsi:schemaLocation a custom attribute without any meaning because what matters is the namespace, not the prefix. You could also have changed the namespace to "xyzabc" - it would work just like adding "/".

regards
Grzegorz Grzybek
Comment 11 Mauro Molinari CLA 2013-12-06 12:33:50 EST
Today I hit again this problem. Files that reproduce this problem were submitted, so could anyone take a look at this? :-(

The exception breaks the validation process when another WSDL imports a WSDL for which this error is shown. Since WSDL validation is always quite complex, this problem is quite annoying.
Comment 12 Grzegorz Grzybek CLA 2013-12-06 13:27:05 EST
I've described the solution over a year ago. The pull request (https://github.com/eclipse/webtools.webservices/pull/1) is left without response. I'm working with my forked version for over a year and I've never get any NPE...

I don't know why the pull request is not used...

regards
Grzegorz Grzybek
Comment 13 Isaac Salgueiro CLA 2015-03-23 13:53:43 EDT
Just hit this NPE validating an WSDL with two ports. I'm using Eclipse 4.4.1 and Web Services Tools 3.7.0.v201501151848.
Comment 14 Tim Drury CLA 2015-11-19 14:04:17 EST
Someone please pull in Grzegorz's patch.
Comment 15 Grzegorz Grzybek CLA 2015-11-19 15:27:47 EST
Wow, 5 years...
I didn't expect I'd switch to IDEA after 12 years of using Eclipse ;)

~Grzegorz
Comment 16 Johannes Tietje CLA 2019-04-18 04:06:21 EDT
Soon this (already solved) bug has his ninth anniversary...
Comment 17 Nitin Dahyabhai CLA 2019-04-18 08:44:22 EDT
(In reply to Grzegorz Grzybek from comment #12)
> I've described the solution over a year ago. The pull request
> (https://github.com/eclipse/webtools.webservices/pull/1) is left without
> response. I'm working with my forked version for over a year and I've never
> get any NPE...
> 
> I don't know why the pull request is not used...

We don't get notified of pull requests. and with the original repositories being hosted on git.eclipse.org, there's not a friction-free way of getting those changes integrated that perfectly tracks with CLA signing. The lone Source Editing pull request has been processed, but there's no way that I can Close it.
Comment 18 Nick Boldt CLA 2019-04-23 12:48:17 EDT
Converted to gerrit: https://git.eclipse.org/r/#/c/141006/
Comment 19 Eclipse Genie CLA 2019-04-23 15:53:15 EDT
New Gerrit change created: https://git.eclipse.org/r/141012
Comment 21 Keith Chong CLA 2019-05-23 14:12:22 EDT
This was merged for WTP 3.14.