Russell,

 

I added the switch because I was mucking around in the wrapped sensing code to fix it to not use the part name “parameters” as the trigger for unwrapping doc/lit operations, but rather to follow the ‘rules’ (enumerated in the code and the docs).

 

As to why I was mucking around in the symbol table, I think it was because I was trying to enhance the qualify WSDL test to test the attribute qualifications, which is wrapped WSDL, and WSDL2Java kept doing the wrong thing with it when there were attributes on the wrapping element (which is generally a no-no), so I wanted a simple way to turn this processing off. (Whew! J

 

Also, it has been on my (personal) to do list for a long time and I finally felt it was time to do it.

 

--

Tom Jordahl

Macromedia

 

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 11:42 AM
To: [EMAIL PROTECTED]
Subject: Re: cvs commit: xml-axis/java/src/org/apache/axis/utils axisNLS.properties

 

Tom, just curious. Why did you add this switch? I'm not complaining, in fact I like it, just wondering what instigated it.

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 static final int NOWRAP_OPT = 'W';

protected CLOptionDescriptor[] options = new CLOptionDescriptor[]{
new CLOptionDescriptor("help",

@@ -94,7 +95,11 @@
new CLOptionDescriptor("Debug",

CLOptionDescriptor.ARGUMENT_DISALLOWED,
DEBUG_OPT,

-                JavaUtils.getMessage("optionDebug00"))
+                JavaUtils.getMessage("optionDebug00")),
+        new CLOptionDescriptor("noWrapped",
+                 CLOptionDescriptor.ARGUMENT_DISALLOWED,
+                 NOWRAP_OPT,
+                 JavaUtils.getMessage("optionNoWrap00"))

};

protected String wsdlURI = null;
@@ -178,6 +183,10 @@

case DEBUG_OPT:
parser.setDebug(true);

+                break;
+
+            case NOWRAP_OPT:
+                parser.setNowrap(true);

break;
}

} // parseOption

1.5       +13 -2     xml-axis/java/src/org/apache/axis/wsdl/gen/Parser.java

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;

+    protected boolean nowrap = false;

// Username and password for Authentication
protected String username = null;

@@ -117,6 +118,14 @@
this.verbose = verbose;

} // setVerbose

+    public boolean isNowrap() {
+        return nowrap;
+    }
+
+    public void setNowrap(boolean nowrap) {
+        this.nowrap = nowrap;
+    }
+

/**
* Return the current timeout setting
*/

@@ -194,7 +203,8 @@
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);

@@ -256,7 +266,8 @@
genFactory.getBaseTypeMapping(),
imports,
verbose,

-                debug);
+                debug,
+                nowrap);

symbolTable.populate(context, doc);
generate(symbolTable);

} // run

1.10      +40 -4     xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java

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;

// should we attempt to treat document/literal WSDL as "rpc-style"
+    private boolean nowrap;
+    // Did we encounter wraped mode WSDL

private boolean wrapped = false;

public static final String ANON_TOKEN = ">";
@@ -158,11 +160,12 @@

* Construct a symbol table with the given Namespaces.
*/

public SymbolTable(BaseTypeMapping btm, boolean addImports,
-            boolean verbose, boolean debug) {
+            boolean verbose, boolean debug, boolean nowrap) {

this.btm = btm;
this.addImports = addImports;
this.verbose = verbose;
this.debug = debug;

+        this.nowrap = nowrap;
} // ctor


/**
@@ -1149,8 +1152,20 @@

String partName = part.getName();

// Hack alert - Try to sense "wrapped" document literal mode
-            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.

@@ -1164,7 +1179,15 @@
// 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}));

}

v.add(param);
@@ -1224,11 +1247,23 @@

elementName.toString()}));
}

+            // check for attributes
+            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 (vTypes != null) {
+            // 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++) {

ElementDecl elem = (ElementDecl) vTypes.elementAt(j);
@@ -1238,7 +1273,8 @@

v.add(p);
}

} else {
-                // 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);



1.5       +20 -0     xml-axis/java/docs/reference.html

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 @@

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -P, --password &lt;argument> <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
password to access the WSDL-URI <br>

+  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -W, --noWrapped<br>
+  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+  turn off support for &quot;wrapped&quot; document/literal<br>

&nbsp;
<h4> -h, --help</h4>
Print the usage statement and exit

@@ -207,6 +210,23 @@
<h4> -P, --password &lt;argument&gt;</h4>
This password is used in resolving the WSDL-URI provided as the input to WSDL2Java.
&nbsp;If the URI contains a password, this will override the command line switch.&nbsp;

+<br>
+<h4>-W, --noWrapped</h4>
+This turns off the special treatment of what is called "wrapped" document/literal
+style operations. &nbsp;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.
+



Reply via email to