Author: ips
Date: Fri May 20 16:02:35 2005
New Revision: 171169
URL: http://svn.apache.org/viewcvs?rev=171169&view=rev
Log:
better handling of WSDL corner cases
Modified:
incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java
incubator/apollo/trunk/src/java/org/apache/ws/util/OperationInfo.java
Modified:
incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java
URL:
http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java?rev=171169&r1=171168&r2=171169&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java
(original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java
Fri May 20 16:02:35 2005
@@ -255,11 +255,6 @@
options.setVerbose( Boolean.valueOf( cmdLine.getOptionValue(
Opts.VERBOSE ) ).booleanValue() );
}
- if ( cmdLine.hasOption( Opts.DEBUG ) )
- {
- options.setVerbose( Boolean.valueOf( cmdLine.getOptionValue(
Opts.DEBUG ) ).booleanValue() );
- }
-
File[] wsdlFiles = new File[cmdLine.getArgs().length];
for ( int i = 0; i < cmdLine.getArgs().length; i++ )
{
@@ -880,11 +875,6 @@
* DOCUMENT_ME
*/
String VERBOSE = "v";
-
- /**
- * DOCUMENT_ME
- */
- String DEBUG = "d";
/**
* DOCUMENT_ME
Modified: incubator/apollo/trunk/src/java/org/apache/ws/util/OperationInfo.java
URL:
http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/util/OperationInfo.java?rev=171169&r1=171168&r2=171169&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/util/OperationInfo.java
(original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/util/OperationInfo.java Fri
May 20 16:02:35 2005
@@ -28,7 +28,7 @@
import java.util.Iterator;
/**
- * TODO
+ * The Java method signature info for a WSDL operation.
*
* @author Ian Springer (ian DOT springer AT hp DOT com)
*/
@@ -42,18 +42,16 @@
private String m_fullyQualifiedResponseClassName;
private String m_fullyQualifiedRequestClassName;
-
public OperationInfo(Operation op, String targetNamespace)
{
m_methodName = StringUtils.capitalize( op.getName() );
Input input = op.getInput();
-
if ( input != null )
{
Map inputParts = input.getMessage().getParts();
if ( inputParts.size() != 1 )
{
- throw new RuntimeException( "Wsdl input element should have
exactly one part." );
+ throw new RuntimeException( "WSDL input element should have
exactly one part." );
}
Part inputPart = (Part) inputParts.values().iterator().next();
m_requestElemName = inputPart.getElementName();
@@ -67,26 +65,31 @@
if ( output != null )
{
Map outputParts = output.getMessage().getParts();
- if ( outputParts.size() != 1 )
+ if ( outputParts.size() > 1 )
+ {
+ throw new RuntimeException( "WSDL output element should have
at most one part." );
+ }
+ if ( outputParts.size() == 1)
{
- throw new RuntimeException( "Wsdl output element should have
exactly one part." );
+ Part outputPart = (Part)
outputParts.values().iterator().next();
+ m_fullyQualifiedResponseClassName =
XmlBeanNameUtils.getDocumentElementXmlBeanClassName(
outputPart.getElementName() );
+ }
+ else // no output parts
+ {
+ m_fullyQualifiedResponseClassName = "void";
}
- Part outputPart = (Part) outputParts.values().iterator().next();
- m_fullyQualifiedResponseClassName =
XmlBeanNameUtils.getDocumentElementXmlBeanClassName(
outputPart.getElementName() );
}
- else
+ else // no output
{
- m_fullyQualifiedResponseClassName = void.class.getName();
+ m_fullyQualifiedResponseClassName = "void";
}
- m_faults = op.getFaults();
-
-
m_methodSig = m_fullyQualifiedResponseClassName + " " + m_methodName +
"( " + m_fullyQualifiedRequestClassName + " requestDoc )";
//add faults to signature....
- if(m_faults.size() > 0)
+ m_faults = op.getFaults();
+ if(!m_faults.isEmpty())
{
- m_methodSig = m_methodSig + " throws ";
+ m_methodSig += " throws ";
Iterator iterator = m_faults.keySet().iterator();
while (iterator.hasNext())
{
@@ -99,13 +102,11 @@
//its a type..get the name of the type
faultName = part.getTypeName().getLocalPart();
}
-
faultName = javaPackageName + "." + faultName + "Exception";
- m_methodSig = m_methodSig + faultName;
-
+ m_methodSig += faultName;
if(iterator.hasNext())
{
- m_methodSig = m_methodSig + ", ";
+ m_methodSig += ", ";
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]