Why is the WSDL parser still importing external documents?

I tried disabling the import of documents in WSDL4J (1.6.2) in the API suggested by the documentation:

  wsdlReader.setFeature("javax.wsdl.importDocuments", false);

In fact, it stops importing XML schema files declared with the wsdl: import tag , but stops importing files declared with the xs: import tag .

The following code snippet [see at the end of the letter] for example file

http://www.ibspan.waw.pl/~gawinec/example.wsdl

returns the following exception:

javax.wsdl.WSDLException: WSDLException (at /definitions/types/xs:schema):
faultCode=OTHER_ERROR: An error occurred trying to resolve schema referenced
at 'EchoExceptions.xsd', relative to
'http://www.ibspan.waw.pl/~gawinec/example.wsdl'.:
java.io.FileNotFoundException: This file was not found:
http://www.ibspan.waw.pl/~gawinec/EchoExceptions.xsd
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
    at IsolatedExample.main(IsolatedExample.java:15)
Caused by: java.io.FileNotFoundException: This file was not found:
http://www.ibspan.waw.pl/~gawinec/EchoExceptions.xsd
    at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source)
    ... 10 more

Can you offer me any solution to this problem? I just don't want to import external XML schemas.

Regards, Maciej


import javax.wsdl.WSDLException;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;

public class IsolatedExample {
  public static void main(String[] args) {

    WSDLFactory wsdlFactory;
    try {
      wsdlFactory = WSDLFactory.newInstance();
      WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
      wsdlReader.setFeature("javax.wsdl.verbose", false);
      wsdlReader.setFeature("javax.wsdl.importDocuments", false);
      wsdlReader.readWSDL("http://www.ibspan.waw.pl/~gawinec/example.wsdl");
    } catch (WSDLException e) {
      e.printStackTrace();
    }
  }
}
+3
source share
2

WSDL4J ( , ) , . , WSDL4J. , , WSDL, ( PopulatedExtensionRegistry, SchemaDeserializer).

, :

mapExtensionTypes(Types.class, SchemaConstants.Q_ELEM_XSD_1999,
    SchemaImpl.class);
registerDeserializer(Types.class, SchemaConstants.Q_ELEM_XSD_1999,
    new SchemaDeserializer());
registerSerializer(Types.class, SchemaConstants.Q_ELEM_XSD_1999,
    new SchemaSerializer());

mapExtensionTypes(Types.class, SchemaConstants.Q_ELEM_XSD_2000,
    SchemaImpl.class);
registerDeserializer(Types.class, SchemaConstants.Q_ELEM_XSD_2000,
    new SchemaDeserializer());
registerSerializer(Types.class, SchemaConstants.Q_ELEM_XSD_2000,
    new SchemaSerializer());

mapExtensionTypes(Types.class, SchemaConstants.Q_ELEM_XSD_2001,
    SchemaImpl.class);
registerDeserializer(Types.class, SchemaConstants.Q_ELEM_XSD_2001,
    new SchemaDeserializer());
registerSerializer(Types.class, SchemaConstants.Q_ELEM_XSD_2001,
    new SchemaSerializer());
+1

Java -, ? , .

, , , , .

$0.02

0

Source: https://habr.com/ru/post/1713211/


All Articles