1 /*
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
292 } else {
293 portWSDLID = absWSDLName.value;
294 }
295 schemaPrefix = new java.io.File(portWSDLID).getName();
296 int idx = schemaPrefix.lastIndexOf('.');
297 if (idx > 0)
298 schemaPrefix = schemaPrefix.substring(0, idx);
299 schemaPrefix = mangleName(schemaPrefix) + "_";
300 }
301 generateDocument(serviceWriter, portWriter);
302 }
303
304 /**
305 * Writing directly to XmlSerializer is a problem, since it doesn't suppress
306 * xml declaration. Creating filter so that comment is written before TXW writes
307 * anything in the WSDL.
308 */
309 private static class CommentFilter implements XmlSerializer {
310 final XmlSerializer serializer;
311 private static final String VERSION_COMMENT =
312 " Generated by JAX-WS RI (http://jax-ws.java.net). RI's version is " + RuntimeVersion.VERSION + ". ";
313
314 CommentFilter(XmlSerializer serializer) {
315 this.serializer = serializer;
316 }
317
318 @Override
319 public void startDocument() {
320 serializer.startDocument();
321 comment(new StringBuilder(VERSION_COMMENT));
322 text(new StringBuilder("\n"));
323 }
324
325 @Override
326 public void beginStartTag(String uri, String localName, String prefix) {
327 serializer.beginStartTag(uri, localName, prefix);
328 }
329
330 @Override
331 public void writeAttribute(String uri, String localName, String prefix, StringBuilder value) {
332 serializer.writeAttribute(uri, localName, prefix, value);
|
1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
292 } else {
293 portWSDLID = absWSDLName.value;
294 }
295 schemaPrefix = new java.io.File(portWSDLID).getName();
296 int idx = schemaPrefix.lastIndexOf('.');
297 if (idx > 0)
298 schemaPrefix = schemaPrefix.substring(0, idx);
299 schemaPrefix = mangleName(schemaPrefix) + "_";
300 }
301 generateDocument(serviceWriter, portWriter);
302 }
303
304 /**
305 * Writing directly to XmlSerializer is a problem, since it doesn't suppress
306 * xml declaration. Creating filter so that comment is written before TXW writes
307 * anything in the WSDL.
308 */
309 private static class CommentFilter implements XmlSerializer {
310 final XmlSerializer serializer;
311 private static final String VERSION_COMMENT =
312 " Generated by JAX-WS RI (http://javaee.github.io/metro-jax-ws). RI's version is " + RuntimeVersion.VERSION + ". ";
313
314 CommentFilter(XmlSerializer serializer) {
315 this.serializer = serializer;
316 }
317
318 @Override
319 public void startDocument() {
320 serializer.startDocument();
321 comment(new StringBuilder(VERSION_COMMENT));
322 text(new StringBuilder("\n"));
323 }
324
325 @Override
326 public void beginStartTag(String uri, String localName, String prefix) {
327 serializer.beginStartTag(uri, localName, prefix);
328 }
329
330 @Override
331 public void writeAttribute(String uri, String localName, String prefix, StringBuilder value) {
332 serializer.writeAttribute(uri, localName, prefix, value);
|