Hi,
When I try to compile the following schema definition (which is part of a WSDL...):
<wsdl:definitions targetNamespace="
http://mydomain.com/testservice
"
xmlns:impl="http://mydomain.com/testservice"
xmlns:wsdlsoap="
http://schemas.xmlsoap.org/wsdl/soap/
"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema
"
xmlns:wsdl="
http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<schema targetNamespace="
http://mydomain.com/testservice" xmlns="
http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/
"
>
<import namespace="
http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="SOAPStruct">
<sequence>
<element name="varInt" type="xsd:int"/>
<element name="varFloat" type="xsd:float"/>
<element name="varString" nillable="true" type="soapenc:string"/>
</sequence>
</complexType>
</schema>
using the following code:
public static SchemaTypeSystem compileSchema(Definition def) throws AppException {
if (isDebug) LOG.debug("Compiling schema...");
SchemaTypeSystem sts = null;
Map nsDefs = def.getNamespaces();
List schematas = ServiceUtils.getSchemata(def);
if (schematas == null) {
sts = null;
} else {
XmlObject [] xmloa = new XmlObject[schematas.size()];
int i = 0;
XmlOptions xmlopts = new XmlOptions();
// For imported schematas
xmlopts.setCompileDownloadUrls();
xmlopts.setCompileNoUpaRule();
// For NS prefixes defined in the WSDL element, and inherited into the schema element's scope.
xmlopts.setLoadAdditionalNamespaces(nsDefs);
//xmlopts.setCompileNoValidation();
//xmlopts.setSaveImplicitNamespaces(nsDefs);
//xmlopts.setSaveAggressiveNamespaces();
//xmlopts.setSaveNamespacesFirst();
Iterator it = schematas.iterator();
while (it.hasNext()) {
Schema si = (Schema) it.next();
//addAdditionalNamespaces(si, nsDefs);
try {
if (isDebug) LOG.debug("Parsing Schema: " + si.getDocumentBaseURI());
xmloa[i++] = XmlObject.Factory.parse(si.getElement(), xmlopts);
} catch (XmlException e) {
throw new AppException("compileSchema: Error parsing schema: " + si.getDocumentBaseURI(), e);
}
}
try {
if (isDebug) LOG.debug("Compiling schemata...");
sts = XmlBeans.compileXsd(xmloa,
XmlBeans.getBuiltinTypeSystem(),
xmlopts);
} catch (XmlException xe) {
throw new AppException("compileSchema: Error compiling schemata: ", xe);
}
}
return sts;
}
I get the following exception:
org.apache.xmlbeans.XmlException: error: src-resolve: type 'string@
http://schemas.xmlsoap.org/soap/encoding/' not found.
Can anyone tell me why?
I did add setCompileDownloadUrls() (per
http://www.mail-archive.com/search?l=user%40xmlbeans.apache.org&q=import+error+src-resolve
) and tried a bunch of other XmlOptions, but it still is unable to resolve soapenc:string
Thanks in advance,
Anil.
P.S.
1. (UPDATE) The SOAP encoding schema types do get resolved successfully if I add a schemaLocation to the import element.
- Resolving types in imported schema Anil Edakkunni
- RE: Resolving types in imported schema Radu Preotiuc-Pietro

