Russell Butek
[EMAIL PROTECTED]
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc:
Subject: cvs commit: xml-axis/java/src/org/apache/axis/utils axisNLS.properties
tomj 2002/06/28 11:00:30
- Modified: java/src/org/apache/axis/wsdl/gen WSDL2.java Parser.java
java/src/org/apache/axis/wsdl/symbolTable SymbolTable.java
java/docs reference.html
java/src/org/apache/axis/utils axisNLS.properties
Log:
Add a new switch to WDSL2Java to turn off wrapped WSDL processing.
From the reference guide:
-W, --noWrapped
This turns off the special treatment of what is called "wrapped"
document/literal style operations. By default, WSDL2Java will
recognize the following conditions:
- If an input message has is a single part.
- The part is an element.
- The element has the same name as the operation
- The element's complex type has no attributes
When it sees this, WSDL2Java will 'unwrap' the top level element,
and treat each of the components of the element as arguments to
the operation. This type of WSDL is the default for Microsoft .NET
web services, which wrap up RPC style arguments in this top level
schema element.
Revision Changes Path
1.9 +10 -1 xml-axis/java/src/org/apache/axis/wsdl/gen/WSDL2.java
Index: WSDL2.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/gen/WSDL2.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- WSDL2.java 5 Jun 2002 19:28:59 -0000 1.8
+++ WSDL2.java 28 Jun 2002 18:00:30 -0000 1.9
@@ -73,6 +73,7 @@
- protected static final int NETWORK_TIMEOUT_OPT = 'O';
protected static final int NOIMPORTS_OPT = 'n';
protected static final int VERBOSE_OPT = 'v';
- protected CLOptionDescriptor[] options = new CLOptionDescriptor[]{
new CLOptionDescriptor("help",
new CLOptionDescriptor("Debug",
- CLOptionDescriptor.ARGUMENT_DISALLOWED,
DEBUG_OPT,
+ JavaUtils.getMessage("optionDebug00")),
+ new CLOptionDescriptor("noWrapped",
+ CLOptionDescriptor.ARGUMENT_DISALLOWED,
+ NOWRAP_OPT,
+ JavaUtils.getMessage("optionNoWrap00"))
- };
@@ -178,6 +183,10 @@
- case DEBUG_OPT:
parser.setDebug(true);
+
+ case NOWRAP_OPT:
+ parser.setNowrap(true);
- break;
}
Index: Parser.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/gen/Parser.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Parser.java 10 May 2002 14:45:04 -0000 1.4
+++ Parser.java 28 Jun 2002 18:00:30 -0000 1.5
@@ -82,6 +82,7 @@
- protected boolean debug = false;
protected boolean imports = true;
protected boolean verbose = false;
- // Username and password for Authentication
protected String username = null;
this.verbose = verbose;
- } // setVerbose
+ return nowrap;
+ }
+
+ public void setNowrap(boolean nowrap) {
+ this.nowrap = nowrap;
+ }
+
- /**
* Return the current timeout setting
*/
genFactory.getBaseTypeMapping(),
imports,
verbose,
- debug);
+ debug,
+ nowrap);
- // We run the actual Emitter in a thread that we can kill
WSDLRunnable runnable = new WSDLRunnable(symbolTable, wsdlURI);
genFactory.getBaseTypeMapping(),
imports,
verbose,
- debug);
+ debug,
+ nowrap);
- symbolTable.populate(context, doc);
generate(symbolTable);
Index: SymbolTable.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SymbolTable.java 26 Jun 2002 19:07:31 -0000 1.9
+++ SymbolTable.java 28 Jun 2002 18:00:30 -0000 1.10
@@ -146,6 +146,8 @@
- private BaseTypeMapping btm = null;
+ private boolean nowrap;
+ // Did we encounter wraped mode WSDL
- private boolean wrapped = false;
@@ -158,11 +160,12 @@
- * Construct a symbol table with the given Namespaces.
*/
- boolean verbose, boolean debug) {
+ boolean verbose, boolean debug, boolean nowrap) {
- this.btm = btm;
this.addImports = addImports;
this.verbose = verbose;
this.debug = debug;
} // ctor
/**
@@ -1149,8 +1152,20 @@
- String partName = part.getName();
- if (literal && !i.hasNext() && partName.equals("parameters"))
+ // if we haven't been told not to.
+ // Criteria:
+ // - If there is a single part,
+ // - That part is an element
+ // - That element has the same name as the operation
+ // - That element has no attributes (check done below)
+ if (!nowrap &&
+ literal &&
+ !i.hasNext() &&
+ elementName != null &&
+ elementName.getLocalPart().equals(opName)) {
+
wrapped = true;
+ }
- if (!literal || !wrapped) {
// We're either RPC or literal + not wrapped.
// Just an FYI: The WSDL spec says that for use=encoded
// that parts reference an abstract type using the type attr
// but we kinda do the right thing here, so let it go.
+ // if (!literal)
+ // error...
param.setType(getElement(elementName));
+ } else {
+ // no type or element
+ throw new IOException(
+ JavaUtils.getMessage("noTypeOrElement00",
+ new String[] {partName,
+ opName}));
- }
@@ -1224,11 +1247,23 @@
- elementName.toString()}));
}
+ Vector vAttrs = SchemaUtils.getContainedAttributeTypes(node, this);
+ if (vAttrs != null) {
+ // can't do wrapped mode
+ wrapped = false;
+ }
+
// Get the nested type entries.
+ // TODO - If we are unable to represent any of the types in the
+ // element, we need to use SOAPElement/SOAPBodyElement.
+ // I don't believe getContainedElementDecl does the right thing yet.
- Vector vTypes =
SchemaUtils.getContainedElementDeclarations(node, this);
+ // if we got the types entries and we didn't find attributes
+ // use the tings is this element as the parameters
+ if (vTypes != null && wrapped) {
- // add the elements in this list
for (int j = 0; j < vTypes.size(); j++) {
@@ -1238,7 +1273,8 @@
- v.add(p);
}
- // XXX - This should be a SOAPElement/SOAPBodyElement
+ // we were unable to get the types, or we found attributes so
+ // we can't use wrapped mode.
- Parameter p = new Parameter();
p.setName(partName);
Index: reference.html
===================================================================
RCS file: /home/cvs/xml-axis/java/docs/reference.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- reference.html 1 May 2002 12:18:51 -0000 1.4
+++ reference.html 28 Jun 2002 18:00:30 -0000 1.5
@@ -93,6 +93,9 @@
- -P, --password <argument> <br>
password to access the WSDL-URI <br>
+
+ turn off support for "wrapped" document/literal<br>
<h4> -h, --help</h4>
Print the usage statement and exit
@@ -207,6 +210,23 @@
<h4> -P, --password <argument></h4>
This password is used in resolving the WSDL-URI provided as the input to WSDL2Java.
If the URI contains a password, this will override the command line switch.
+<br>
+<h4>-W, --noWrapped</h4>
+This turns off the special treatment of what is called "wrapped" document/literal
+style operations. By default, WSDL2Java will recognize the following
+conditions:<br>
+<ul>
+ <li>If an input message has is a single part.</li>
+ <li>The part is an element.</li>
+ <li>The element has the same name as the operation</li>
+ <li>The element's complex type has no attributes<br>
+ </li>
+</ul>
+When it sees this, WSDL2Java will 'unwrap' the top level element, and treat each
+of the components of the element as arguments to the operation. This type of WSDL
+is the default for Microsoft .NET web services, which wrap up RPC style arguments
+in this top level schema element.<br>
+
<h3><a name="Java2WSDL"></a>Java2WSDL Reference</h3>
<p>Here is the help message generated from the current tool: </p>
<p><tt><font color="#993366">Java2WSDL emitter</font></tt> <br>
1.18 +3 -0 xml-axis/java/src/org/apache/axis/utils/axisNLS.properties
Index: axisNLS.properties
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/axisNLS.properties,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- axisNLS.properties 27 Jun 2002 18:06:17 -0000 1.17
+++ axisNLS.properties 28 Jun 2002 18:00:30 -0000 1.18
@@ -904,4 +904,7 @@
beanCompatConstructor00=The class {0} does not contain a default constructor, which is a requirement for a bean class. The class cannot be converted into an xml schema type. An xml schema anyType will be used to define this class in the wsdl file.
unsupportedSchemaType00=The XML Schema type ''{0}'' is not currently supported.
+optionNoWrap00=turn off support for "wrapped" document/literal
+noTypeOrElement00=Error: Message part {0} of operation or fault {1} has no element or type attribute.
+