94578 JDBCBC: JDBCBC WSDL wizard unable to create WSDL for table with special characters in the table name
1.1 --- a/sql.wizard/src/org/netbeans/modules/jdbcwizard/builder/wsdl/WSDLGenerator.java Tue Apr 03 01:04:26 2007 +0000
1.2 +++ b/sql.wizard/src/org/netbeans/modules/jdbcwizard/builder/wsdl/WSDLGenerator.java Tue Apr 03 06:48:59 2007 +0000
1.3 @@ -74,6 +74,7 @@
1.4 import org.netbeans.modules.jdbcwizard.builder.model.DB2QueryGenerator;
1.5 import org.netbeans.modules.jdbcwizard.builder.model.SQLServerQueryGenerator;
1.6 import org.netbeans.modules.jdbcwizard.builder.model.JdbcQueryGenerator;
1.7 +import org.netbeans.modules.jdbcwizard.builder.util.XMLCharUtil;
1.8
1.9
1.10 public class WSDLGenerator {
1.11 @@ -117,7 +118,7 @@
1.12 private static final String PARAM_ORDER = "paramOrder";
1.13 private static final String JDBC_NAMESPACE = "http://schemas.sun.com/jbi/wsdl-extensions/jdbc/";
1.14
1.15 -
1.16 + private static final String SCHEMA_ELE="xsd:schema";
1.17 private static final String PRIMARYKEY_ATTR = "PKName";
1.18 private static final String TRANSACTION = "Transaction";
1.19 private static final String MARK_COLUMN_VALUE = "MarkColumnValue";
1.20 @@ -186,14 +187,14 @@
1.21 *
1.22 */
1.23 public void setTopEleName(){
1.24 - this.xsdTopEleName = "ns:" + this.mTable.getName();
1.25 + this.xsdTopEleName = "ns:" + XMLCharUtil.makeValidNCName(this.mTable.getName());
1.26 }
1.27 /**
1.28 *
1.29 *
1.30 */
1.31 public void setXSDName(){
1.32 - this.xsdName = this.mTable.getName() + WSDLGenerator.XSD_EXT;
1.33 + this.xsdName = XMLCharUtil.makeValidNCName(this.mTable.getName()) + WSDLGenerator.XSD_EXT;
1.34 }
1.35
1.36 public void setDBInfo(DBConnectionDefinition dbinfo){
1.37 @@ -267,13 +268,11 @@
1.38 private void modifyWSDL() throws WSDLException, Exception {
1.39 this.modifyName();
1.40 this.modifyTargetNamespace();
1.41 - this.modifyMessageTypes();
1.42 + this.modifySchEle();
1.43 + this.modiyMessageEles();
1.44 this.modifyBindings();
1.45 this.modifyServiceAndPortNames();
1.46 this.modifyJNDIAddress();
1.47 - //modifyPortTypes();
1.48 - //modifyServices();
1.49 - //modifyPartnerLink();
1.50 }
1.51 /**
1.52 * Modify the WSDL name
1.53 @@ -299,116 +298,71 @@
1.54 attr = rootEle.getAttributeNode(TNS_STRING);
1.55 attr.setNodeValue(TARGET_NS_PREFIX_STRING + this.mWSDLFileName);
1.56 }
1.57 +
1.58 /**
1.59 *
1.60 * @throws WSDLException
1.61 * @throws Exception
1.62 */
1.63 - private void modifyMessageTypes() throws WSDLException, Exception{
1.64 - try {
1.65 - final Types types = this.def.getTypes();
1.66 -
1.67 - if (null != types) {
1.68 - final List schemaList = types.getExtensibilityElements();
1.69 - for (final Iterator iterator1 = schemaList.iterator(); iterator1.hasNext();) {
1.70 - final Object o = iterator1.next();
1.71 - if (o instanceof Schema) {
1.72 - final Schema schemaType = (Schema) o;
1.73 - final Element schEle = schemaType.getElement();
1.74 - //Modify and rewrite the schema replacing default template schema
1.75 - this.refineSchema(schEle);
1.76 -
1.77 -
1.78 - } else if (o instanceof UnknownExtensibilityElement) {
1.79 - //
1.80 - }
1.81 - }
1.82 - }
1.83 -
1.84 - } catch (final Exception e) {
1.85 - throw new WSDLException(WSDLException.OTHER_ERROR, "Could not generate the WSDL");
1.86 - }
1.87 -
1.88 - }
1.89 - /**
1.90 - * Modifies the default template schema
1.91 - * @param schEle
1.92 - * @throws WSDLException
1.93 - */
1.94 - private void refineSchema(final Element schEle) throws WSDLException {
1.95 - try {
1.96 - Element remEle = null;
1.97 - final NodeList childNodes = schEle.getChildNodes();
1.98 - for (int i = 0; i < childNodes.getLength(); i++) {
1.99 - final Node child = childNodes.item(i);
1.100 - if (child instanceof Element) {
1.101 - remEle = (Element) child;
1.102 - break;
1.103 - }
1.104 + public void modifySchEle() throws WSDLException, Exception{
1.105 + Element rootEle = this.doc.getDocumentElement();
1.106 + Element scheEle = null;
1.107 + final NodeList childNodes = rootEle.getElementsByTagName(WSDLGenerator.SCHEMA_ELE);
1.108 + for (int i = 0; i < childNodes.getLength(); i++) {
1.109 + final Node child = childNodes.item(i);
1.110 + if (child instanceof Element) {
1.111 + scheEle = (Element) child;
1.112 + break;
1.113 }
1.114 - //modfiy the targetnamespace attribute of xsd:schema element. Set it to wsdlname
1.115 - Attr attr = schEle.getAttributeNode(TARGET_NS);
1.116 - attr.setNodeValue(TARGET_NS_PREFIX_STRING + this.mWSDLFileName);
1.117 - final Element importElem = this.doc.createElementNS(WSDLGenerator.XMLSCHEMA_NAMESPACE,
1.118 - WSDLGenerator.IMPORT_ELEMENT);
1.119 - importElem.setAttribute(WSDLGenerator.NAMESPACE_ATTR, WSDLGenerator.TARGETNAMESPACE);// get
1.120 - // the
1.121 - // xsd
1.122 - // targetnamespace
1.123 - importElem.setAttribute(WSDLGenerator.SCHEMALOCATION_ATTR, this.xsdName);// get
1.124 - // the
1.125 - // xsd name
1.126 - schEle.appendChild(importElem);
1.127 - schEle.removeChild(remEle);
1.128 -
1.129 - final Element rootEle = this.doc.getDocumentElement();
1.130 - // Change Input message
1.131 - final Element inputMsgEle = this.getElementByName(rootEle, WSDLGenerator.INPUTMESSAGE_NAME);
1.132 - final NodeList partNodes = inputMsgEle.getChildNodes();
1.133 - Element remPartEle = null;
1.134 - for (int i = 0; i < partNodes.getLength(); i++) {
1.135 - final Node child = partNodes.item(i);
1.136 - if (child instanceof Element) {
1.137 - remPartEle = (Element) child;
1.138 - break;
1.139 - }
1.140 + }
1.141 + //Change schema element targetnamespace
1.142 + Attr attr = scheEle.getAttributeNode(WSDLGenerator.TARGET_NS);
1.143 + attr.setNodeValue(WSDLGenerator.JDBC_NAMESPACE);
1.144 +
1.145 + Element importEle = null;
1.146 + final NodeList childNodesTmp = rootEle.getElementsByTagName(WSDLGenerator.IMPORT_ELEMENT);
1.147 + for (int i = 0; i < childNodesTmp.getLength(); i++) {
1.148 + final Node childTmp = childNodesTmp.item(i);
1.149 + if (childTmp instanceof Element) {
1.150 + importEle = (Element) childTmp;
1.151 + break;
1.152 }
1.153 - final Element addPartEle = this.doc.createElementNS(this.def.getTargetNamespace(),
1.154 - WSDLGenerator.PART_ELEMENT);
1.155 - addPartEle.setAttribute(WSDLGenerator.NAME_ATTR, WSDLGenerator.PART_ELEMENT);// get the xsd
1.156 - // targetnamespace
1.157 - addPartEle.setAttribute(WSDLGenerator.ELEMENT_ATTR, this.xsdTopEleName);// get the top
1.158 - // element Name
1.159 - inputMsgEle.appendChild(addPartEle);
1.160 - inputMsgEle.removeChild(remPartEle);
1.161 -
1.162 - // Change Output message
1.163 - final Element outputMsgEle = this.getElementByName(rootEle, WSDLGenerator.OUTPUTMESSAGE_NAME);
1.164 - final NodeList outPartNodes = outputMsgEle.getChildNodes();
1.165 - Element remOutPartEle = null;
1.166 - for (int i = 0; i < outPartNodes.getLength(); i++) {
1.167 - final Node child = outPartNodes.item(i);
1.168 - if (child instanceof Element) {
1.169 - remOutPartEle = (Element) child;
1.170 - break;
1.171 - }
1.172 + }
1.173 + //Change import element namespace and schemalocation
1.174 + Attr attrimp = importEle.getAttributeNode(WSDLGenerator.NAMESPACE_ATTR);
1.175 + attrimp.setNodeValue(WSDLGenerator.TARGETNAMESPACE);
1.176 + Attr schloc = importEle.getAttributeNode(WSDLGenerator.SCHEMALOCATION_ATTR);
1.177 + schloc.setNodeValue(this.xsdName);
1.178 + }
1.179 + public void modiyMessageEles()throws WSDLException, Exception{
1.180 + Element rootEle = this.doc.getDocumentElement();
1.181 + final Element inputMsgEle = this.getElementByName(rootEle, WSDLGenerator.INPUTMESSAGE_NAME);
1.182 + final NodeList partNodes = inputMsgEle.getChildNodes();
1.183 + Element partEle = null;
1.184 + for (int i = 0; i < partNodes.getLength(); i++) {
1.185 + final Node child = partNodes.item(i);
1.186 + if (child instanceof Element) {
1.187 + partEle = (Element) child;
1.188 + break;
1.189 }
1.190 - final Element addOutPartEle = this.doc.createElementNS(this.def
1.191 - .getTargetNamespace(), WSDLGenerator.PART_ELEMENT);
1.192 - addOutPartEle.setAttribute(WSDLGenerator.NAME_ATTR, WSDLGenerator.PART_ELEMENT);// get the xsd
1.193 - // targetnamespace
1.194 - addOutPartEle.setAttribute(WSDLGenerator.ELEMENT_ATTR, this.xsdTopEleName);// get the
1.195 - // xsd
1.196 - // name
1.197 - outputMsgEle.appendChild(addOutPartEle);
1.198 - outputMsgEle.removeChild(remOutPartEle);
1.199 -
1.200 - this.def = this.reader.readWSDL(this.wsdlFileLocation, rootEle);
1.201 - } catch (final Exception e) {
1.202 - throw new WSDLException(WSDLException.OTHER_ERROR,
1.203 - "Could not generate the WSDL");
1.204 }
1.205 - }
1.206 + Attr attrInput = partEle.getAttributeNode(WSDLGenerator.ELEMENT_ATTR);
1.207 + attrInput.setNodeValue(this.xsdTopEleName);
1.208 +
1.209 + Element partOutEle = null;
1.210 + final Element outputMsgEle = this.getElementByName(rootEle, WSDLGenerator.OUTPUTMESSAGE_NAME);
1.211 + final NodeList outPartNodes = outputMsgEle.getChildNodes();
1.212 + for (int i = 0; i < outPartNodes.getLength(); i++) {
1.213 + final Node child = outPartNodes.item(i);
1.214 + if (child instanceof Element) {
1.215 + partOutEle = (Element) child;
1.216 + break;
1.217 + }
1.218 + }
1.219 + Attr attroutput = partOutEle.getAttributeNode(WSDLGenerator.ELEMENT_ATTR);
1.220 + attroutput.setNodeValue(this.xsdTopEleName);
1.221 + this.def = this.reader.readWSDL(this.wsdlFileLocation, rootEle);
1.222 + }
1.223 /**
1.224 *
1.225 * @throws WSDLException
1.226 @@ -450,36 +404,60 @@
1.227 * @throws WSDLException
1.228 * @throws Exception
1.229 */
1.230 - public void modifyInsert(final DBQueryModel dao, final String query) throws WSDLException, Exception {
1.231 + public void modifyInsert(final DBQueryModel dao, final String query)
1.232 + throws WSDLException, Exception {
1.233 try {
1.234 String primaryKey = null;
1.235 final Element rootEle = this.doc.getDocumentElement();
1.236
1.237 - final Element insSqlEle = this.getElementBySQL(rootEle, WSDLGenerator.INSERT_QUERY);
1.238 - final Element insParentNode = (Element) insSqlEle.getParentNode();
1.239 + final Element insSqlEle = this.getElementBySQL(rootEle,
1.240 + WSDLGenerator.INSERT_QUERY);
1.241 primaryKey = dao.getPrimaryKey();
1.242
1.243 + Attr optType = insSqlEle
1.244 + .getAttributeNode(WSDLGenerator.OPERATION_TYPE);
1.245 + optType.setNodeValue("insert");
1.246
1.247 - // Create sql element to replace
1.248 - final Element sqlEle = this.doc.createElementNS(WSDLGenerator.JDBC_NAMESPACE,
1.249 - WSDLGenerator.JDBC_SQL_ELEMENT);
1.250 - sqlEle.setAttribute(WSDLGenerator.OPERATION_TYPE,"insert");
1.251 - sqlEle.setAttribute(WSDLGenerator.PARAM_ORDER, dao.getParamOrder(WSDLGenerator.INSERT_QUERY));
1.252 - sqlEle.setAttribute(WSDLGenerator.SQL_ELEMENT, query);
1.253 - sqlEle.setAttribute(WSDLGenerator.PRIMARYKEY_ATTR,primaryKey);
1.254 - sqlEle.setAttribute(WSDLGenerator.TRANSACTION,"NOTransaction");
1.255 - sqlEle.setAttribute(WSDLGenerator.TABLE_NAME,this.mTableName);
1.256 -
1.257 - sqlEle.setAttribute(WSDLGenerator.NUMNBER_OF_RECORDS,"");
1.258 - sqlEle.setAttribute(WSDLGenerator.MARK_COLUMN_VALUE,"");
1.259 - sqlEle.setAttribute(WSDLGenerator.MOVEROW_TABLE_NAME,"");
1.260 - sqlEle.setAttribute(WSDLGenerator.MARK_COLUMN_NAME,"");
1.261 - sqlEle.setAttribute(WSDLGenerator.POLLMILLI_SECONDS,"5000");
1.262 + Attr attrParamOrder = insSqlEle
1.263 + .getAttributeNode(WSDLGenerator.PARAM_ORDER);
1.264 + attrParamOrder.setNodeValue(dao
1.265 + .getParamOrder(WSDLGenerator.INSERT_QUERY));
1.266
1.267 - insParentNode.appendChild(sqlEle);
1.268 - insParentNode.removeChild(insSqlEle);
1.269 - // Change WSDL template with generated queries
1.270 - this.def = this.reader.readWSDL(this.wsdlFileLocation, rootEle);
1.271 + Attr attrSqlEle = insSqlEle
1.272 + .getAttributeNode(WSDLGenerator.SQL_ELEMENT);
1.273 + attrSqlEle.setNodeValue(query);
1.274 +
1.275 + Attr attrPrmKey = insSqlEle
1.276 + .getAttributeNode(WSDLGenerator.PRIMARYKEY_ATTR);
1.277 + attrPrmKey.setNodeValue(primaryKey);
1.278 +
1.279 + Attr attrTrans = insSqlEle
1.280 + .getAttributeNode(WSDLGenerator.TRANSACTION);
1.281 + attrTrans.setNodeValue("NOTransaction");
1.282 +
1.283 + Attr attrTableName = insSqlEle
1.284 + .getAttributeNode(WSDLGenerator.TABLE_NAME);
1.285 + attrTableName.setNodeValue(this.mTableName);
1.286 +
1.287 + Attr attrNumOfRecs = insSqlEle
1.288 + .getAttributeNode(WSDLGenerator.NUMNBER_OF_RECORDS);
1.289 + attrNumOfRecs.setNodeValue("");
1.290 +
1.291 + Attr attrMarkColVal = insSqlEle
1.292 + .getAttributeNode(WSDLGenerator.MARK_COLUMN_VALUE);
1.293 + attrMarkColVal.setNodeValue("");
1.294 +
1.295 + Attr attrMovRowname = insSqlEle
1.296 + .getAttributeNode(WSDLGenerator.MOVEROW_TABLE_NAME);
1.297 + attrMovRowname.setNodeValue("");
1.298 +
1.299 + Attr attrMarkColName = insSqlEle
1.300 + .getAttributeNode(WSDLGenerator.MARK_COLUMN_NAME);
1.301 + attrMarkColName.setNodeValue("");
1.302 +
1.303 + Attr attrPollMilli = insSqlEle
1.304 + .getAttributeNode(WSDLGenerator.POLLMILLI_SECONDS);
1.305 + attrPollMilli.setNodeValue("5000");
1.306 } catch (final Exception e) {
1.307 throw new WSDLException(WSDLException.OTHER_ERROR,
1.308 "Could not generate the WSDL");
1.309 @@ -498,30 +476,51 @@
1.310 final Element rootEle = this.doc.getDocumentElement();
1.311
1.312 final Element updateSqlEle = this.getElementBySQL(rootEle, WSDLGenerator.UPDATE_QUERY);
1.313 - final Element insParentNode = (Element) updateSqlEle.getParentNode();
1.314 primaryKey = dao.getPrimaryKey();
1.315 +
1.316 + Attr optType = updateSqlEle
1.317 + .getAttributeNode(WSDLGenerator.OPERATION_TYPE);
1.318 + optType.setNodeValue("update");
1.319 +
1.320 + Attr attrParamOrder = updateSqlEle
1.321 + .getAttributeNode(WSDLGenerator.PARAM_ORDER);
1.322 + attrParamOrder.setNodeValue(dao.getParamOrder(WSDLGenerator.UPDATE_QUERY));
1.323
1.324 -
1.325 - // Create sql element to replace
1.326 - final Element sqlEle = this.doc.createElementNS(WSDLGenerator.JDBC_NAMESPACE,
1.327 - WSDLGenerator.JDBC_SQL_ELEMENT);
1.328 - sqlEle.setAttribute(WSDLGenerator.OPERATION_TYPE,"update");
1.329 - sqlEle.setAttribute(WSDLGenerator.PARAM_ORDER, dao.getParamOrder(WSDLGenerator.UPDATE_QUERY));
1.330 - sqlEle.setAttribute(WSDLGenerator.SQL_ELEMENT, query);
1.331 - sqlEle.setAttribute(WSDLGenerator.PRIMARYKEY_ATTR, primaryKey);
1.332 - sqlEle.setAttribute(WSDLGenerator.TRANSACTION,"NOTransaction");
1.333 - sqlEle.setAttribute(WSDLGenerator.TABLE_NAME,this.mTableName);
1.334 -
1.335 - sqlEle.setAttribute(WSDLGenerator.NUMNBER_OF_RECORDS,"");
1.336 - sqlEle.setAttribute(WSDLGenerator.MARK_COLUMN_VALUE,"");
1.337 - sqlEle.setAttribute(WSDLGenerator.MOVEROW_TABLE_NAME,"");
1.338 - sqlEle.setAttribute(WSDLGenerator.MARK_COLUMN_NAME,"");
1.339 - sqlEle.setAttribute(WSDLGenerator.POLLMILLI_SECONDS,"5000");
1.340 -
1.341 - insParentNode.appendChild(sqlEle);
1.342 - insParentNode.removeChild(updateSqlEle);
1.343 - // Change WSDL template with generated queries
1.344 - this.def = this.reader.readWSDL(this.wsdlFileLocation, rootEle);
1.345 + Attr attrSqlEle = updateSqlEle
1.346 + .getAttributeNode(WSDLGenerator.SQL_ELEMENT);
1.347 + attrSqlEle.setNodeValue(query);
1.348 +
1.349 + Attr attrPrmKey = updateSqlEle
1.350 + .getAttributeNode(WSDLGenerator.PRIMARYKEY_ATTR);
1.351 + attrPrmKey.setNodeValue(primaryKey);
1.352 +
1.353 + Attr attrTrans = updateSqlEle
1.354 + .getAttributeNode(WSDLGenerator.TRANSACTION);
1.355 + attrTrans.setNodeValue("NOTransaction");
1.356 +
1.357 + Attr attrTableName = updateSqlEle
1.358 + .getAttributeNode(WSDLGenerator.TABLE_NAME);
1.359 + attrTableName.setNodeValue(this.mTableName);
1.360 +
1.361 + Attr attrNumOfRecs = updateSqlEle
1.362 + .getAttributeNode(WSDLGenerator.NUMNBER_OF_RECORDS);
1.363 + attrNumOfRecs.setNodeValue("");
1.364 +
1.365 + Attr attrMarkColVal = updateSqlEle
1.366 + .getAttributeNode(WSDLGenerator.MARK_COLUMN_VALUE);
1.367 + attrMarkColVal.setNodeValue("");
1.368 +
1.369 + Attr attrMovRowname = updateSqlEle
1.370 + .getAttributeNode(WSDLGenerator.MOVEROW_TABLE_NAME);
1.371 + attrMovRowname.setNodeValue("");
1.372 +
1.373 + Attr attrMarkColName = updateSqlEle
1.374 + .getAttributeNode(WSDLGenerator.MARK_COLUMN_NAME);
1.375 + attrMarkColName.setNodeValue("");
1.376 +
1.377 + Attr attrPollMilli = updateSqlEle
1.378 + .getAttributeNode(WSDLGenerator.POLLMILLI_SECONDS);
1.379 + attrPollMilli.setNodeValue("5000");
1.380 } catch (final Exception e) {
1.381 throw new WSDLException(WSDLException.OTHER_ERROR,
1.382 "Could not generate the WSDL");
1.383 @@ -540,29 +539,51 @@
1.384 final Element rootEle = this.doc.getDocumentElement();
1.385
1.386 final Element delSqlEle = this.getElementBySQL(rootEle, WSDLGenerator.DELETE_QUERY);
1.387 - final Element insParentNode = (Element) delSqlEle.getParentNode();
1.388 primaryKey = dao.getPrimaryKey();
1.389 -
1.390 - // Create sql element to replace
1.391 - final Element sqlEle = this.doc.createElementNS(WSDLGenerator.JDBC_NAMESPACE,
1.392 - WSDLGenerator.JDBC_SQL_ELEMENT);
1.393 - sqlEle.setAttribute(WSDLGenerator.OPERATION_TYPE,"delete");
1.394 - sqlEle.setAttribute(WSDLGenerator.PARAM_ORDER, "");
1.395 - sqlEle.setAttribute(WSDLGenerator.SQL_ELEMENT, query);
1.396 - sqlEle.setAttribute(WSDLGenerator.PRIMARYKEY_ATTR, primaryKey);
1.397 - sqlEle.setAttribute(WSDLGenerator.TRANSACTION,"NOTransaction");
1.398 - sqlEle.setAttribute(WSDLGenerator.TABLE_NAME,this.mTableName);
1.399
1.400 - sqlEle.setAttribute(WSDLGenerator.NUMNBER_OF_RECORDS,"");
1.401 - sqlEle.setAttribute(WSDLGenerator.MARK_COLUMN_VALUE,"");
1.402 - sqlEle.setAttribute(WSDLGenerator.MOVEROW_TABLE_NAME,"");
1.403 - sqlEle.setAttribute(WSDLGenerator.MARK_COLUMN_NAME,"");
1.404 - sqlEle.setAttribute(WSDLGenerator.POLLMILLI_SECONDS,"5000");
1.405 + Attr optType = delSqlEle
1.406 + .getAttributeNode(WSDLGenerator.OPERATION_TYPE);
1.407 + optType.setNodeValue("delete");
1.408 +
1.409 + Attr attrParamOrder = delSqlEle
1.410 + .getAttributeNode(WSDLGenerator.PARAM_ORDER);
1.411 + attrParamOrder.setNodeValue(dao.getParamOrder(WSDLGenerator.UPDATE_QUERY));
1.412
1.413 - insParentNode.appendChild(sqlEle);
1.414 - insParentNode.removeChild(delSqlEle);
1.415 - // Change WSDL template with generated queries
1.416 - this.def = this.reader.readWSDL(this.wsdlFileLocation, rootEle);
1.417 + Attr attrSqlEle = delSqlEle
1.418 + .getAttributeNode(WSDLGenerator.SQL_ELEMENT);
1.419 + attrSqlEle.setNodeValue(query);
1.420 +
1.421 + Attr attrPrmKey = delSqlEle
1.422 + .getAttributeNode(WSDLGenerator.PRIMARYKEY_ATTR);
1.423 + attrPrmKey.setNodeValue(primaryKey);
1.424 +
1.425 + Attr attrTrans = delSqlEle
1.426 + .getAttributeNode(WSDLGenerator.TRANSACTION);
1.427 + attrTrans.setNodeValue("NOTransaction");
1.428 +
1.429 + Attr attrTableName = delSqlEle
1.430 + .getAttributeNode(WSDLGenerator.TABLE_NAME);
1.431 + attrTableName.setNodeValue(this.mTableName);
1.432 +
1.433 + Attr attrNumOfRecs = delSqlEle
1.434 + .getAttributeNode(WSDLGenerator.NUMNBER_OF_RECORDS);
1.435 + attrNumOfRecs.setNodeValue("");
1.436 +
1.437 + Attr attrMarkColVal = delSqlEle
1.438 + .getAttributeNode(WSDLGenerator.MARK_COLUMN_VALUE);
1.439 + attrMarkColVal.setNodeValue("");
1.440 +
1.441 + Attr attrMovRowname = delSqlEle
1.442 + .getAttributeNode(WSDLGenerator.MOVEROW_TABLE_NAME);
1.443 + attrMovRowname.setNodeValue("");
1.444 +
1.445 + Attr attrMarkColName = delSqlEle
1.446 + .getAttributeNode(WSDLGenerator.MARK_COLUMN_NAME);
1.447 + attrMarkColName.setNodeValue("");
1.448 +
1.449 + Attr attrPollMilli = delSqlEle
1.450 + .getAttributeNode(WSDLGenerator.POLLMILLI_SECONDS);
1.451 + attrPollMilli.setNodeValue("5000");
1.452 } catch (final Exception e) {
1.453 throw new WSDLException(WSDLException.OTHER_ERROR,
1.454 "Could not generate the WSDL");
1.455 @@ -580,29 +601,51 @@
1.456 String primaryKey = null;
1.457 final Element rootEle = this.doc.getDocumentElement();
1.458 final Element findSqlEle = this.getElementBySQL(rootEle, WSDLGenerator.FIND_QUERY);
1.459 - final Element insParentNode = (Element) findSqlEle.getParentNode();
1.460 primaryKey = dao.getPrimaryKey();
1.461
1.462 - // Create sql element to replace
1.463 - final Element sqlEle = this.doc.createElementNS(WSDLGenerator.JDBC_NAMESPACE,
1.464 - WSDLGenerator.JDBC_SQL_ELEMENT);
1.465 - sqlEle.setAttribute(WSDLGenerator.OPERATION_TYPE,"find");
1.466 - sqlEle.setAttribute(WSDLGenerator.PARAM_ORDER, "");
1.467 - sqlEle.setAttribute(WSDLGenerator.SQL_ELEMENT, query);
1.468 - sqlEle.setAttribute(WSDLGenerator.PRIMARYKEY_ATTR,primaryKey);
1.469 - sqlEle.setAttribute(WSDLGenerator.TRANSACTION,"NOTransaction");
1.470 - sqlEle.setAttribute(WSDLGenerator.TABLE_NAME,this.mTableName);
1.471 -
1.472 - sqlEle.setAttribute(WSDLGenerator.NUMNBER_OF_RECORDS,"");
1.473 - sqlEle.setAttribute(WSDLGenerator.MARK_COLUMN_VALUE,"");
1.474 - sqlEle.setAttribute(WSDLGenerator.MOVEROW_TABLE_NAME,"");
1.475 - sqlEle.setAttribute(WSDLGenerator.MARK_COLUMN_NAME,"");
1.476 - sqlEle.setAttribute(WSDLGenerator.POLLMILLI_SECONDS,"5000");
1.477 + Attr optType = findSqlEle
1.478 + .getAttributeNode(WSDLGenerator.OPERATION_TYPE);
1.479 + optType.setNodeValue("find");
1.480 +
1.481 + Attr attrParamOrder = findSqlEle
1.482 + .getAttributeNode(WSDLGenerator.PARAM_ORDER);
1.483 + attrParamOrder.setNodeValue("");
1.484
1.485 - insParentNode.appendChild(sqlEle);
1.486 - insParentNode.removeChild(findSqlEle);
1.487 - // Change WSDL template with generated queries
1.488 - this.def = this.reader.readWSDL(this.wsdlFileLocation, rootEle);
1.489 + Attr attrSqlEle = findSqlEle
1.490 + .getAttributeNode(WSDLGenerator.SQL_ELEMENT);
1.491 + attrSqlEle.setNodeValue(query);
1.492 +
1.493 + Attr attrPrmKey = findSqlEle
1.494 + .getAttributeNode(WSDLGenerator.PRIMARYKEY_ATTR);
1.495 + attrPrmKey.setNodeValue(primaryKey);
1.496 +
1.497 + Attr attrTrans = findSqlEle
1.498 + .getAttributeNode(WSDLGenerator.TRANSACTION);
1.499 + attrTrans.setNodeValue("NOTransaction");
1.500 +
1.501 + Attr attrTableName = findSqlEle
1.502 + .getAttributeNode(WSDLGenerator.TABLE_NAME);
1.503 + attrTableName.setNodeValue(this.mTableName);
1.504 +
1.505 + Attr attrNumOfRecs = findSqlEle
1.506 + .getAttributeNode(WSDLGenerator.NUMNBER_OF_RECORDS);
1.507 + attrNumOfRecs.setNodeValue("");
1.508 +
1.509 + Attr attrMarkColVal = findSqlEle
1.510 + .getAttributeNode(WSDLGenerator.MARK_COLUMN_VALUE);
1.511 + attrMarkColVal.setNodeValue("");
1.512 +
1.513 + Attr attrMovRowname = findSqlEle
1.514 + .getAttributeNode(WSDLGenerator.MOVEROW_TABLE_NAME);
1.515 + attrMovRowname.setNodeValue("");
1.516 +
1.517 + Attr attrMarkColName = findSqlEle
1.518 + .getAttributeNode(WSDLGenerator.MARK_COLUMN_NAME);
1.519 + attrMarkColName.setNodeValue("");
1.520 +
1.521 + Attr attrPollMilli = findSqlEle
1.522 + .getAttributeNode(WSDLGenerator.POLLMILLI_SECONDS);
1.523 + attrPollMilli.setNodeValue("5000");
1.524 } catch (final Exception e) {
1.525 throw new WSDLException(WSDLException.OTHER_ERROR,
1.526 "Could not generate the WSDL");
1.527 @@ -620,30 +663,57 @@
1.528 final Element rootEle = this.doc.getDocumentElement();
1.529 String primaryKey = null;
1.530 final Element poolSqlEle = this.getElementBySQL(rootEle, WSDLGenerator.POLL_QUERY);
1.531 - final Element insParentNode = (Element) poolSqlEle.getParentNode();
1.532 -
1.533 +
1.534 // Create sql element to replace
1.535 primaryKey = dao.getPrimaryKey();
1.536 - final Element sqlEle = this.doc.createElementNS(WSDLGenerator.JDBC_NAMESPACE,
1.537 - WSDLGenerator.JDBC_SQL_ELEMENT);
1.538 - sqlEle.setAttribute(WSDLGenerator.OPERATION_TYPE,"poll");
1.539 - sqlEle.setAttribute(WSDLGenerator.NUMNBER_OF_RECORDS,"");
1.540 - sqlEle.setAttribute(WSDLGenerator.PARAM_ORDER, "");
1.541 - sqlEle.setAttribute(WSDLGenerator.SQL_ELEMENT, query);
1.542 - sqlEle.setAttribute(WSDLGenerator.PRIMARYKEY_ATTR, primaryKey);
1.543 - sqlEle.setAttribute(WSDLGenerator.TRANSACTION,"NOTransaction");
1.544 - sqlEle.setAttribute(WSDLGenerator.MARK_COLUMN_VALUE,"");
1.545 - sqlEle.setAttribute(WSDLGenerator.MARK_COLUMN_NAME,"");
1.546 - sqlEle.setAttribute(WSDLGenerator.POLL_POST_PROCESS,"Delete");
1.547 - sqlEle.setAttribute(WSDLGenerator.TABLE_NAME,this.mTableName);
1.548 - sqlEle.setAttribute(WSDLGenerator.MOVEROW_TABLE_NAME,"");
1.549 - sqlEle.setAttribute(WSDLGenerator.POLLMILLI_SECONDS,"5000");
1.550 +
1.551 + Attr optType = poolSqlEle
1.552 + .getAttributeNode(WSDLGenerator.OPERATION_TYPE);
1.553 + optType.setNodeValue("poll");
1.554 +
1.555 + Attr attrParamOrder = poolSqlEle
1.556 + .getAttributeNode(WSDLGenerator.PARAM_ORDER);
1.557 + attrParamOrder.setNodeValue("");
1.558
1.559 - //sqlEle.setAttribute(FLAGCOL_ATTR, "");
1.560 - insParentNode.appendChild(sqlEle);
1.561 - insParentNode.removeChild(poolSqlEle);
1.562 - // Change WSDL template with generated queries
1.563 - this.def = this.reader.readWSDL(this.wsdlFileLocation, rootEle);
1.564 + Attr attrSqlEle = poolSqlEle
1.565 + .getAttributeNode(WSDLGenerator.SQL_ELEMENT);
1.566 + attrSqlEle.setNodeValue(query);
1.567 +
1.568 + Attr attrPrmKey = poolSqlEle
1.569 + .getAttributeNode(WSDLGenerator.PRIMARYKEY_ATTR);
1.570 + attrPrmKey.setNodeValue(primaryKey);
1.571 +
1.572 + Attr attrTrans = poolSqlEle
1.573 + .getAttributeNode(WSDLGenerator.TRANSACTION);
1.574 + attrTrans.setNodeValue("NOTransaction");
1.575 +
1.576 + Attr attrTableName = poolSqlEle
1.577 + .getAttributeNode(WSDLGenerator.TABLE_NAME);
1.578 + attrTableName.setNodeValue(this.mTableName);
1.579 +
1.580 + Attr attrNumOfRecs = poolSqlEle
1.581 + .getAttributeNode(WSDLGenerator.NUMNBER_OF_RECORDS);
1.582 + attrNumOfRecs.setNodeValue("");
1.583 +
1.584 + Attr attrMarkColVal = poolSqlEle
1.585 + .getAttributeNode(WSDLGenerator.MARK_COLUMN_VALUE);
1.586 + attrMarkColVal.setNodeValue("");
1.587 +
1.588 + Attr attrMovRowname = poolSqlEle
1.589 + .getAttributeNode(WSDLGenerator.MOVEROW_TABLE_NAME);
1.590 + attrMovRowname.setNodeValue("");
1.591 +
1.592 + Attr attrMarkColName = poolSqlEle
1.593 + .getAttributeNode(WSDLGenerator.MARK_COLUMN_NAME);
1.594 + attrMarkColName.setNodeValue("");
1.595 +
1.596 + Attr attrPollPost = poolSqlEle.getAttributeNode(WSDLGenerator.POLL_POST_PROCESS);
1.597 + attrPollPost.setNodeValue("Delete");
1.598 +
1.599 + Attr attrPollMilli = poolSqlEle
1.600 + .getAttributeNode(WSDLGenerator.POLLMILLI_SECONDS);
1.601 + attrPollMilli.setNodeValue("5000");
1.602 +
1.603 } catch (final Exception e) {
1.604 throw new WSDLException(WSDLException.OTHER_ERROR,
1.605 "Could not generate the WSDL");
1.606 @@ -657,30 +727,29 @@
1.607 public void modifyServiceAndPortNames() throws WSDLException, Exception {
1.608 try {
1.609 final Element rootEle = this.doc.getDocumentElement();
1.610 - //final String projectName = getProjectName(this.wsdlFileLocation);
1.611 final NodeList list = rootEle.getChildNodes();
1.612 for (int i = 0; i < list.getLength(); i++) {
1.613 final Node n = list.item(i);
1.614 if (n.getNodeType() == Node.ELEMENT_NODE) {
1.615 - if (n.getLocalName().equalsIgnoreCase(SERVICE_NAME)) {
1.616 + if (n.getLocalName().equalsIgnoreCase(WSDLGenerator.SERVICE_NAME)) {
1.617 Element serEle = (Element) n;
1.618 - serEle.removeAttribute("name");
1.619 - serEle.setAttribute("name", this.mWSDLFileName + SERVICE_NAME);
1.620 + Attr attrSer = serEle.getAttributeNode("name");
1.621 + attrSer.setNodeValue(this.mWSDLFileName + WSDLGenerator.SERVICE_NAME);
1.622 +
1.623 final NodeList childList = n.getChildNodes();
1.624 for (int j = 0; j < childList.getLength(); j++) {
1.625 final Node childNode = childList.item(j);
1.626 if (childNode.getNodeType() == Node.ELEMENT_NODE) {
1.627 if (childNode.getLocalName().equalsIgnoreCase(PORT_NAME)) {
1.628 Element portEle = (Element) childNode;
1.629 - portEle.removeAttribute("name");
1.630 - portEle.setAttribute("name", this.mWSDLFileName + PORT_NAME);
1.631 + Attr attrPort = portEle.getAttributeNode("name");
1.632 + attrPort.setNodeValue(this.mWSDLFileName + WSDLGenerator.PORT_NAME);
1.633 }
1.634 }
1.635 }
1.636 }
1.637 }
1.638 }
1.639 - this.def = this.reader.readWSDL(this.wsdlFileLocation, rootEle);
1.640 } catch (final Exception e) {
1.641 throw new WSDLException(WSDLException.OTHER_ERROR, "Could not generate the WSDL");
1.642 }
1.643 @@ -694,42 +763,17 @@
1.644 public void modifyJNDIAddress() throws WSDLException, Exception {
1.645 try {
1.646 final Element rootEle = this.doc.getDocumentElement();
1.647 - final Element jndiRemEle = this.getElementByAddress(rootEle, WSDLGenerator.JNDI_NAME);
1.648 - final Element jndiParentNode = (Element) jndiRemEle.getParentNode();
1.649 -
1.650 - final Element jndiEle = this.doc.createElementNS(WSDLGenerator.JDBC_NAMESPACE,
1.651 - WSDLGenerator.JNDI_ADD_ELE);
1.652 - jndiEle.setAttribute("jndiName", this.mJNDIName);
1.653 - // commenting out the attribute creation which is required to create data source
1.654 - // at runtime
1.655 - /*jndiEle.setAttribute("dbURL", this.dbinfo.getConnectionURL());
1.656 - jndiEle.setAttribute("driverClassName", this.dbinfo.getDriverClass());
1.657 - jndiEle.setAttribute("userName", this.dbinfo.getUserName());
1.658 - jndiEle.setAttribute("password", this.dbinfo.getPassword());
1.659 - */
1.660 - jndiParentNode.appendChild(jndiEle);
1.661 - jndiParentNode.removeChild(jndiRemEle);
1.662 - // Change WSDL template with generated queries
1.663 - this.def = this.reader.readWSDL(this.wsdlFileLocation, rootEle);
1.664 + final Element jndiEle = this.getElementByAddress(rootEle, WSDLGenerator.JNDI_NAME);
1.665 +
1.666 + Attr attrJndi = jndiEle.getAttributeNode("jndiName");
1.667 + attrJndi.setNodeValue(this.mJNDIName);
1.668 } catch (final Exception e) {
1.669 throw new WSDLException(WSDLException.OTHER_ERROR,
1.670 "Could not generate the WSDL");
1.671 }
1.672 }
1.673
1.674 - /**
1.675 - * get the project name from the wsdl file location
1.676 - * @param wsdlLocation
1.677 - * @return
1.678 - */
1.679 - private String getProjectName(String wsdlLocation) {
1.680 - String projName = "";
1.681 - if(wsdlLocation != null && !wsdlLocation.equals("")){
1.682 - projName = wsdlLocation.substring (0 , wsdlLocation.lastIndexOf(File.separator));
1.683 - projName = projName.substring(projName.lastIndexOf(File.separator)+1 , projName.length());
1.684 - }
1.685 - return projName;
1.686 - }
1.687 +
1.688 /**
1.689 *
1.690 * @return
1.691 @@ -759,34 +803,34 @@
1.692 * @param elementName
1.693 * @return
1.694 */
1.695 - private Element getElementByName(final Element e, final String elementName) {
1.696 - if (e.getAttribute("name").equalsIgnoreCase(elementName)) {
1.697 - return e;
1.698 - }
1.699 - final NodeList list = e.getChildNodes();
1.700 - Element el = null;
1.701 - Element e2 = null;
1.702 - for (int i = 0; i < list.getLength(); i++) {
1.703 - if (e2 == null) {
1.704 - final Node n = list.item(i);
1.705 - if (n.getNodeType() == Node.ELEMENT_NODE) {
1.706 - el = (Element) n;
1.707 - if (el.getAttribute("name").equalsIgnoreCase(elementName)) {
1.708 - e2 = el;
1.709 - break;
1.710 - } else {
1.711 - e2 = this.getElementByName(el, elementName);
1.712 - if (e2 != null && e2.getAttribute("name").equalsIgnoreCase(elementName)) {
1.713 - return e2;
1.714 - }
1.715 - }
1.716 - }
1.717 - } else {
1.718 - break;
1.719 - }
1.720 - }
1.721 - return e2;
1.722 - }
1.723 + private Element getElementByName(final Element e, final String elementName) {
1.724 + if (e.getAttribute("name").equalsIgnoreCase(elementName)) {
1.725 + return e;
1.726 + }
1.727 + final NodeList list = e.getChildNodes();
1.728 + Element el = null;
1.729 + Element e2 = null;
1.730 + for (int i = 0; i < list.getLength(); i++) {
1.731 + if (e2 == null) {
1.732 + final Node n = list.item(i);
1.733 + if (n.getNodeType() == Node.ELEMENT_NODE) {
1.734 + el = (Element) n;
1.735 + if (el.getAttribute("name").equalsIgnoreCase(elementName)) {
1.736 + e2 = el;
1.737 + break;
1.738 + } else {
1.739 + e2 = this.getElementByName(el, elementName);
1.740 + if (e2 != null && e2.getAttribute("name").equalsIgnoreCase(elementName)) {
1.741 + return e2;
1.742 + }
1.743 + }
1.744 + }
1.745 + } else {
1.746 + break;
1.747 + }
1.748 + }
1.749 + return e2;
1.750 + }
1.751 /**
1.752 *
1.753 * @param e
2.1 --- a/sql.wizard/src/org/netbeans/modules/jdbcwizard/builder/wsdl/jdbc.wsdl.template Tue Apr 03 01:04:26 2007 +0000
2.2 +++ b/sql.wizard/src/org/netbeans/modules/jdbcwizard/builder/wsdl/jdbc.wsdl.template Tue Apr 03 06:48:59 2007 +0000
2.3 @@ -45,7 +45,7 @@
2.4 <operation name="insert">
2.5 <jdbc:operation/>
2.6 <input name="inputInsert">
2.7 - <jdbc:input operationType="insert" numberOfRecords="1" paramOrder="specify param order" sql="insertQuery" PKName="testID" Transaction="XATransaction" MarkColumnValue="2" PollingPostProcessing="MoveRow" TableName="APP.TestOutbound" MarkColumnName="testFlag" MoveRowToTableName="TestTable"/>
2.8 + <jdbc:input operationType="insert" numberOfRecords="1" paramOrder="specify param order" sql="insertQuery" PKName="testID" PollMilliSeconds="" Transaction="XATransaction" MarkColumnValue="2" PollingPostProcessing="MoveRow" TableName="APP.TestOutbound" MarkColumnName="testFlag" MoveRowToTableName="TestTable"/>
2.9 </input>
2.10 <output name="outputInsert">
2.11 <jdbc:output returnPartName="part"/>
2.12 @@ -54,19 +54,19 @@
2.13 <operation name="update">
2.14 <jdbc:operation/>
2.15 <input name="inputUpdate">
2.16 - <jdbc:input operationType="update" numberOfRecords="1" paramOrder="specify param order" sql="updateQuery" PKName="testID" Transaction="XATransaction" MarkColumnValue="2" PollingPostProcessing="MoveRow" TableName="APP.TestOutbound" MarkColumnName="testFlag" MoveRowToTableName="TestTable"/>
2.17 + <jdbc:input operationType="update" numberOfRecords="1" paramOrder="specify param order" sql="updateQuery" PKName="testID" PollMilliSeconds="" Transaction="XATransaction" MarkColumnValue="2" PollingPostProcessing="MoveRow" TableName="APP.TestOutbound" MarkColumnName="testFlag" MoveRowToTableName="TestTable"/>
2.18 </input>
2.19 </operation>
2.20 <operation name="delete">
2.21 <jdbc:operation/>
2.22 <input name="inputDelete">
2.23 - <jdbc:input operationType="delete" numberOfRecords="1" paramOrder="specify param order" sql="deleteQuery" PKName="testID" Transaction="XATransaction" MarkColumnValue="2" PollingPostProcessing="MoveRow" TableName="APP.TestOutbound" MarkColumnName="testFlag" MoveRowToTableName="TestTable"/>
2.24 + <jdbc:input operationType="delete" numberOfRecords="1" paramOrder="specify param order" sql="deleteQuery" PKName="testID" PollMilliSeconds="" Transaction="XATransaction" MarkColumnValue="2" PollingPostProcessing="MoveRow" TableName="APP.TestOutbound" MarkColumnName="testFlag" MoveRowToTableName="TestTable"/>
2.25 </input>
2.26 </operation>
2.27 <operation name="find">
2.28 <jdbc:operation/>
2.29 <input name="inputFind">
2.30 - <jdbc:input operationType="find" numberOfRecords="1" paramOrder="specify param order" sql="findQuery" PKName="testID" Transaction="XATransaction" MarkColumnValue="2" PollingPostProcessing="MoveRow" TableName="APP.TestOutbound" MarkColumnName="testFlag" MoveRowToTableName="TestTable"/>
2.31 + <jdbc:input operationType="find" numberOfRecords="1" paramOrder="specify param order" sql="findQuery" PKName="testID" PollMilliSeconds="" Transaction="XATransaction" MarkColumnValue="2" PollingPostProcessing="MoveRow" TableName="APP.TestOutbound" MarkColumnName="testFlag" MoveRowToTableName="TestTable"/>
2.32 </input>
2.33 <output name="outputFind">
2.34 <jdbc:output returnPartName="part"/>
2.35 @@ -75,7 +75,7 @@
2.36 <operation name="pollrecords">
2.37 <jdbc:operation/>
2.38 <input name="inputPoll">
2.39 - <jdbc:input operationType="poll" numberOfRecords="1" paramOrder="specify param order" sql="pollQuery" PKName="testID" Transaction="XATransaction" MarkColumnValue="2" PollingPostProcessing="MoveRow" TableName="APP.TestOutbound" MarkColumnName="testFlag" MoveRowToTableName="TestTable"/>
2.40 + <jdbc:input operationType="poll" numberOfRecords="1" paramOrder="specify param order" sql="pollQuery" PKName="testID" PollMilliSeconds="5000" Transaction="XATransaction" MarkColumnValue="2" PollingPostProcessing="MoveRow" TableName="APP.TestOutbound" MarkColumnName="testFlag" MoveRowToTableName="TestTable"/>
2.41 </input>
2.42 </operation>
2.43 </binding>
3.1 --- a/sql.wizard/src/org/netbeans/modules/jdbcwizard/builder/xsd/XSDGenerator.java Tue Apr 03 01:04:26 2007 +0000
3.2 +++ b/sql.wizard/src/org/netbeans/modules/jdbcwizard/builder/xsd/XSDGenerator.java Tue Apr 03 06:48:59 2007 +0000
3.3 @@ -40,6 +40,7 @@
3.4 import org.netbeans.modules.jdbcwizard.builder.dbmodel.DBColumn;
3.5 import org.netbeans.modules.jdbcwizard.builder.dbmodel.DBTable;
3.6 import org.netbeans.modules.jdbcwizard.builder.dbmodel.impl.DBColumnImpl;
3.7 +import org.netbeans.modules.jdbcwizard.builder.util.XMLCharUtil;
3.8
3.9 import java.io.PrintWriter;
3.10 import java.io.File;
3.11 @@ -123,7 +124,7 @@
3.12
3.13 public void generateSimpleXsd() throws Exception {
3.14 this.generateXSDHeaders();
3.15 - final Element aNode = this.addElementNode(this.ltbl.getName());
3.16 + final Element aNode = this.addElementNode( XMLCharUtil.makeValidNCName(this.ltbl.getName()));
3.17 this.mCurrentNode = aNode;
3.18 this.createComplexTypesForTables(this.ltbl);
3.19 this.serialize(this.mFileName);
3.20 @@ -132,7 +133,7 @@
3.21 public void generateRepeatXsd() throws Exception {
3.22 this.generateXSDHeaders();
3.23
3.24 - final String tableName = this.ltbl.getName();
3.25 + final String tableName = XMLCharUtil.makeValidNCName( this.ltbl.getName());
3.26 final String complexTypeName = tableName + "List";
3.27 final Element aNode = this.addElementNode(tableName + "_List", complexTypeName);
3.28 this.createComplexTypeRepeatElement(complexTypeName, tableName);
3.29 @@ -172,7 +173,7 @@
3.30 private void createComplexTypesForTables(final DBTable aTable) throws Exception {
3.31 final List cols = aTable.getColumnList();
3.32 Element aNode = null;
3.33 - final String tableName = aTable.getName();
3.34 + final String tableName = XMLCharUtil.makeValidNCName(aTable.getName());
3.35
3.36 aNode = this.mDoc.createElement(XSDGenerator.XSD_PREFIX + XSDGenerator.XSD_COMPLEX_TYPE);
3.37 aNode.setAttribute(XSDGenerator.NAME_ATTR, tableName);
4.1 --- a/sql.wizard/src/org/netbeans/modules/jdbcwizard/wizards/JNDINamePanel.java Tue Apr 03 01:04:26 2007 +0000
4.2 +++ b/sql.wizard/src/org/netbeans/modules/jdbcwizard/wizards/JNDINamePanel.java Tue Apr 03 06:48:59 2007 +0000
4.3 @@ -53,7 +53,9 @@
4.4 import org.openide.WizardDescriptor;
4.5 import org.openide.util.HelpCtx;
4.6
4.7 +import org.netbeans.modules.jdbcwizard.builder.dbmodel.DBColumn;
4.8 import org.netbeans.modules.jdbcwizard.builder.dbmodel.DBTable;
4.9 +import org.netbeans.modules.jdbcwizard.builder.util.XMLCharUtil;
4.10 import org.netbeans.modules.jdbcwizard.builder.wsdl.GenerateWSDL;
4.11 import org.netbeans.modules.jdbcwizard.builder.xsd.XSDGenerator;
4.12 import org.netbeans.modules.jdbcwizard.builder.dbmodel.DBConnectionDefinition;
4.13 @@ -187,7 +189,10 @@
4.14 while (it.hasNext()) {
4.15 final DBTable sTable = (DBTable) it.next();
4.16 if (sTable.isSelected()) {
4.17 - xsdGen.generate(sTable.getName(), targetFolderPath + File.separator + sTable.getName()
4.18 + //Make the xsd file name as valid name
4.19 + //Otherwise this will fail in "schemalocation" of the wsdl
4.20 + // the reaso ins schemalocation in wsdl is NCName
4.21 + xsdGen.generate(sTable.getName(), targetFolderPath + File.separator + XMLCharUtil.makeValidNCName(sTable.getName())
4.22 + JNDINamePanel.XSD_EXT, sTable);
4.23 selTable = sTable;
4.24 }