use of com.sun.tools.ws.wsdl.parser.WSDLParser in project metro-jax-ws by eclipse-ee4j.
the class WSDLParserTest method testParseUsingPolicyRequired.
public void testParseUsingPolicyRequired() throws Exception {
final ErrorReceiverFilter errorReceiver = createErrorReceiver();
final InputSource source = getResourceSource("usingpolicy-required.wsdl");
final WsimportOptions options = new WsimportOptions();
options.addWSDL(source);
final WSDLParser instance = new WSDLParser(options, errorReceiver, null);
final WSDLDocument wsdl = instance.parse();
assertNotNull(wsdl);
assertFalse(errorReceiver.hadError());
}
use of com.sun.tools.ws.wsdl.parser.WSDLParser in project metro-jax-ws by eclipse-ee4j.
the class WSDLParserTest method testParseSimple.
public void testParseSimple() throws Exception {
final ErrorReceiverFilter errorReceiver = createErrorReceiver();
final InputSource source = getResourceSource("simple.wsdl");
final WsimportOptions options = new WsimportOptions();
options.addWSDL(source);
final WSDLParser instance = new WSDLParser(options, errorReceiver, null);
final WSDLDocument wsdl = instance.parse();
assertNotNull(wsdl);
assertFalse(errorReceiver.hadError());
}
use of com.sun.tools.ws.wsdl.parser.WSDLParser in project metro-jax-ws by eclipse-ee4j.
the class WSDLParserTest method testParseUsingPolicy.
public void testParseUsingPolicy() throws Exception {
final ErrorReceiverFilter errorReceiver = createErrorReceiver();
final InputSource source = getResourceSource("usingpolicy.wsdl");
final WsimportOptions options = new WsimportOptions();
options.addWSDL(source);
final WSDLParser instance = new WSDLParser(options, errorReceiver, null);
final WSDLDocument wsdl = instance.parse();
assertNotNull(wsdl);
assertFalse(errorReceiver.hadError());
}
use of com.sun.tools.ws.wsdl.parser.WSDLParser in project metro-jax-ws by eclipse-ee4j.
the class WSDLModeler method buildModel.
@Override
public Model buildModel() {
try {
parser = new WSDLParser(options, errReceiver, forest);
parser.addParserListener(new ParserListener() {
@Override
public void ignoringExtension(Entity entity, QName name, QName parent) {
if (parent.equals(WSDLConstants.QNAME_TYPES)) {
// check for a schema element with the wrong namespace URI
if (name.getLocalPart().equals("schema") && !name.getNamespaceURI().equals("")) {
warning(entity, ModelerMessages.WSDLMODELER_WARNING_IGNORING_UNRECOGNIZED_SCHEMA_EXTENSION(name.getNamespaceURI()));
}
}
}
@Override
public void doneParsingEntity(QName element, Entity entity) {
}
});
document = parser.parse();
if (document == null || document.getDefinitions() == null) {
return null;
}
document.validateLocally();
Model model = internalBuildModel(document);
if (model == null || errReceiver.hadError()) {
return null;
}
// ClassNameCollector classNameCollector = new ClassNameCollector();
classNameCollector.process(model);
if (classNameCollector.getConflictingClassNames().isEmpty()) {
if (errReceiver.hadError()) {
return null;
}
return model;
}
// do another pass, this time with conflict resolution enabled
model = internalBuildModel(document);
classNameCollector.process(model);
if (classNameCollector.getConflictingClassNames().isEmpty()) {
// we're done
if (errReceiver.hadError()) {
return null;
}
return model;
}
// give up
StringBuilder conflictList = new StringBuilder();
boolean first = true;
for (Iterator iter = classNameCollector.getConflictingClassNames().iterator(); iter.hasNext(); ) {
if (!first) {
conflictList.append(", ");
} else {
first = false;
}
conflictList.append((String) iter.next());
}
error(document.getDefinitions(), ModelerMessages.WSDLMODELER_UNSOLVABLE_NAMING_CONFLICTS(conflictList.toString()));
} catch (ModelException e) {
reportError(document.getDefinitions(), e.getMessage(), e);
} catch (ParseException | IOException | SAXException e) {
errReceiver.error(e);
} catch (ValidationException e) {
errReceiver.error(e.getMessage(), e);
}
// should never reach here
return null;
}
Aggregations