You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by em...@apache.org on 2007/10/16 10:12:38 UTC
svn commit: r585073 - in /incubator/cxf/trunk:
rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/
tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/
tools/wsdlto/frontend/jaxws/s...
Author: ema
Date: Tue Oct 16 01:12:36 2007
New Revision: 585073
URL: http://svn.apache.org/viewvc?rev=585073&view=rev
Log:
* Fixed issue CXF-1112 , add catalog support for wsdlLocation and schemaLocation in binding file
* Fixed the jaxb binding file test failure in 2.0.x branch
* Changed the port number to 9234 in JettyHTTPServerEngineTest to avoid port conflict with some app
Added:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/binding.xml
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/catalog.xml
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/extra.xsd
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/jax-ws-catalog.xml
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/jaxbbinding.xml
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/myservice.wsdl
Modified:
incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1094/jaxbbinding.xml
Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java?rev=585073&r1=585072&r2=585073&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java Tue Oct 16 01:12:36 2007
@@ -68,11 +68,11 @@
@Test
public void testEngineRetrieval() throws Exception {
JettyHTTPServerEngine engine =
- factory.createJettyHTTPServerEngine(1234, "http");
+ factory.createJettyHTTPServerEngine(9234, "http");
assertTrue(
"Engine references for the same port should point to the same instance",
- engine == factory.retrieveJettyHTTPServerEngine(1234));
+ engine == factory.retrieveJettyHTTPServerEngine(9234));
factory.destroyForPort(1234);
}
@@ -80,13 +80,13 @@
@Test
public void testHttpAndHttps() throws Exception {
JettyHTTPServerEngine engine =
- factory.createJettyHTTPServerEngine(1234, "http");
+ factory.createJettyHTTPServerEngine(9234, "http");
assertTrue("Protocol must be http",
"http".equals(engine.getProtocol()));
engine = new JettyHTTPServerEngine();
- engine.setPort(1235);
+ engine.setPort(9235);
engine.setTlsServerParameters(new TLSServerParameters());
engine.finalizeConfig();
@@ -94,14 +94,14 @@
list.add(engine);
factory.setEnginesList(list);
- engine = factory.createJettyHTTPServerEngine(1235, "https");
+ engine = factory.createJettyHTTPServerEngine(9235, "https");
assertTrue("Protocol must be https",
"https".equals(engine.getProtocol()));
- factory.destroyForPort(1234);
- factory.destroyForPort(1235);
+ factory.destroyForPort(9234);
+ factory.destroyForPort(9235);
}
@@ -147,10 +147,10 @@
@Test
public void testaddServants() throws Exception {
- String urlStr = "http://localhost:1234/hello/test";
- String urlStr2 = "http://localhost:1234/hello233/test";
+ String urlStr = "http://localhost:9234/hello/test";
+ String urlStr2 = "http://localhost:9234/hello233/test";
JettyHTTPServerEngine engine =
- factory.createJettyHTTPServerEngine(1234, "http");
+ factory.createJettyHTTPServerEngine(9234, "http");
JettyHTTPTestHandler handler1 = new JettyHTTPTestHandler("string1");
JettyHTTPTestHandler handler2 = new JettyHTTPTestHandler("string2");
engine.addServant(new URL(urlStr), handler1);
@@ -179,18 +179,18 @@
}
assertEquals("The jetty http handler did not take effect", response, "string2");
// set the get request
- factory.destroyForPort(1234);
+ factory.destroyForPort(9234);
}
@Test
public void testSetHandlers() throws Exception {
- URL url = new URL("http://localhost:1245/hello/test");
+ URL url = new URL("http://localhost:9235/hello/test");
JettyHTTPTestHandler handler1 = new JettyHTTPTestHandler("string1");
JettyHTTPTestHandler handler2 = new JettyHTTPTestHandler("string2");
JettyHTTPServerEngine engine = new JettyHTTPServerEngine();
- engine.setPort(1245);
+ engine.setPort(9235);
List<Handler> handlers = new ArrayList<Handler>();
handlers.add(handler1);
@@ -210,9 +210,9 @@
@Test
public void testGetContextHandler() throws Exception {
- String urlStr = "http://localhost:1234/hello/test";
+ String urlStr = "http://localhost:9234/hello/test";
JettyHTTPServerEngine engine =
- factory.createJettyHTTPServerEngine(1234, "http");
+ factory.createJettyHTTPServerEngine(9234, "http");
ContextHandler contextHandler = engine.getContextHandler(new URL(urlStr));
// can't find the context handler here
assertNull(contextHandler);
@@ -231,7 +231,7 @@
fail("Can't get the reponse from the server " + ex);
}
assertEquals("the jetty http handler did not take effect", response, "string2");
- factory.destroyForPort(1234);
+ factory.destroyForPort(9234);
}
private String getResponse(String target) throws Exception {
Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java?rev=585073&r1=585072&r2=585073&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java Tue Oct 16 01:12:36 2007
@@ -41,6 +41,8 @@
import org.xml.sax.InputSource;
+import org.apache.cxf.Bus;
+import org.apache.cxf.catalog.OASISCatalogManager;
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.StringUtils;
@@ -55,13 +57,14 @@
import org.apache.cxf.tools.util.StAXUtil;
import org.apache.cxf.tools.util.URIParserUtil;
import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ProcessorUtil;
+import org.apache.xml.resolver.Catalog;
public final class CustomizationParser {
// For WSDL1.1
private static final Logger LOG = LogUtils.getL7dLogger(CustomizationParser.class);
private ToolContext env;
- //map for jaxws binding and wsdl element
+ // map for jaxws binding and wsdl element
private final Map<Element, Element> jaxwsBindingsMap = new HashMap<Element, Element>();
private final List<InputSource> jaxbBindings = new ArrayList<InputSource>();
private final Map<String, Element> customizedElements = new HashMap<String, Element>();
@@ -86,11 +89,13 @@
String[] bindingFiles;
try {
wsdlURL = URIParserUtil.getAbsoluteURI((String)env.get(ToolConstants.CFG_WSDLURL));
- try {
- wsdlNode = getTargetNode(this.wsdlURL);
- } catch (IOException e) {
- // do nothing
+
+ wsdlNode = getTargetNode(this.wsdlURL);
+
+ if (wsdlNode == null && env.get(ToolConstants.CFG_CATALOG) != null) {
+ wsdlNode = resolveNodeByCatalog(wsdlURL);
}
+ // TODO: if wsdlNode is null throw exception
customizedElements.put(wsdlURL.toString(), wsdlNode);
bindingFiles = (String[])env.get(ToolConstants.CFG_BINDING);
if (bindingFiles == null) {
@@ -120,21 +125,25 @@
buildHandlerChains();
}
- public Element getTargetNode(String wsdlLoc) throws IOException {
+ public Element getTargetNode(String uri) {
Document doc = null;
InputStream ins = null;
+
try {
- URIResolver resolver = new URIResolver(wsdlLoc);
+ URIResolver resolver = new URIResolver(uri);
ins = resolver.getInputStream();
} catch (IOException e1) {
- throw e1;
-
+ return null;
}
+ if (ins == null) {
+ return null;
+ }
+
try {
doc = DOMUtils.readXml(ins);
} catch (Exception e) {
- Message msg = new Message("CAN_NOT_READ_AS_ELEMENT", LOG, new Object[]{wsdlLoc});
+ Message msg = new Message("CAN_NOT_READ_AS_ELEMENT", LOG, new Object[] {uri});
throw new ToolException(msg, e);
}
@@ -165,8 +174,7 @@
Node annotationNode = nodeSelector.queryNode(node, "//xsd:annotation");
if (annotationNode == null) {
- annotationNode = node.getOwnerDocument().createElementNS(ToolConstants.SCHEMA_URI,
- "annotation");
+ annotationNode = node.getOwnerDocument().createElementNS(ToolConstants.SCHEMA_URI, "annotation");
}
nodes[0] = annotationNode;
@@ -174,8 +182,7 @@
Node appinfoNode = nodeSelector.queryNode(annotationNode, "//xsd:appinfo");
if (appinfoNode == null) {
- appinfoNode = node.getOwnerDocument().createElementNS(ToolConstants.SCHEMA_URI,
- "appinfo");
+ appinfoNode = node.getOwnerDocument().createElementNS(ToolConstants.SCHEMA_URI, "appinfo");
annotationNode.appendChild(appinfoNode);
}
nodes[1] = appinfoNode;
@@ -194,8 +201,7 @@
Element jaxbBindingElement = getJaxbBindingElement(jaxwsBindingNode);
appendJaxbVersion((Element)schemaNode);
if (jaxbBindingElement != null) {
- NodeList nlist = nodeSelector.queryNodes(schemaNode,
- jaxbBindingElement.getAttribute("node"));
+ NodeList nlist = nodeSelector.queryNodes(schemaNode, jaxbBindingElement.getAttribute("node"));
for (int i = 0; i < nlist.getLength(); i++) {
Node node = nlist.item(i);
copyAllJaxbDeclarations(node, jaxbBindingElement);
@@ -203,7 +209,7 @@
return;
}
- Node[] embededNodes = getAnnotationNodes(schemaNode);
+ Node[] embededNodes = getAnnotationNodes(schemaNode);
Node annotationNode = embededNodes[0];
Node appinfoNode = embededNodes[1];
@@ -252,8 +258,7 @@
NodeList nodeList = nodeSelector.queryNodes(targetNode, expression);
if (nodeList == null || nodeList.getLength() == 0) {
- throw new ToolException(new Message("NODE_NOT_EXISTS",
- LOG, new Object[] {expression}));
+ throw new ToolException(new Message("NODE_NOT_EXISTS", LOG, new Object[] {expression}));
}
for (int i = 0; i < nodeList.getLength(); i++) {
@@ -272,7 +277,7 @@
internalizeBinding(children[i], targetNode, expression);
}
}
-
+
}
private void copyBindingsToWsdl(Node node, Node bindings, MapNamespaceContext ctx) {
@@ -282,8 +287,8 @@
for (Map.Entry<String, String> ent : ctx.getUsedNamespaces().entrySet()) {
if (node.lookupNamespaceURI(ent.getKey()) == null) {
- node.getOwnerDocument().getDocumentElement()
- .setAttribute("xmlns:" + ent.getKey(), ent.getValue());
+ node.getOwnerDocument().getDocumentElement().setAttribute("xmlns:" + ent.getKey(),
+ ent.getValue());
}
}
@@ -322,7 +327,6 @@
if (attrNode != null) {
cloneNode.removeChild(child);
}
-
}
}
firstChild.appendChild(cloneNode);
@@ -378,81 +382,133 @@
throw new ToolException(msg, e1);
}
if (isValidJaxwsBindingFile(bindingFile, reader)) {
-
+
String wsdlLocation = root.getAttribute("wsdlLocation");
Element targetNode = null;
if (!StringUtils.isEmpty(wsdlLocation)) {
- URI wsdlURI = null;
- try {
- wsdlURI = new URI(wsdlLocation);
- } catch (URISyntaxException e) {
- Message msg = new Message("JAXWSBINDINGS_WSDLLOC_ERROR",
- LOG, new Object[] {wsdlLocation});
- throw new ToolException(msg);
- }
-
- if (!wsdlURI.isAbsolute()) {
- try {
- String base = URIParserUtil.getAbsoluteURI(bindingFile);
- URI baseURI = new URI(base);
- wsdlURI = baseURI.resolve(wsdlURI);
- } catch (URISyntaxException e) {
- Message msg = new Message("NOT_URI", LOG, new Object[] {bindingFile});
- throw new ToolException(msg, e);
- }
-
- }
- try {
- targetNode = this.getTargetNode(wsdlURI.toString());
- } catch (IOException e) {
- Message msg = new Message("POINT_TO_WSDL_DOES_NOT_EXIST",
- LOG, new Object[]{bindingFile, wsdlURI.toString()});
- throw new ToolException(msg, e);
+ String wsdlURI = getAbsoluteURI(wsdlLocation, bindingFile);
+ targetNode = getTargetNode(wsdlURI);
+ String resolvedLoc = wsdlURI;
+ if (targetNode == null && env.get(ToolConstants.CFG_CATALOG) != null) {
+ resolvedLoc = resolveByCatalog(wsdlURI.toString());
+ targetNode = getTargetNode(resolvedLoc);
}
if (targetNode == null) {
- Message msg = new Message("CAN_NOT_FIND_BINDING_WSDL",
- LOG, new Object[] {wsdlURI.normalize(), bindingFile});
+ Message msg = new Message("POINT_TO_WSDL_DOES_NOT_EXIST",
+ LOG, new Object[] {bindingFile, resolvedLoc});
throw new ToolException(msg);
-
}
- root.setAttribute("wsdlLocation", wsdlURI.toString());
+
+ root.setAttribute("wsdlLocation", wsdlURI);
} else {
- try {
- targetNode = getTargetNode(wsdlURL);
- } catch (IOException e) {
- //do nothing
- }
- root.setAttribute("wsdlLocation", wsdlURL);
+ targetNode = wsdlNode;
+
+ root.setAttribute("wsdlLocation", wsdlURL);
}
jaxwsBindingsMap.put(root, targetNode);
-
+
} else if (isValidJaxbBindingFile(reader)) {
String schemaLocation = root.getAttribute("schemaLocation");
if (StringUtils.isEmpty(schemaLocation)) {
- root.setAttribute("schemaLocation", wsdlURL);
+ InputSource tmpIns = null;
try {
- File tmpFile = FileUtils.createTempFile("jaxbbinding", ".xml");
- XMLUtils.writeTo(root, new FileOutputStream(tmpFile));
- InputSource newis = new InputSource(URIParserUtil.getAbsoluteURI(tmpFile
- .getAbsolutePath()));
- jaxbBindings.add(newis);
- tmpFile.deleteOnExit();
- } catch (Exception e) {
+ tmpIns = convertToTmpInputSource(root, wsdlURL);
+ } catch (Exception e1) {
Message msg = new Message("FAILED_TO_ADD_SCHEMALOCATION", LOG, bindingFile);
- throw new ToolException(msg, e);
- }
+ throw new ToolException(msg, e1);
+ }
+ jaxbBindings.add(tmpIns);
} else {
- jaxbBindings.add(is);
+ String schemeURI = this.getAbsoluteURI(schemaLocation, bindingFile);
+ Element ele = getTargetNode(schemeURI);
+ if (ele != null) {
+ jaxbBindings.add(is);
+ } else {
+ // try to resolve it with CatalogReslover
+ String resolvedLocation = null;
+ if (env.get(ToolConstants.CFG_CATALOG) != null) {
+ resolvedLocation = resolveByCatalog(schemaLocation);
+ }
+ if (resolvedLocation == null) {
+ Message msg = new Message("POINT_TO_XSD_DOES_NOT_EXIST", LOG, schemaLocation);
+ throw new ToolException(msg);
+ } else {
+ InputSource tmpIns = null;
+ try {
+ tmpIns = convertToTmpInputSource(root, resolvedLocation);
+ } catch (Exception e1) {
+ Message msg = new Message("FAILED_TO_ADD_SCHEMALOCATION", LOG, bindingFile);
+ throw new ToolException(msg, e1);
+ }
+ jaxbBindings.add(tmpIns);
+ }
+ }
}
+
} else {
Message msg = new Message("UNKNOWN_BINDING_FILE", LOG, bindingFile);
throw new ToolException(msg);
}
}
+ private String getAbsoluteURI(String uri, String bindingFile) {
+ URI locURI = null;
+ try {
+ locURI = new URI(uri);
+ } catch (URISyntaxException e) {
+ Message msg = new Message("BINDING_LOC_ERROR",
+ LOG, new Object[] {uri});
+ throw new ToolException(msg);
+ }
+
+ if (!locURI.isAbsolute()) {
+ try {
+ String base = URIParserUtil.getAbsoluteURI(bindingFile);
+ URI baseURI = new URI(base);
+ locURI = baseURI.resolve(locURI);
+ } catch (URISyntaxException e) {
+ Message msg = new Message("NOT_URI", LOG, new Object[] {bindingFile});
+ throw new ToolException(msg, e);
+ }
+
+ }
+ return locURI.toString();
+ }
+
+ private Element resolveNodeByCatalog(String url) {
+ String resolvedLocation = resolveByCatalog(url);
+ return getTargetNode(resolvedLocation);
+ }
+
+ private String resolveByCatalog(String url) {
+ Bus bus = (Bus)env.get(Bus.class);
+ Catalog catalogResolver = OASISCatalogManager.getCatalogManager(bus).getCatalog();
+ String resolvedLocation;
+ try {
+ resolvedLocation = catalogResolver.resolveSystem(url);
+ if (resolvedLocation == null) {
+ resolvedLocation = catalogResolver.resolveURI(url);
+ }
+ } catch (Exception e1) {
+ Message msg = new Message("FAILED_RESOLVE_CATALOG", LOG, url);
+ throw new ToolException(msg, e1);
+ }
+ return resolvedLocation;
+ }
+
+ private InputSource convertToTmpInputSource(Element ele, String schemaLoc) throws Exception {
+ InputSource result = null;
+ ele.setAttribute("schemaLocation", schemaLoc);
+ File tmpFile = FileUtils.createTempFile("jaxbbinding", ".xml");
+ XMLUtils.writeTo(ele, new FileOutputStream(tmpFile));
+ result = new InputSource(URIParserUtil.getAbsoluteURI(tmpFile.getAbsolutePath()));
+ tmpFile.deleteOnExit();
+ return result;
+ }
+
private boolean isValidJaxbBindingFile(XMLStreamReader reader) {
if (ToolConstants.JAXB_BINDINGS.equals(reader.getName())) {
-
+
return true;
}
return false;
@@ -460,12 +516,13 @@
private boolean isValidJaxwsBindingFile(String bindingLocation, XMLStreamReader reader) {
if (ToolConstants.JAXWS_BINDINGS.equals(reader.getName())) {
- //Comment this check , by default wsdlLocation value will be the user input wsdl url
+ // Comment this check , by default wsdlLocation value will be the
+ // user input wsdl url
/*
- String wsdlLocation = reader.getAttributeValue(null, "wsdlLocation");
- if (!StringUtils.isEmpty(wsdlLocation)) {
- return true;
- }*/
+ * String wsdlLocation = reader.getAttributeValue(null,
+ * "wsdlLocation"); if (!StringUtils.isEmpty(wsdlLocation)) { return
+ * true; }
+ */
return true;
}
return false;
@@ -475,6 +532,7 @@
protected void setWSDLNode(final Element node) {
this.wsdlNode = node;
}
+
public Node getWSDLNode() {
return this.wsdlNode;
}
@@ -495,7 +553,7 @@
protected Element getJaxbBindingElement(final Element bindings) {
NodeList list = bindings.getElementsByTagNameNS(ToolConstants.NS_JAXB_BINDINGS, "bindings");
if (list.getLength() > 0) {
- return (Element) list.item(0);
+ return (Element)list.item(0);
}
return null;
}
Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties?rev=585073&r1=585072&r2=585073&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties Tue Oct 16 01:12:36 2007
@@ -21,11 +21,13 @@
STAX_PARSER_ERROR = StAX parser error, check your external binding file(s)
UNKNOWN_BINDING_FILE= Unknown external binding files : {0}
CAN_NOT_FIND_BINDING_WSDL = Can not read the specified wsdl {0} that external binding file {1} points to
-JAXWSBINDINGS_WSDLLOC_ERROR = Attribute wsdlLocation value {0} in jaxws binding element is not an URI
+BINDING_LOC_ERROR = Attribute wsdlLocation/schemaLocation value {0} in jaxws binding element is not an URI
ERROR_TARGETNODE_WITH_XPATH = XPath query {0} is identifying either multiple or no target nodes.
XPATH_ERROR = XPath query error , check the query expression : {0}
NOT_URI = Can not construct new URI with this string : {0}
-CAN_NOT_READ_AS_ELEMENT = Can not read this file to a xml element : {0}
+CAN_NOT_READ_AS_ELEMENT = The binding file : {0} references to a not well-formed xml doucument
NODE_NOT_EXISTS = Can not find any node with the XPath {0}
FAILED_TO_ADD_SCHEMALOCATION = Failed to inject schmeaLoaction for binding file {0}
-POINT_TO_WSDL_DOES_NOT_EXIST = Binding file : {0} points to wsdl(resovled as {1}) does not exist
\ No newline at end of file
+POINT_TO_WSDL_DOES_NOT_EXIST = Binding file : {0} points to wsdl(resovled as {1}) does not exist
+POINT_TO_XSD_DOES_NOT_EXIST = Binding file : {0} points to xsd(resovled as {1}) does not exist
+FAILED_RESOLVE_CATALOG = Failed to resolve catalog {0}
\ No newline at end of file
Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java?rev=585073&r1=585072&r2=585073&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java Tue Oct 16 01:12:36 2007
@@ -40,6 +40,7 @@
import org.xml.sax.InputSource;
+import org.apache.cxf.Bus;
import org.apache.cxf.catalog.OASISCatalogManager;
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
@@ -84,6 +85,7 @@
public Definition build(String wsdlURL) {
this.builder.setBus(this.bus);
wsdlDefinition = builder.build(wsdlURL);
+ context.put(Bus.class, bus);
context.put(ToolConstants.IMPORTED_DEFINITION, builder.getImportedDefinitions());
checkSupported(wsdlDefinition);
return wsdlDefinition;
Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=585073&r1=585072&r2=585073&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java Tue Oct 16 01:12:36 2007
@@ -327,6 +327,7 @@
output.getCanonicalPath() + "/classes", "-d",
output.getCanonicalPath(), "-b",
getLocation("/wsdl2java_wsdl/bug305924/binding1.xml"),
+ "-verbose",
getLocation("/wsdl2java_wsdl/bug305924/hello_world.wsdl")};
WSDLToJava.main(args);
} catch (Exception e) {
@@ -813,5 +814,27 @@
}
assertFalse("sayHiAsyn method should not be generated", existSayHiAsyn);
}
+
+
+ @Test
+ public void testCatalog() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL,
+ getLocation("/wsdl2java_wsdl/cxf1112/myservice.wsdl"));
+ env.put(ToolConstants.CFG_CATALOG, getLocation("/wsdl2java_wsdl/cxf1112/catalog.xml"));
+ env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/cxf1112/jaxbbinding.xml"));
+ processor.setContext(env);
+ processor.execute();
+ }
+
+
+ @Test
+ public void testCatalog2() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL, "http://example.org/wsdl");
+ env.put(ToolConstants.CFG_CATALOG, getLocation("/wsdl2java_wsdl/cxf1112/jax-ws-catalog.xml"));
+ env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/cxf1112/binding.xml"));
+ processor.setContext(env);
+ processor.execute();
+ }
+
}
Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1094/jaxbbinding.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1094/jaxbbinding.xml?rev=585073&r1=585072&r2=585073&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1094/jaxbbinding.xml (original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1094/jaxbbinding.xml Tue Oct 16 01:12:36 2007
@@ -20,7 +20,7 @@
<jaxb:bindings version="2.0"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- node="xsd:element[@name='CreateProcess']/xsd:complexType/xsd:sequence/xsd:element[@name='MyProcess']/xsd:simpleType">
+ node="//xsd:element[@name='CreateProcess']/xsd:complexType/xsd:sequence/xsd:element[@name='MyProcess']/xsd:simpleType">
<jaxb:typesafeEnumClass name="MyProcess">
<jaxb:typesafeEnumMember name="BLUE" value="BLUE" />
<jaxb:typesafeEnumMember name="RED" value="RED" />
Added: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/binding.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/binding.xml?rev=585073&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/binding.xml (added)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/binding.xml Tue Oct 16 01:12:36 2007
@@ -0,0 +1,29 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<bindings
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ wsdlLocation="http://example.org/wsdl"
+ xmlns="http://java.sun.com/xml/ns/jaxws">
+ <bindings node="wsdl:definitions/wsdl:service">
+
+ <class name="CustomizedService"/>
+
+ </bindings>
+</bindings>
\ No newline at end of file
Added: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/catalog.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/catalog.xml?rev=585073&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/catalog.xml (added)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/catalog.xml Tue Oct 16 01:12:36 2007
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<!DOCTYPE catalog
+PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
+"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
+
+<catalog prefer="public" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+ <rewriteURI rewritePrefix="extra.xsd" uriStartString="http://www.company.com/extra.xsd"/>
+</catalog>
Added: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/extra.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/extra.xsd?rev=585073&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/extra.xsd (added)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/extra.xsd Tue Oct 16 01:12:36 2007
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.company.com/extra" xmlns="http://www.company.com/extra"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:element name="extraByNameAndTypeRequest">
+ <xs:annotation>
+ <xs:documentation>Request all or Request by name</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="name" type="xs:string"/>
+ <xs:element name="type" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="extraByNameAndTypeResponse">
+ <xs:annotation>
+ <xs:documentation>Response to extra request</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:choice>
+ <xs:element name="id" type="xs:string"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="extraError" type="extraErrorComplexType"/>
+ <xs:complexType name="extraErrorComplexType">
+ <xs:sequence>
+ <xs:element maxOccurs="1" minOccurs="1" name="message" nillable="false" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Error message.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+
+</xs:schema>
Added: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/jax-ws-catalog.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/jax-ws-catalog.xml?rev=585073&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/jax-ws-catalog.xml (added)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/jax-ws-catalog.xml Tue Oct 16 01:12:36 2007
@@ -0,0 +1,7 @@
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
+ prefer="system">
+
+ <system systemId="http://example.org/wsdl"
+ uri="../addNumbers.wsdl"/>
+
+</catalog>
Added: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/jaxbbinding.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/jaxbbinding.xml?rev=585073&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/jaxbbinding.xml (added)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/jaxbbinding.xml Tue Oct 16 01:12:36 2007
@@ -0,0 +1,29 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<jaxb:bindings version="2.0"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ schemaLocation="http://www.company.com/extra.xsd"
+ node="/xsd:schema">
+ <jaxb:schemaBindings>
+ <jaxb:package name="org.mytest">
+ </jaxb:package>
+ </jaxb:schemaBindings>
+</jaxb:bindings>
\ No newline at end of file
Added: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/myservice.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/myservice.wsdl?rev=585073&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/myservice.wsdl (added)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/myservice.wsdl Tue Oct 16 01:12:36 2007
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<wsdl:definitions name="myservice" targetNamespace="http://www.company.com/MyService"
+ xmlns:tns="http://www.company.com/MyService"
+ xmlns:extra="http://www.company.com/extra"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <wsdl:types>
+ <xsd:schema>
+ <xsd:import namespace="http://www.company.com/extra" schemaLocation="http://www.company.com/extra.xsd"/>
+ </xsd:schema>
+ </wsdl:types>
+
+ <wsdl:message name="extraFault">
+ <wsdl:part name="fault" element="extra:extraError" />
+ </wsdl:message>
+
+ <wsdl:message name="extraRequest">
+ <wsdl:part name="parameters" element="extra:extraByNameAndTypeRequest"/>
+ </wsdl:message>
+
+ <wsdl:message name="extraResponse">
+ <wsdl:part name="parameters" element="extra:extraByNameAndTypeResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="myManager">
+ <wsdl:operation name="extraSearch">
+ <wsdl:input name="extraRequest" message="tns:extraRequest" />
+ <wsdl:output name="extraResponse" message="tns:extraResponse" />
+ <wsdl:fault name="extraFault" message="tns:extraFault" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="myServiceSoapBinding" type="tns:myManager">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="extraSearch">
+ <soap:operation soapAction="" style="document" />
+ <wsdl:input name="extraRequest">
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="extraResponse">
+ <soap:body use="literal" />
+ </wsdl:output>
+ <wsdl:fault name="extraFault">
+ <soap:fault name="extraFault" use="literal" />
+ </wsdl:fault>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="MyService">
+ <wsdl:port name="MyService" binding="tns:myServiceSoapBinding">
+ <soap:address location="http://localhost:8080/MyServiceServer/services/myServiceServer" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
\ No newline at end of file