protected WSDLDefinition indexRead(URL doc) throws Exception {
WSDLDefinition wsdlDefinition = factory.createWSDLDefinition();
wsdlDefinition.setUnresolved(true);
wsdlDefinition.setLocation(doc.toURI());
Attribute attr1 = new Attribute(WSDL11, "targetNamespace");
Attribute attr2 = new Attribute(XSD, "targetNamespace");
Attribute[] attrs = helper.readAttributes(doc, attr1, attr2);
wsdlDefinition.setNamespace(attr1.getValues().get(0));
// The definition is marked as resolved but not loaded
wsdlDefinition.setUnresolved(false);
wsdlDefinition.setDefinition(null);
int index = 0;
for (String tns : attr2.getValues()) {
XSDefinition xsd = xsdFactory.createXSDefinition();
xsd.setUnresolved(true);
xsd.setNamespace(tns);
xsd.setLocation(URI.create(doc.toURI() + "#" + index));
index++;
// The definition is marked as resolved but not loaded
xsd.setUnresolved(false);
xsd.setSchema(null);
wsdlDefinition.getXmlSchemas().add(xsd);
}
if (attr2.getValues().size() == 0){
// if there are no schema defined add in the XSD schema
// so this at least gets resolved otherwise we'll get
// errors when trying to resolve part types that
// use primitive types
XSDefinition xsd = xsdFactory.createXSDefinition();