wsdl4j-1.6.3/ 0000755 0001750 0001750 00000000000 12111773372 011500 5 ustar tony tony wsdl4j-1.6.3/build.xml 0000644 0001750 0001750 00000030157 12111773372 013327 0 ustar tony tony
Common Public License - v 1.0
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
"Contribution" means:
"Contributor" means any person or entity that distributes the Program.
"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
"Program" means the Contributions distributed in accordance with this Agreement.
"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
2. GRANT OF RIGHTS
3. REQUIREMENTS
A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
When the Program is made available in source code form:
Contributors
may not remove or alter any copyright notices contained within the Program.
Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
wsdl4j-1.6.3/src/ 0000755 0001750 0001750 00000000000 12111773372 012267 5 ustar tony tony wsdl4j-1.6.3/src/javax/ 0000755 0001750 0001750 00000000000 12111773372 013400 5 ustar tony tony wsdl4j-1.6.3/src/javax/xml/ 0000755 0001750 0001750 00000000000 12111773372 014200 5 ustar tony tony wsdl4j-1.6.3/src/javax/xml/namespace/ 0000755 0001750 0001750 00000000000 12111773372 016134 5 ustar tony tony wsdl4j-1.6.3/src/javax/xml/namespace/QName.java 0000644 0001750 0001750 00000014667 12111773372 020016 0 ustar tony tony /* * (c) Copyright IBM Corp 2002, 2006 */ package javax.xml.namespace; import java.io.*; /** *
QName
class represents the value of a qualified name
* as specified in XML
* Schema Part2: Datatypes specification.
* * The value of a QName contains a namespaceURI and a localPart. * The localPart provides the local part of the qualified name. The * namespaceURI is a URI reference identifying the namespace. * * Note: Some of this impl code was taken from Axis. * * @author axis-dev * @author Matthew J. Duftler (duftler@us.ibm.com) */ public class QName implements Serializable { // Comment/shared empty string. private static final String emptyString = ""; // Field namespaceURI. private String namespaceURI; // Field localPart. private String localPart; // Field prefix. private String prefix; private static final long serialVersionUID = -9120448754896609940L; /** * Constructor for the QName. * * @param localPart Local part of the QName */ public QName(String localPart) { this.namespaceURI = emptyString; this.localPart = (localPart == null) ? emptyString : localPart.intern(); this.prefix = emptyString; } /** * Constructor for the QName. * * @param namespaceURI Namespace URI for the QName * @param localPart Local part of the QName. */ public QName(String namespaceURI, String localPart) { this.namespaceURI = (namespaceURI == null) ? emptyString : namespaceURI.intern(); this.localPart = (localPart == null) ? emptyString : localPart.intern(); this.prefix = emptyString; } /** * Constructor for the QName. * * @param namespaceURI Namespace URI for the QName * @param localPart Local part of the QName. * @param prefix the xmlns-declared prefix for this namespaceURI */ public QName(String namespaceURI, String localPart, String prefix) { this.namespaceURI = (namespaceURI == null) ? emptyString : namespaceURI.intern(); this.localPart = (localPart == null) ? emptyString : localPart.intern(); this.prefix = (prefix == null) ? emptyString : prefix.intern(); } /** * Gets the Namespace URI for this QName * * @return Namespace URI */ public String getNamespaceURI() { return namespaceURI; } /** * Gets the Local part for this QName * * @return Local part */ public String getLocalPart() { return localPart; } /** * Gets the prefix for this QName * * @return prefix of this QName */ public String getPrefix() { return prefix; } /** * Returns a string representation of this QName * * @return a string representation of the QName */ public String toString() { return ((namespaceURI == emptyString) ? localPart : '{' + namespaceURI + '}' + localPart); } /** * Tests this QName for equality with another object. *
* If the given object is not a QName or is null then this method * returns false. *
* For two QNames to be considered equal requires that both
* localPart and namespaceURI must be equal. This method uses
* String.equals
to check equality of localPart
* and namespaceURI. Any class that extends QName is required
* to satisfy this equality contract.
*
* This method satisfies the general contract of the Object.equals
method.
*
* @param obj the reference object with which to compare
*
* @return true
if the given object is identical to this
* QName: false
otherwise.
*/
public final boolean equals(Object obj)
{
if (obj == this)
{
return true;
}
if (!(obj instanceof QName))
{
return false;
}
if ((namespaceURI == ((QName)obj).namespaceURI)
&& (localPart == ((QName)obj).localPart))
{
return true;
}
return false;
}
/**
* Returns a QName holding the value of the specified String.
*
* The string must be in the form returned by the QName.toString() * method, i.e. "{namespaceURI}localPart", with the "{namespaceURI}" * part being optional. *
* This method doesn't do a full validation of the resulting QName.
* In particular, it doesn't check that the resulting namespace URI
* is a legal URI (per RFC 2396 and RFC 2732), nor that the resulting
* local part is a legal NCName per the XML Namespaces specification.
*
* @param s the string to be parsed
* @throws java.lang.IllegalArgumentException If the specified String
* cannot be parsed as a QName
* @return QName corresponding to the given String
*/
public static QName valueOf(String s)
{
if ((s == null) || s.equals(""))
{
throw new IllegalArgumentException("Invalid QName literal.");
}
if (s.charAt(0) == '{')
{
int i = s.indexOf('}');
if (i == -1)
{
throw new IllegalArgumentException("Invalid QName literal.");
}
if (i == s.length() - 1)
{
throw new IllegalArgumentException("Invalid QName literal.");
}
else
{
return new QName(s.substring(1, i), s.substring(i + 1));
}
}
else
{
return new QName(s);
}
}
/**
* Returns a hash code value for this QName object. The hash code
* is based on both the localPart and namespaceURI parts of the
* QName. This method satisfies the general contract of the
* Object.hashCode
method.
*
* @return a hash code value for this Qname object
*/
public final int hashCode()
{
return namespaceURI.hashCode() ^ localPart.hashCode();
}
private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException
{
in.defaultReadObject();
namespaceURI = namespaceURI.intern();
localPart = localPart.intern();
if(prefix == null)
{
//The serialized object did not have a 'prefix'.
//i.e. it was serialized from an old version of QName.
prefix = emptyString;
}
else
{
prefix = prefix.intern();
}
}
} wsdl4j-1.6.3/src/javax/wsdl/ 0000755 0001750 0001750 00000000000 12111773372 014351 5 ustar tony tony wsdl4j-1.6.3/src/javax/wsdl/Part.java 0000644 0001750 0001750 00000001357 12111773372 016130 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl;
import javax.xml.namespace.*;
/**
* This interface represents a message part and contains the part's
* name, elementName, typeName, and any extensibility attributes.
*
* @author Paul Fremantle
* @author Nirmal Mukhi
* @author Matthew J. Duftler
*/
public interface Part extends WSDLElement
{
/**
* Set the name of this part.
*
* @param name the desired name
*/
public void setName(String name);
/**
* Get the name of this part.
*
* @return the part name
*/
public String getName();
public void setElementName(QName elementName);
public QName getElementName();
public void setTypeName(QName typeName);
public QName getTypeName();
}
wsdl4j-1.6.3/src/javax/wsdl/PortType.java 0000644 0001750 0001750 00000010012 12111773372 016774 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl;
import java.util.*;
import javax.xml.namespace.*;
/**
* This interface represents a port type. It contains information about
* operations associated with this port type.
*
* @author Paul Fremantle
* @author Nirmal Mukhi
* @author Matthew J. Duftler
*/
public interface PortType extends WSDLElement
{
/**
* Set the name of this port type.
*
* @param name the desired name
*/
public void setQName(QName name);
/**
* Get the name of this port type.
*
* @return the port type name
*/
public QName getQName();
/**
* Add an operation to this port type.
*
* @param operation the operation to be added
*/
public void addOperation(Operation operation);
/**
* Get the specified operation. Note that operation names can
* be overloaded within a PortType. In case of overloading, the
* names of the input and output messages can be used to further
* refine the search.
*
* The search criteria will be the operation name parameter and any
* non-null input or output message name parameters.
* To exclude the input or output message name from the search criteria,
* specify a null value for the input or output message name parameter.
* To search for operations with unnamed input or output messages
* (i.e. <input> or <output> elements with the 'name' attribute omitted),
* specify the string ":none
" for the input or output message name parameter.
*
* Note: the use of a string value ":none
" rather than null to search for
* unnamed input or output messages is necessary to retain backward compatibility
* with earlier versions of the JWSDL API, which defined a null value to
* mean 'ignore this parameter'.
* The colon in ":none
" is to avoid name clashes with input or output
* message names, which must be of type NCName (i.e. they cannot contain colons).
*
* @param name the name of the desired operation.
* @param inputName the name of the input message; if this is null
* it will be ignored, if this is ":none
" it means search for an input
* message without a name.
* @param outputName the name of the output message; if this is null
* it will be ignored, if this is ":none
" it means search for an output
* message without a name.
* @return the corresponding operation, or null if there wasn't
* any matching operation
*
* @throws IllegalArgumentException if duplicate operations are found.
*/
public Operation getOperation(String name,
String inputName,
String outputName);
/**
* Get all the operations defined here.
*/
public List getOperations();
/**
* Remove the specified operation. Note that operation names can
* be overloaded within a PortType. In case of overloading, the
* names of the input and output messages can be used to further
* refine the search.
*
* Usage of the input and output message name parameters is as
* described for the getOperation
method.
*
* @param name the name of the desired operation.
* @param inputName the name of the input message; if this is null
* it will be ignored, if this is ":none
" it means search for an input
* message without a name.
* @param outputName the name of the output message; if this is null
* it will be ignored, if this is ":none
" it means search for an output
* message without a name.
* @return the operation which was removed, or null if there wasn't
* any matching operation
*
* @throws IllegalArgumentException if duplicate operations are found.
*
* @see #getOperation(String, String, String)
*/
public Operation removeOperation(String name,
String inputName,
String outputName);
public void setUndefined(boolean isUndefined);
public boolean isUndefined();
} wsdl4j-1.6.3/src/javax/wsdl/factory/ 0000755 0001750 0001750 00000000000 12111773372 016020 5 ustar tony tony wsdl4j-1.6.3/src/javax/wsdl/factory/WSDLFactory.java 0000644 0001750 0001750 00000020203 12111773372 020761 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl.factory;
import java.io.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.*;
import javax.wsdl.*;
import javax.wsdl.extensions.*;
import javax.wsdl.xml.*;
/**
* This abstract class defines a factory API that enables applications
* to obtain a WSDLFactory capable of producing new Definitions, new
* WSDLReaders, and new WSDLWriters.
*
* Some ideas used here have been shamelessly copied from the
* wonderful JAXP and Xerces work.
*
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public abstract class WSDLFactory
{
private static final String PROPERTY_NAME =
"javax.wsdl.factory.WSDLFactory";
private static final String PROPERTY_FILE_NAME =
"wsdl.properties";
private static final String META_INF_SERVICES_PROPERTY_FILE_NAME =
"javax.wsdl.factory.WSDLFactory";
private static final String DEFAULT_FACTORY_IMPL_NAME =
"com.ibm.wsdl.factory.WSDLFactoryImpl";
private static String fullPropertyFileName = null;
private static String metaInfServicesFullPropertyFileName = null;
/**
* Get a new instance of a WSDLFactory. This method
* follows (almost) the same basic sequence of steps that JAXP
* follows to determine the fully-qualified class name of the
* class which implements WSDLFactory.
*
* The steps in order are: *
* Once an instance of a WSDLFactory is obtained, invoke
* newDefinition(), newWSDLReader(), or newWSDLWriter(), to create
* the desired instances.
*/
public static WSDLFactory newInstance() throws WSDLException
{
String factoryImplName = findFactoryImplName();
return newInstance(factoryImplName);
}
/**
* Get a new instance of a WSDLFactory. This method
* returns an instance of the class factoryImplName.
* Once an instance of a WSDLFactory is obtained, invoke
* newDefinition(), newWSDLReader(), or newWSDLWriter(), to create
* the desired instances.
*
* @param factoryImplName the fully-qualified class name of the
* class which provides a concrete implementation of the abstract
* class WSDLFactory.
*/
public static WSDLFactory newInstance(String factoryImplName)
throws WSDLException
{
if (factoryImplName != null)
{
try
{
Class cl = Class.forName(factoryImplName);
return (WSDLFactory)cl.newInstance();
}
catch (Exception e)
{
/*
Catches:
ClassNotFoundException
InstantiationException
IllegalAccessException
*/
throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
"Problem instantiating factory " +
"implementation.",
e);
}
}
else
{
throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
"Unable to find name of factory " +
"implementation.");
}
}
/**
* Get a new instance of a WSDLFactory. This method
* returns an instance of the class factoryImplName, using
* the specified ClassLoader.
* Once an instance of a WSDLFactory is obtained, invoke
* newDefinition(), newWSDLReader(), or newWSDLWriter(), to create
* the desired instances.
*
* @param factoryImplName the fully-qualified class name of the
* class which provides a concrete implementation of the abstract
* class WSDLFactory.
* @param classLoader the ClassLoader to use to load the WSDLFactory
* implementation.
*/
public static WSDLFactory newInstance(String factoryImplName,
ClassLoader classLoader)
throws WSDLException
{
if (factoryImplName != null)
{
try
{
Class cl = classLoader.loadClass(factoryImplName);
return (WSDLFactory)cl.newInstance();
}
catch (Exception e)
{
/*
Catches:
ClassNotFoundException
InstantiationException
IllegalAccessException
*/
throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
"Problem instantiating factory " +
"implementation.",
e);
}
}
else
{
throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
"Unable to find name of factory " +
"implementation.");
}
}
/**
* Create a new instance of a Definition.
*/
public abstract Definition newDefinition();
/**
* Create a new instance of a WSDLReader.
*/
public abstract WSDLReader newWSDLReader();
/**
* Create a new instance of a WSDLWriter.
*/
public abstract WSDLWriter newWSDLWriter();
/**
* Create a new instance of an ExtensionRegistry with pre-registered
* serializers/deserializers for the SOAP, HTTP and MIME
* extensions. Java extensionTypes are also mapped for all
* the SOAP, HTTP and MIME extensions.
*/
public abstract ExtensionRegistry newPopulatedExtensionRegistry();
private static String findFactoryImplName()
{
String factoryImplName = null;
// First, check the META-INF/services property file.
final String metaInfServicesPropFileName = getMetaInfFullPropertyFileName();
if (metaInfServicesPropFileName != null)
{
try
{
InputStream is = (InputStream) AccessController.doPrivileged(
new PrivilegedAction() {
public Object run() {
return WSDLFactory.class.getResourceAsStream(metaInfServicesPropFileName);
}
});
if(is != null)
{
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
factoryImplName = br.readLine();
br.close();
isr.close();
is.close();
}
if (factoryImplName != null)
{
return factoryImplName;
}
}
catch (IOException e)
{
}
}
// Second, check the system property.
try
{
factoryImplName = System.getProperty(PROPERTY_NAME);
if (factoryImplName != null)
{
return factoryImplName;
}
}
catch (SecurityException e)
{
}
// Third, check the properties file.
String propFileName = getFullPropertyFileName();
if (propFileName != null)
{
try
{
Properties properties = new Properties();
File propFile = new File(propFileName);
FileInputStream fis = new FileInputStream(propFile);
properties.load(fis);
fis.close();
factoryImplName = properties.getProperty(PROPERTY_NAME);
if (factoryImplName != null)
{
return factoryImplName;
}
}
catch (IOException e)
{
}
}
// Fourth, return the default.
return DEFAULT_FACTORY_IMPL_NAME;
}
private static String getFullPropertyFileName()
{
if (fullPropertyFileName == null)
{
try
{
String javaHome = System.getProperty("java.home");
fullPropertyFileName = javaHome + File.separator + "lib" +
File.separator + PROPERTY_FILE_NAME;
}
catch (SecurityException e)
{
}
}
return fullPropertyFileName;
}
private static String getMetaInfFullPropertyFileName()
{
if (metaInfServicesFullPropertyFileName == null)
{
String metaInfServices = "/META-INF/services/";
metaInfServicesFullPropertyFileName = metaInfServices + META_INF_SERVICES_PROPERTY_FILE_NAME;
}
return metaInfServicesFullPropertyFileName;
}
} wsdl4j-1.6.3/src/javax/wsdl/OperationType.java 0000644 0001750 0001750 00000004643 12111773372 020025 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package javax.wsdl;
import java.io.ObjectStreamException;
/**
* This class represents an operation type which can
* be one of request-response, solicit response, one way or
* notification. This represents a safe way to prevent usage
* of invalid values since the only objects of this class available
* are the public static instances declared within the class.
* Need to figure out if this should be made into an interface.
*/
public class OperationType implements java.io.Serializable
{
private final String id;
private final int intId;
private static int counter = 0;
public static final long serialVersionUID = 1;
public static OperationType ONE_WAY =
new OperationType("ONE_WAY");
public static OperationType REQUEST_RESPONSE =
new OperationType("REQUEST_RESPONSE");
public static OperationType SOLICIT_RESPONSE =
new OperationType("SOLICIT_RESPONSE");
public static OperationType NOTIFICATION =
new OperationType("NOTIFICATION");
//If new values of op type are ever added (highly unlikely)
//they must be added here, after the existing values. Otherwise
//readResolve will return the wrong instances at deserialization.
private static final OperationType[] INSTANCES =
{ONE_WAY, REQUEST_RESPONSE, SOLICIT_RESPONSE, NOTIFICATION};
private OperationType(String id)
{
this.id = id;
this.intId = counter++;
}
private String getId()
{
return id;
}
/* The following equals method is not used within wsdl4j but
* it is historically part of the jsr110 jwsdl API, so it
* will not likely be removed. Although it overloads the
* Object.equals method (i.e. it has a different arg) it does
* not override it, so Object.equals will still be used by
* the readResolve method at deserialization.
*/
public boolean equals(OperationType operationType)
{
return operationType != null && id.equals(operationType.getId());
}
public String toString()
{
return id + "," + intId;
}
/* The readResolve method has been added because this class
* implements a typesafe enumeration and it is serializable.
* This method will ensure that at deserialization the orginal
* instances of the enumeration are used, so that Object.equals
* and the '==' operator behave as expected.
*/
private Object readResolve() throws ObjectStreamException {
return INSTANCES[intId];
}
} wsdl4j-1.6.3/src/javax/wsdl/BindingOutput.java 0000644 0001750 0001750 00000001165 12111773372 020012 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl;
/**
* This interface represents an output binding. That is, it contains
* the information that would be specified in an output element
* contained within an operation element contained within a
* binding element.
*
* @author Matthew J. Duftler
*/
public interface BindingOutput extends WSDLElement
{
/**
* Set the name of this output binding.
*
* @param name the desired name
*/
public void setName(String name);
/**
* Get the name of this output binding.
*
* @return the output binding name
*/
public String getName();
} wsdl4j-1.6.3/src/javax/wsdl/BindingFault.java 0000644 0001750 0001750 00000001155 12111773372 017564 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl;
/**
* This interface represents a fault binding. That is, it contains
* the information that would be specified in a fault element
* contained within an operation element contained within a
* binding element.
*
* @author Matthew J. Duftler
*/
public interface BindingFault extends WSDLElement
{
/**
* Set the name of this fault binding.
*
* @param name the desired name
*/
public void setName(String name);
/**
* Get the name of this fault binding.
*
* @return the fault binding name
*/
public String getName();
} wsdl4j-1.6.3/src/javax/wsdl/Input.java 0000644 0001750 0001750 00000001115 12111773372 016311 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl;
/**
* This interface represents an input message, and contains the name
* of the input and the message itself.
*
* @author Matthew J. Duftler
*/
public interface Input extends WSDLElement
{
/**
* Set the name of this input message.
*
* @param name the desired name
*/
public void setName(String name);
/**
* Get the name of this input message.
*
* @return the input message name
*/
public String getName();
public void setMessage(Message message);
public Message getMessage();
} wsdl4j-1.6.3/src/javax/wsdl/Port.java 0000644 0001750 0001750 00000001474 12111773372 016146 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl;
/**
* This interface represents a port, an endpoint for the
* functionality described by a particular port type.
*
* @author Paul Fremantle
* @author Nirmal Mukhi
* @author Matthew J. Duftler
*/
public interface Port extends WSDLElement
{
/**
* Set the name of this port.
*
* @param name the desired name
*/
public void setName(String name);
/**
* Get the name of this port.
*
* @return the port name
*/
public String getName();
/**
* Set the binding this port should refer to.
*
* @param binding the desired binding
*/
public void setBinding(Binding binding);
/**
* Get the binding this port refers to.
*
* @return the binding associated with this port
*/
public Binding getBinding();
} wsdl4j-1.6.3/src/javax/wsdl/WSDLException.java 0000644 0001750 0001750 00000005232 12111773372 017646 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl;
public class WSDLException extends Exception
{
public static final long serialVersionUID = 1;
public static final String INVALID_WSDL = "INVALID_WSDL";
public static final String PARSER_ERROR = "PARSER_ERROR";
public static final String OTHER_ERROR = "OTHER_ERROR";
public static final String CONFIGURATION_ERROR = "CONFIGURATION_ERROR";
public static final String UNBOUND_PREFIX = "UNBOUND_PREFIX";
public static final String NO_PREFIX_SPECIFIED = "NO_PREFIX_SPECIFIED";
private String faultCode = null;
private Throwable targetThrowable = null;
private String location = null;
public WSDLException(String faultCode, String msg, Throwable t)
{
super(msg, t);
setFaultCode(faultCode);
}
public WSDLException(String faultCode, String msg)
{
this(faultCode, msg, null);
}
public void setFaultCode(String faultCode)
{
this.faultCode = faultCode;
}
public String getFaultCode()
{
return faultCode;
}
public void setTargetException(Throwable targetThrowable)
{
this.targetThrowable = targetThrowable;
}
public Throwable getTargetException()
{
if(targetThrowable == null) return getCause();
else return targetThrowable;
}
/**
* Set the location using an XPath expression. Used for error messages.
*
* @param location an XPath expression describing the location where
* the exception occurred.
*/
public void setLocation(String location)
{
this.location = location;
}
/**
* Get the location, if one was set. Should be an XPath expression which
* is used for error messages.
*/
public String getLocation()
{
return location;
}
public String getMessage()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("WSDLException");
if (location != null)
{
try
{
strBuf.append(" (at " + location + ")");
}
catch (IllegalArgumentException e)
{
}
}
if (faultCode != null)
{
strBuf.append(": faultCode=" + faultCode);
}
String thisMsg = super.getMessage();
String targetMsg = null;
String targetName = null;
if(getTargetException() != null)
{
targetMsg = getTargetException().getMessage();
targetName = getTargetException().getClass().getName();
}
if (thisMsg != null
&& (targetMsg == null || !thisMsg.equals(targetMsg)))
{
strBuf.append(": " + thisMsg);
}
if (targetName != null)
{
strBuf.append(": " + targetName);
}
if (targetMsg != null)
{
strBuf.append(": " + targetMsg);
}
return strBuf.toString();
}
} wsdl4j-1.6.3/src/javax/wsdl/Types.java 0000644 0001750 0001750 00000000374 12111773372 016324 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl;
/**
* This interface represents the <types> section of a WSDL document.
*
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public interface Types extends WSDLElement
{
} wsdl4j-1.6.3/src/javax/wsdl/Fault.java 0000644 0001750 0001750 00000001114 12111773372 016264 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl;
/**
* This interface represents a fault message, and contains the name
* of the fault and the message itself.
*
* @author Matthew J. Duftler
*/
public interface Fault extends WSDLElement
{
/**
* Set the name of this fault message.
*
* @param name the desired name
*/
public void setName(String name);
/**
* Get the name of this fault message.
*
* @return the fault message name
*/
public String getName();
public void setMessage(Message message);
public Message getMessage();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/ 0000755 0001750 0001750 00000000000 12111773372 016550 5 ustar tony tony wsdl4j-1.6.3/src/javax/wsdl/extensions/AttributeExtensible.java 0000644 0001750 0001750 00000004503 12111773372 023403 0 ustar tony tony /*
* (c) Copyright IBM Corp 2004, 2005
*/
package javax.wsdl.extensions;
import java.util.*;
import javax.xml.namespace.*;
/**
* Classes that implement this interface can contain extensibility
* attributes.
*
* @author Matthew J. Duftler
* @author Paul Fremantle
*/
public interface AttributeExtensible
{
public static final int NO_DECLARED_TYPE = -1;
public static final int STRING_TYPE = 0;
public static final int QNAME_TYPE = 1;
public static final int LIST_OF_STRINGS_TYPE = 2;
public static final int LIST_OF_QNAMES_TYPE = 3;
/**
* Set an extension attribute on this element. Pass in a null value to remove
* an extension attribute.
*
* @param name the extension attribute name
* @param value the extension attribute value. Can be a String, a QName, a
* List of Strings, or a List of QNames.
*
* @see #getExtensionAttribute
* @see #getExtensionAttributes
* @see ExtensionRegistry#registerExtensionAttributeType
* @see ExtensionRegistry#queryExtensionAttributeType
*/
public void setExtensionAttribute(QName name, Object value);
/**
* Retrieve an extension attribute from this element. If the extension
* attribute is not defined, null is returned.
*
* @param name the extension attribute name
*
* @return the value of the extension attribute, or null if
* it is not defined. Can be a String, a QName, a List of Strings, or a List
* of QNames.
*
* @see #setExtensionAttribute
* @see #getExtensionAttributes
* @see ExtensionRegistry#registerExtensionAttributeType
* @see ExtensionRegistry#queryExtensionAttributeType
*/
public Object getExtensionAttribute(QName name);
/**
* Get the map containing all the extension attributes defined
* on this element. The keys are the qnames of the attributes.
*
* @return a map containing all the extension attributes defined
* on this element
*
* @see #setExtensionAttribute
* @see #getExtensionAttribute
* @see ExtensionRegistry#registerExtensionAttributeType
* @see ExtensionRegistry#queryExtensionAttributeType
*/
public Map getExtensionAttributes();
/**
* Get the list of local attribute names defined for this element in
* the WSDL specification.
*
* @return a List of Strings, one for each local attribute name
*/
public List getNativeAttributeNames();
}
wsdl4j-1.6.3/src/javax/wsdl/extensions/http/ 0000755 0001750 0001750 00000000000 12111773372 017527 5 ustar tony tony wsdl4j-1.6.3/src/javax/wsdl/extensions/http/HTTPOperation.java 0000644 0001750 0001750 00000001064 12111773372 023033 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package javax.wsdl.extensions.http;
import javax.wsdl.extensions.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public interface HTTPOperation extends ExtensibilityElement,
java.io.Serializable
{
/**
* Set the location URI for this HTTP operation.
*
* @param locationURI the desired location URI
*/
public void setLocationURI(String locationURI);
/**
* Get the location URI for this HTTP operation.
*/
public String getLocationURI();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/http/HTTPUrlReplacement.java 0000644 0001750 0001750 00000000465 12111773372 024021 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package javax.wsdl.extensions.http;
import javax.wsdl.extensions.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public interface HTTPUrlReplacement extends ExtensibilityElement,
java.io.Serializable
{
} wsdl4j-1.6.3/src/javax/wsdl/extensions/http/HTTPAddress.java 0000644 0001750 0001750 00000001007 12111773372 022455 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package javax.wsdl.extensions.http;
import javax.wsdl.extensions.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public interface HTTPAddress extends ExtensibilityElement, java.io.Serializable
{
/**
* Set the location URI for this HTTP address.
*
* @param locationURI the desired location URI
*/
public void setLocationURI(String locationURI);
/**
* Get the location URI for this HTTP address.
*/
public String getLocationURI();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/http/HTTPUrlEncoded.java 0000644 0001750 0001750 00000000455 12111773372 023122 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package javax.wsdl.extensions.http;
import javax.wsdl.extensions.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public interface HTTPUrlEncoded extends ExtensibilityElement,
java.io.Serializable
{
} wsdl4j-1.6.3/src/javax/wsdl/extensions/http/HTTPBinding.java 0000644 0001750 0001750 00000000723 12111773372 022446 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package javax.wsdl.extensions.http;
import javax.wsdl.extensions.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public interface HTTPBinding extends ExtensibilityElement, java.io.Serializable
{
/**
* Set the verb for this HTTP binding.
*
* @param verb the desired verb
*/
public void setVerb(String verb);
/**
* Get the verb for this HTTP binding.
*/
public String getVerb();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/soap12/ 0000755 0001750 0001750 00000000000 12111773372 017655 5 ustar tony tony wsdl4j-1.6.3/src/javax/wsdl/extensions/soap12/SOAP12Header.java 0000644 0001750 0001750 00000004122 12111773372 022535 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package javax.wsdl.extensions.soap12;
import java.util.*;
import javax.wsdl.extensions.*;
import javax.xml.namespace.*;
/**
* Based on javax.wsdl.extensions.SOAPHeader.
*/
public interface SOAP12Header extends ExtensibilityElement, java.io.Serializable
{
/**
* Set the message for this SOAP header.
*
* @param message the desired message
*/
public void setMessage(QName message);
/**
* Get the message for this SOAP header.
*/
public QName getMessage();
/**
* Set the part for this SOAP header.
*
* @param part the desired part
*/
public void setPart(String part);
/**
* Get the part for this SOAP header.
*/
public String getPart();
/**
* Set the use for this SOAP header.
*
* @param use the desired use
*/
public void setUse(String use);
/**
* Get the use for this SOAP header.
*/
public String getUse();
/**
* Set the encodingStyle for this SOAP header.
*
* @param encodingStyle the desired encodingStyle
*/
public void setEncodingStyle(String encodingStyle);
/**
* Get the encodingStyle for this SOAP header.
*/
public String getEncodingStyle();
/**
* Set the namespace URI for this SOAP header.
*
* @param namespaceURI the desired namespace URI
*/
public void setNamespaceURI(String namespaceURI);
/**
* Get the namespace URI for this SOAP header.
*/
public String getNamespaceURI();
/**
* Add a SOAP header fault.
*
* @param soap12HeaderFault the SOAP Header fault to be added.
*/
public void addSOAP12HeaderFault(SOAP12HeaderFault soap12HeaderFault);
/**
* Get a list of all SOAP header faults contained in this SOAP header.
*
* @return a list of all SOAP header faults contained in this SOAP header.
*/
public List getSOAP12HeaderFaults();
/**
* Remove a SOAP header fault.
*
* @param soap12HeaderFault the SOAP header fault to be removed.
* @return the SOAP header fault which was removed.
*/
public SOAP12HeaderFault removeSOAP12HeaderFault(SOAP12HeaderFault soap12HeaderFault);
} wsdl4j-1.6.3/src/javax/wsdl/extensions/soap12/SOAP12Operation.java 0000644 0001750 0001750 00000002431 12111773372 023306 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package javax.wsdl.extensions.soap12;
import javax.wsdl.extensions.*;
/**
* Based on javax.wsdl.extensions.SOAPOperation.
*/
public interface SOAP12Operation extends ExtensibilityElement,
java.io.Serializable
{
/**
* Set the SOAP action attribute.
*
* @param soapActionURI the desired value of the SOAP
* action header for this operation.
*/
public void setSoapActionURI(String soapActionURI);
/**
* Get the value of the SOAP action attribute.
*
* @return the SOAP action attribute's value
*/
public String getSoapActionURI();
/**
* Specify whether the SOAP Action is required for this operation.
*
* @param soapActionRequired true if the SOAP Action is required, otherwise false.
*/
public void setSoapActionRequired(Boolean soapActionRequired);
/**
* Indicates whether the SOAP Action is required for this operation.
*
* @return true if the SOAP action is required, otherwise false.
*/
public Boolean getSoapActionRequired();
/**
* Set the style for this SOAP operation.
*
* @param style the desired style
*/
public void setStyle(String style);
/**
* Get the style for this SOAP operation.
*/
public String getStyle();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/soap12/SOAP12Fault.java 0000644 0001750 0001750 00000002242 12111773372 022421 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package javax.wsdl.extensions.soap12;
import javax.wsdl.extensions.*;
/**
* Based on javax.wsdl.extensions.SOAPFault.
*/
public interface SOAP12Fault extends ExtensibilityElement, java.io.Serializable
{
/**
* Set the name for this SOAP fault.
*
* @param name the desired name
*/
public void setName(String name);
/**
* Get the name for this SOAP fault.
*/
public String getName();
/**
* Set the use for this SOAP fault.
*
* @param use the desired use
*/
public void setUse(String use);
/**
* Get the use for this SOAP fault.
*/
public String getUse();
/**
* Set the encodingStyle for this SOAP fault.
*
* @param encodingStyle the desired encodingStyle
*/
public void setEncodingStyle(String encodingStyle);
/**
* Get the encodingStyle for this SOAP fault.
*/
public String getEncodingStyle();
/**
* Set the namespace URI for this SOAP fault.
*
* @param namespaceURI the desired namespace URI
*/
public void setNamespaceURI(String namespaceURI);
/**
* Get the namespace URI for this SOAP fault.
*/
public String getNamespaceURI();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/soap12/SOAP12Body.java 0000644 0001750 0001750 00000002257 12111773372 022251 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package javax.wsdl.extensions.soap12;
import java.util.*;
import javax.wsdl.extensions.*;
/**
* Based on javax.wsdl.extensions.SOAPBody.
*/
public interface SOAP12Body extends ExtensibilityElement, java.io.Serializable
{
/**
* Set the parts for this SOAP body.
*
* @param parts the desired parts
*/
public void setParts(List parts);
/**
* Get the parts for this SOAP body.
*/
public List getParts();
/**
* Set the use for this SOAP body.
*
* @param use the desired use
*/
public void setUse(String use);
/**
* Get the use for this SOAP body.
*/
public String getUse();
/**
* Set the encodingStyle for this SOAP body.
*
* @param encodingStyle the desired encodingStyle
*/
public void setEncodingStyle(String encodingStyle);
/**
* Get the encodingStyle for this SOAP body.
*/
public String getEncodingStyle();
/**
* Set the namespace URI for this SOAP body.
*
* @param namespaceURI the desired namespace URI
*/
public void setNamespaceURI(String namespaceURI);
/**
* Get the namespace URI for this SOAP body.
*/
public String getNamespaceURI();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/soap12/SOAP12Address.java 0000644 0001750 0001750 00000001011 12111773372 022724 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package javax.wsdl.extensions.soap12;
import javax.wsdl.extensions.*;
/**
* Copied from javax.wsdl.extensions.soap.SOAPAddress.
*/
public interface SOAP12Address extends ExtensibilityElement, java.io.Serializable
{
/**
* Set the location URI for this SOAP address.
*
* @param locationURI the desired location URI
*/
public void setLocationURI(String locationURI);
/**
* Get the location URI for this SOAP address.
*/
public String getLocationURI();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/soap12/SOAP12Binding.java 0000644 0001750 0001750 00000001534 12111773372 022723 0 ustar tony tony /*
* (c) Copyright IBM Corp 20016
*/
package javax.wsdl.extensions.soap12;
import javax.wsdl.extensions.*;
/**
* Copied from javax.wsdl.extensions.soap.SOAPBinding.
*/
public interface SOAP12Binding extends ExtensibilityElement, java.io.Serializable
{
/**
* Set the style for this SOAP binding.
*
* @param style the desired style
*/
public void setStyle(String style);
/**
* Get the style for this SOAP binding.
*/
public String getStyle();
/**
* Set the SOAP transport URI to be used for communicating
* with this binding.
*
* @param transportURI the URI describing the transport
* to be used
*/
public void setTransportURI(String transportURI);
/**
* Get the transport URI to be used with this binding.
*
* @return the transport URI to be used
*/
public String getTransportURI();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/soap12/SOAP12HeaderFault.java 0000644 0001750 0001750 00000003034 12111773372 023532 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package javax.wsdl.extensions.soap12;
import javax.wsdl.extensions.*;
import javax.xml.namespace.*;
/**
* Based on javax.wsdl.extensions.SOAPHeaderFault.
*/
public interface SOAP12HeaderFault extends ExtensibilityElement,
java.io.Serializable
{
/**
* Set the message for this SOAP header fault.
*
* @param message the desired message
*/
public void setMessage(QName message);
/**
* Get the message for this SOAP header fault.
*/
public QName getMessage();
/**
* Set the part for this SOAP header fault.
*
* @param part the desired part
*/
public void setPart(String part);
/**
* Get the part for this SOAP header fault.
*/
public String getPart();
/**
* Set the use for this SOAP header fault.
*
* @param use the desired use
*/
public void setUse(String use);
/**
* Get the use for this SOAP header fault.
*/
public String getUse();
/**
* Set the encodingStyle for this SOAP header fault.
*
* @param encodingStyle the desired encodingStyle
*/
public void setEncodingStyle(String encodingStyle);
/**
* Get the encodingStyle for this SOAP header fault.
*/
public String getEncodingStyle();
/**
* Set the namespace URI for this SOAP header fault.
*
* @param namespaceURI the desired namespace URI
*/
public void setNamespaceURI(String namespaceURI);
/**
* Get the namespace URI for this SOAP header fault.
*/
public String getNamespaceURI();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/soap/ 0000755 0001750 0001750 00000000000 12111773372 017512 5 ustar tony tony wsdl4j-1.6.3/src/javax/wsdl/extensions/soap/SOAPHeader.java 0000644 0001750 0001750 00000004112 12111773372 022226 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl.extensions.soap;
import java.util.*;
import javax.wsdl.extensions.*;
import javax.xml.namespace.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public interface SOAPHeader extends ExtensibilityElement, java.io.Serializable
{
/**
* Set the message for this SOAP header.
*
* @param message the desired message
*/
public void setMessage(QName message);
/**
* Get the message for this SOAP header.
*/
public QName getMessage();
/**
* Set the part for this SOAP header.
*
* @param part the desired part
*/
public void setPart(String part);
/**
* Get the part for this SOAP header.
*/
public String getPart();
/**
* Set the use for this SOAP header.
*
* @param use the desired use
*/
public void setUse(String use);
/**
* Get the use for this SOAP header.
*/
public String getUse();
/**
* Set the encodingStyles for this SOAP header.
*
* @param encodingStyles the desired encodingStyles
*/
public void setEncodingStyles(List encodingStyles);
/**
* Get the encodingStyles for this SOAP header.
*/
public List getEncodingStyles();
/**
* Set the namespace URI for this SOAP header.
*
* @param namespaceURI the desired namespace URI
*/
public void setNamespaceURI(String namespaceURI);
/**
* Get the namespace URI for this SOAP header.
*/
public String getNamespaceURI();
/**
* Add a SOAP header fault.
*
* @param soapHeaderFault the SOAP Header fault to be added.
*/
public void addSOAPHeaderFault(SOAPHeaderFault soapHeaderFault);
/**
* Remove a SOAP header fault.
*
* @param soapHeaderFault the SOAP header fault to be removed.
* @return the SOAP header fault which was removed.
*/
public SOAPHeaderFault removeSOAPHeaderFault(SOAPHeaderFault soapHeaderFault);
/**
* Get a list of all SOAP header faults contained in this SOAP header.
*
* @return a list of all SOAP header faults contained in this SOAP header.
*/
public List getSOAPHeaderFaults();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/soap/SOAPBody.java 0000644 0001750 0001750 00000002273 12111773372 021741 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package javax.wsdl.extensions.soap;
import java.util.*;
import javax.wsdl.extensions.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public interface SOAPBody extends ExtensibilityElement, java.io.Serializable
{
/**
* Set the parts for this SOAP body.
*
* @param parts the desired parts
*/
public void setParts(List parts);
/**
* Get the parts for this SOAP body.
*/
public List getParts();
/**
* Set the use for this SOAP body.
*
* @param use the desired use
*/
public void setUse(String use);
/**
* Get the use for this SOAP body.
*/
public String getUse();
/**
* Set the encodingStyles for this SOAP body.
*
* @param encodingStyles the desired encodingStyles
*/
public void setEncodingStyles(List encodingStyles);
/**
* Get the encodingStyles for this SOAP body.
*/
public List getEncodingStyles();
/**
* Set the namespace URI for this SOAP body.
*
* @param namespaceURI the desired namespace URI
*/
public void setNamespaceURI(String namespaceURI);
/**
* Get the namespace URI for this SOAP body.
*/
public String getNamespaceURI();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/soap/SOAPHeaderFault.java 0000644 0001750 0001750 00000003065 12111773372 023230 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package javax.wsdl.extensions.soap;
import java.util.*;
import javax.wsdl.extensions.*;
import javax.xml.namespace.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public interface SOAPHeaderFault extends ExtensibilityElement,
java.io.Serializable
{
/**
* Set the message for this SOAP header fault.
*
* @param message the desired message
*/
public void setMessage(QName message);
/**
* Get the message for this SOAP header fault.
*/
public QName getMessage();
/**
* Set the part for this SOAP header fault.
*
* @param part the desired part
*/
public void setPart(String part);
/**
* Get the part for this SOAP header fault.
*/
public String getPart();
/**
* Set the use for this SOAP header fault.
*
* @param use the desired use
*/
public void setUse(String use);
/**
* Get the use for this SOAP header fault.
*/
public String getUse();
/**
* Set the encodingStyles for this SOAP header fault.
*
* @param encodingStyles the desired encodingStyles
*/
public void setEncodingStyles(List encodingStyles);
/**
* Get the encodingStyles for this SOAP header fault.
*/
public List getEncodingStyles();
/**
* Set the namespace URI for this SOAP header fault.
*
* @param namespaceURI the desired namespace URI
*/
public void setNamespaceURI(String namespaceURI);
/**
* Get the namespace URI for this SOAP header fault.
*/
public String getNamespaceURI();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/soap/SOAPFault.java 0000644 0001750 0001750 00000002301 12111773372 022107 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package javax.wsdl.extensions.soap;
import java.util.*;
import javax.wsdl.extensions.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public interface SOAPFault extends ExtensibilityElement, java.io.Serializable
{
/**
* Set the name for this SOAP fault.
*
* @param name the desired name
*/
public void setName(String name);
/**
* Get the name for this SOAP fault.
*/
public String getName();
/**
* Set the use for this SOAP fault.
*
* @param use the desired use
*/
public void setUse(String use);
/**
* Get the use for this SOAP fault.
*/
public String getUse();
/**
* Set the encodingStyles for this SOAP fault.
*
* @param encodingStyles the desired encodingStyles
*/
public void setEncodingStyles(List encodingStyles);
/**
* Get the encodingStyles for this SOAP fault.
*/
public List getEncodingStyles();
/**
* Set the namespace URI for this SOAP fault.
*
* @param namespaceURI the desired namespace URI
*/
public void setNamespaceURI(String namespaceURI);
/**
* Get the namespace URI for this SOAP fault.
*/
public String getNamespaceURI();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/soap/SOAPAddress.java 0000644 0001750 0001750 00000001007 12111773372 022423 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package javax.wsdl.extensions.soap;
import javax.wsdl.extensions.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public interface SOAPAddress extends ExtensibilityElement, java.io.Serializable
{
/**
* Set the location URI for this SOAP address.
*
* @param locationURI the desired location URI
*/
public void setLocationURI(String locationURI);
/**
* Get the location URI for this SOAP address.
*/
public String getLocationURI();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/soap/SOAPOperation.java 0000644 0001750 0001750 00000002051 12111773372 022776 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package javax.wsdl.extensions.soap;
import javax.wsdl.extensions.*;
/**
* This class stores information associated with a SOAP operation that
* acts as the concrete implementation of an abstract operation specified
* in WSDL.
*
* @author Nirmal Mukhi (nmukhi@us.ibm.com)
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public interface SOAPOperation extends ExtensibilityElement,
java.io.Serializable
{
/**
* Set the SOAP action attribute.
*
* @param soapActionURI the desired value of the SOAP
* action header for this operation.
*/
public void setSoapActionURI(String soapActionURI);
/**
* Get the value of the SOAP action attribute.
*
* @return the SOAP action attribute's value
*/
public String getSoapActionURI();
/**
* Set the style for this SOAP operation.
*
* @param style the desired style
*/
public void setStyle(String style);
/**
* Get the style for this SOAP operation.
*/
public String getStyle();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/soap/SOAPBinding.java 0000644 0001750 0001750 00000001531 12111773372 022412 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package javax.wsdl.extensions.soap;
import javax.wsdl.extensions.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public interface SOAPBinding extends ExtensibilityElement, java.io.Serializable
{
/**
* Set the style for this SOAP binding.
*
* @param style the desired style
*/
public void setStyle(String style);
/**
* Get the style for this SOAP binding.
*/
public String getStyle();
/**
* Set the SOAP transport URI to be used for communicating
* with this binding.
*
* @param transportURI the URI describing the transport
* to be used
*/
public void setTransportURI(String transportURI);
/**
* Get the transport URI to be used with this binding.
*
* @return the transport URI to be used
*/
public String getTransportURI();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/ElementExtensible.java 0000644 0001750 0001750 00000001617 12111773372 023034 0 ustar tony tony /*
* (c) Copyright IBM Corp 2004, 2006
*/
package javax.wsdl.extensions;
import java.util.*;
import javax.wsdl.extensions.ExtensibilityElement;
/**
* Classes that implement this interface can contain extensibility
* elements.
*
* @author John Kaputin
*/
public interface ElementExtensible {
/**
* Add an extensibility element.
*
* @param extElement the extensibility element to be added
*/
public void addExtensibilityElement(ExtensibilityElement extElement);
/**
* Remove an extensibility element.
*
* @param extElement the extensibility element to be removed
* @return the extensibility element which was removed
*/
public ExtensibilityElement removeExtensibilityElement(ExtensibilityElement extElement);
/**
* Get all the extensibility elements defined here.
*/
public List getExtensibilityElements();
}
wsdl4j-1.6.3/src/javax/wsdl/extensions/ExtensionRegistry.java 0000644 0001750 0001750 00000037373 12111773372 023135 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package javax.wsdl.extensions;
import java.util.*;
import javax.wsdl.*;
import javax.xml.namespace.*;
/**
* This class is used to associate serializers, deserializers, and
* Java implementation types with extensibility elements.
*
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class ExtensionRegistry implements java.io.Serializable
{
public static final long serialVersionUID = 1;
/**
* Creates the extension registry, and sets the defaultSerializer
* and defaultDeserializer properties to instances of an
* UnknownExtensionSerializer, and an UnknownExtensionDeserializer,
* respectively.
*/
public ExtensionRegistry()
{
setDefaultSerializer(new UnknownExtensionSerializer());
setDefaultDeserializer(new UnknownExtensionDeserializer());
}
/*
This is a Map of Maps. The top-level Map is keyed by (Class)parentType,
and the inner Maps are keyed by (QName)elementType.
*/
protected Map serializerReg = new Hashtable();
/*
This is a Map of Maps. The top-level Map is keyed by (Class)parentType,
and the inner Maps are keyed by (QName)elementType.
*/
protected Map deserializerReg = new Hashtable();
/*
This is a Map of Maps. The top-level Map is keyed by (Class)parentType,
and the inner Maps are keyed by (QName)elementType.
*/
protected Map extensionTypeReg = new Hashtable();
protected ExtensionSerializer defaultSer = null;
protected ExtensionDeserializer defaultDeser = null;
/*
This is a Map of Maps. The top-level Map is keyed by (Class)parentType,
and the inner Maps are keyed by (QName)attrName.
*/
protected Map extensionAttributeTypeReg = new Hashtable();
/**
* Set the serializer to be used when none is found for an extensibility
* element. Set this to null to have an exception thrown when
* unexpected extensibility elements are encountered. Default value is
* an instance of UnknownExtensionSerializer.
*
* @see UnknownExtensionSerializer
*/
public void setDefaultSerializer(ExtensionSerializer defaultSer)
{
this.defaultSer = defaultSer;
}
/**
* Get the serializer to be used when none is found for an extensibility
* element. Default value is an instance of UnknownExtensionSerializer.
*
* @see UnknownExtensionSerializer
*/
public ExtensionSerializer getDefaultSerializer()
{
return defaultSer;
}
/**
* Set the deserializer to be used when none is found for an encountered
* element. Set this to null to have an exception thrown when
* unexpected extensibility elements are encountered. Default value is
* an instance of UnknownExtensionDeserializer.
*
* @see UnknownExtensionDeserializer
*/
public void setDefaultDeserializer(ExtensionDeserializer defaultDeser)
{
this.defaultDeser = defaultDeser;
}
/**
* Get the deserializer to be used when none is found for an encountered
* element. Default value is an instance of UnknownExtensionDeserializer.
*
* @see UnknownExtensionDeserializer
*/
public ExtensionDeserializer getDefaultDeserializer()
{
return defaultDeser;
}
/**
* Declare that the specified serializer should be used to serialize
* all extensibility elements with a qname matching elementType, when
* encountered as children of the specified parentType.
*
* @param parentType a class object indicating where in the WSDL
* definition this extension was encountered. For
* example, javax.wsdl.Binding.class would be used to indicate
* this extensibility element was found in the list of
* extensibility elements belonging to a javax.wsdl.Binding.
* @param elementType the qname of the extensibility element
* @param es the extension serializer to use
*
* @see #querySerializer(Class, QName)
*/
public void registerSerializer(Class parentType,
QName elementType,
ExtensionSerializer es)
{
Map innerSerializerReg = (Map)serializerReg.get(parentType);
if (innerSerializerReg == null)
{
innerSerializerReg = new Hashtable();
serializerReg.put(parentType, innerSerializerReg);
}
innerSerializerReg.put(elementType, es);
}
/**
* Declare that the specified deserializer should be used to deserialize
* all extensibility elements with a qname matching elementType, when
* encountered as immediate children of the element represented by the
* specified parentType.
*
* @param parentType a class object indicating where in the WSDL
* document this extensibility element was encountered. For
* example, javax.wsdl.Binding.class would be used to indicate
* this element was encountered as an immediate child of
* a <wsdl:binding> element.
* @param elementType the qname of the extensibility element
* @param ed the extension deserializer to use
*
* @see #queryDeserializer(Class, QName)
*/
public void registerDeserializer(Class parentType,
QName elementType,
ExtensionDeserializer ed)
{
Map innerDeserializerReg = (Map)deserializerReg.get(parentType);
if (innerDeserializerReg == null)
{
innerDeserializerReg = new Hashtable();
deserializerReg.put(parentType, innerDeserializerReg);
}
innerDeserializerReg.put(elementType, ed);
}
/**
* Look up the serializer to use for the extensibility element with
* the qname elementType, which was encountered as a child of the
* specified parentType.
*
* @param parentType a class object indicating where in the WSDL
* definition this extension was encountered. For
* example, javax.wsdl.Binding.class would be used to indicate
* this extensibility element was found in the list of
* extensibility elements belonging to a javax.wsdl.Binding.
* @param elementType the qname of the extensibility element
*
* @return the extension serializer, if one was found. If none was
* found, the behavior depends on the value of the defaultSerializer
* property. If the defaultSerializer property is set to a non-null
* value, that value is returned; otherwise, a WSDLException is
* thrown.
*
* @see #registerSerializer(Class, QName, ExtensionSerializer)
* @see #setDefaultSerializer(ExtensionSerializer)
*/
public ExtensionSerializer querySerializer(Class parentType,
QName elementType)
throws WSDLException
{
Map innerSerializerReg = (Map)serializerReg.get(parentType);
ExtensionSerializer es = null;
if (innerSerializerReg != null)
{
es = (ExtensionSerializer)innerSerializerReg.get(elementType);
}
if (es == null)
{
es = defaultSer;
}
if (es == null)
{
throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
"No ExtensionSerializer found " +
"to serialize a '" + elementType +
"' element in the context of a '" +
parentType.getName() + "'.");
}
return es;
}
/**
* Look up the deserializer for the extensibility element with the
* qname elementType, which was encountered as an immediate child
* of the element represented by the specified parentType.
*
* @param parentType a class object indicating where in the WSDL
* document this extensibility element was encountered. For
* example, javax.wsdl.Binding.class would be used to indicate
* this element was encountered as an immediate child of
* a <wsdl:binding> element.
* @param elementType the qname of the extensibility element
*
* @return the extension deserializer, if one was found. If none was
* found, the behavior depends on the value of the defaultDeserializer
* property. If the defaultDeserializer property is set to a non-null
* value, that value is returned; otherwise, a WSDLException is thrown.
*
* @see #registerDeserializer(Class, QName, ExtensionDeserializer)
* @see #setDefaultDeserializer(ExtensionDeserializer)
*/
public ExtensionDeserializer queryDeserializer(Class parentType,
QName elementType)
throws WSDLException
{
Map innerDeserializerReg = (Map)deserializerReg.get(parentType);
ExtensionDeserializer ed = null;
if (innerDeserializerReg != null)
{
ed = (ExtensionDeserializer)innerDeserializerReg.get(elementType);
}
if (ed == null)
{
ed = defaultDeser;
}
if (ed == null)
{
throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
"No ExtensionDeserializer found " +
"to deserialize a '" + elementType +
"' element in the context of a '" +
parentType.getName() + "'.");
}
return ed;
}
/**
* Returns a set of QNames representing the extensibility elements
* that are allowed as children of the specified parent type.
* Basically, this method returns the keys associated with the set
* of extension deserializers registered for this parent type.
* Returns null if no extension deserializers are registered for
* this parent type.
*/
public Set getAllowableExtensions(Class parentType)
{
Map innerDeserializerReg = (Map)deserializerReg.get(parentType);
return (innerDeserializerReg != null)
? innerDeserializerReg.keySet()
: null;
}
/**
* Declare that the specified extensionType is the concrete
* class which should be used to represent extensibility elements
* with qnames matching elementType, that are intended to exist as
* children of the specified parentType.
*
* @param parentType a class object indicating where in the WSDL
* definition this extension would exist. For example,
* javax.wsdl.Binding.class would be used to indicate
* this extensibility element would be added to the list of
* extensibility elements belonging to a javax.wsdl.Binding,
* after being instantiated.
* @param elementType the qname of the extensibility element
* @param extensionType the concrete class which should be instantiated
*
* @see #createExtension(Class, QName)
*/
public void mapExtensionTypes(Class parentType,
QName elementType,
Class extensionType)
{
Map innerExtensionTypeReg = (Map)extensionTypeReg.get(parentType);
if (innerExtensionTypeReg == null)
{
innerExtensionTypeReg = new Hashtable();
extensionTypeReg.put(parentType, innerExtensionTypeReg);
}
innerExtensionTypeReg.put(elementType, extensionType);
}
/**
* Create an instance of the type which was declared to be used to
* represent extensibility elements with qnames matching elementType,
* when intended to exist as children of the specified parentType.
* This method allows a user to instantiate an extensibility element
* without having to know the implementing type.
*
* @param parentType a class object indicating where in the WSDL
* definition this extension will exist. For example,
* javax.wsdl.Binding.class would be used to indicate
* this extensibility element is going to be added to the list of
* extensibility elements belonging to a javax.wsdl.Binding,
* after being instantiated.
* @param elementType the qname of the extensibility element
*
* @return a new instance of the type used to represent the
* specified extension
*
* @see #mapExtensionTypes(Class, QName, Class)
*/
public ExtensibilityElement createExtension(Class parentType,
QName elementType)
throws WSDLException
{
Map innerExtensionTypeReg = (Map)extensionTypeReg.get(parentType);
Class extensionType = null;
if (innerExtensionTypeReg != null)
{
extensionType = (Class)innerExtensionTypeReg.get(elementType);
}
if (extensionType == null)
{
throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
"No Java extensionType found " +
"to represent a '" + elementType +
"' element in the context of a '" +
parentType.getName() + "'.");
}
else if (!(ExtensibilityElement.class.isAssignableFrom(extensionType)))
{
throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
"The Java extensionType '" +
extensionType.getName() + "' does " +
"not implement the ExtensibilityElement " +
"interface.");
}
try
{
ExtensibilityElement ee = (ExtensibilityElement)extensionType.newInstance();
if (ee.getElementType() == null)
{
ee.setElementType(elementType);
}
return ee;
}
catch (Exception e)
{
/*
Catches:
InstantiationException
IllegalAccessException
*/
throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
"Problem instantiating Java " +
"extensionType '" + extensionType.getName() +
"'.",
e);
}
}
/**
* Declare that the type of the specified extension attribute, when it occurs
* as an attribute of the specified parent type, should be assumed to be
* attrType.
*
* @param parentType a class object indicating where in the WSDL
* document this extensibility attribute was encountered. For
* example, javax.wsdl.Binding.class would be used to indicate
* this attribute was defined on a <wsdl:binding> element.
* @param attrName the qname of the extensibility attribute
* @param attrType one of the constants defined on the AttributeExtensible
* class
*
* @see #queryExtensionAttributeType(Class, QName)
* @see AttributeExtensible
*/
public void registerExtensionAttributeType(Class parentType,
QName attrName,
int attrType)
{
Map innerExtensionAttributeTypeReg =
(Map)extensionAttributeTypeReg.get(parentType);
if (innerExtensionAttributeTypeReg == null)
{
innerExtensionAttributeTypeReg = new Hashtable();
extensionAttributeTypeReg.put(parentType, innerExtensionAttributeTypeReg);
}
innerExtensionAttributeTypeReg.put(attrName, new Integer(attrType));
}
/**
* Look up the type of the extensibility attribute with the qname attrName,
* which was defined on an element represented by the specified parentType.
*
* @param parentType a class object indicating where in the WSDL
* document this extensibility attribute was encountered. For
* example, javax.wsdl.Binding.class would be used to indicate
* this attribute was defined on a <wsdl:binding> element.
* @param attrName the qname of the extensibility attribute
*
* @return one of the constants defined on the AttributeExtensible class
*
* @see #registerExtensionAttributeType(Class, QName, int)
* @see AttributeExtensible
*/
public int queryExtensionAttributeType(Class parentType, QName attrName)
{
Map innerExtensionAttributeTypeReg =
(Map)extensionAttributeTypeReg.get(parentType);
Integer attrType = null;
if (innerExtensionAttributeTypeReg != null)
{
attrType = (Integer)innerExtensionAttributeTypeReg.get(attrName);
}
if (attrType != null)
{
return attrType.intValue();
}
else
{
return AttributeExtensible.NO_DECLARED_TYPE;
}
}
} wsdl4j-1.6.3/src/javax/wsdl/extensions/UnknownExtensibilityElement.java 0000644 0001750 0001750 00000004170 12111773372 025143 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package javax.wsdl.extensions;
import org.w3c.dom.*;
import javax.xml.namespace.*;
/**
* This class is used to wrap arbitrary elements.
*
* @see UnknownExtensionSerializer
* @see UnknownExtensionDeserializer
*
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class UnknownExtensibilityElement implements ExtensibilityElement,
java.io.Serializable
{
protected QName elementType = null;
// Uses the wrapper type so we can tell if it was set or not.
protected Boolean required = null;
protected Element element = null;
public static final long serialVersionUID = 1;
/**
* Set the type of this extensibility element.
*
* @param elementType the type
*/
public void setElementType(QName elementType)
{
this.elementType = elementType;
}
/**
* Get the type of this extensibility element.
*
* @return the extensibility element's type
*/
public QName getElementType()
{
return elementType;
}
/**
* Set whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public void setRequired(Boolean required)
{
this.required = required;
}
/**
* Get whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public Boolean getRequired()
{
return required;
}
/**
* Set the Element for this extensibility element.
*
* @param element the unknown element that was encountered
*/
public void setElement(Element element)
{
this.element = element;
}
/**
* Get the Element for this extensibility element.
*
* @return the unknown element that was encountered
*/
public Element getElement()
{
return element;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("UnknownExtensibilityElement (" + elementType + "):");
strBuf.append("\nrequired=" + required);
if (element != null)
{
strBuf.append("\nelement=" + element);
}
return strBuf.toString();
}
} wsdl4j-1.6.3/src/javax/wsdl/extensions/UnknownExtensionSerializer.java 0000644 0001750 0001750 00000002163 12111773372 025003 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl.extensions;
import java.io.*;
import javax.wsdl.*;
import javax.xml.namespace.*;
import com.ibm.wsdl.util.xml.*;
/**
* This class is used to serialize UnknownExtensibilityElement instances
* into the PrintWriter.
*
* @see UnknownExtensibilityElement
* @see UnknownExtensionDeserializer
*
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class UnknownExtensionSerializer implements ExtensionSerializer,
Serializable
{
public static final long serialVersionUID = 1;
public void marshall(Class parentType,
QName elementType,
ExtensibilityElement extension,
PrintWriter pw,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
UnknownExtensibilityElement unknownExt =
(UnknownExtensibilityElement)extension;
pw.print(" ");
DOM2Writer.serializeAsXML(unknownExt.getElement(), def.getNamespaces(), pw);
pw.println();
}
} wsdl4j-1.6.3/src/javax/wsdl/extensions/schema/ 0000755 0001750 0001750 00000000000 12111773372 020010 5 ustar tony tony wsdl4j-1.6.3/src/javax/wsdl/extensions/schema/Schema.java 0000644 0001750 0001750 00000006463 12111773372 022064 0 ustar tony tony /*
* (c) Copyright IBM Corp 2004, 2005
*/
package javax.wsdl.extensions.schema;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import javax.wsdl.extensions.ExtensibilityElement;
import org.w3c.dom.Element;
/**
* Represents a schema element.
* This is a lightweight schema wrapper that provides access to
* the schema DOM element, but does not parse the schema details.
* The implementor may provide alternative schema parsing if required.
*
* @author Jeremy Hughes
*
*/
public interface Schema extends ExtensibilityElement, Serializable
{
/**
* Get a map of lists containing all the imports defined here.
* The map's keys are the namespaceURIs, and the map's values
* are lists. There is one list for each namespaceURI for which
* imports have been defined.
*
* @return a map of lists of schema imports
*/
public Map getImports();
/**
* Create a new schema import
*
* @return the newly created schema import
*/
public SchemaImport createImport();
/**
* Add an import to this LightWeightSchema
*
* @param importSchema the import to be added
*/
public void addImport(SchemaImport importSchema);
/**
* Get a list containing all of the includes defined here.
* The list elements are schema references.
*
* @return a list of schema references.
*/
public List getIncludes();
/**
* Create a new schema reference to represent an include.
*
* @return the newly created SchemaReference
*/
public SchemaReference createInclude();
/**
* Add an include to this LightWeightSchema
*
* @param includeSchema The include to be added, represented as a SchemaReference
*/
public void addInclude(SchemaReference includeSchema);
/**
* Get a list containing all of the redefines defined here.
* The list elements are schema references.
*
* @return a list of schema references.
*/
public List getRedefines();
/**
* Create a new schema reference to represent a redefine.
*
* @return the newly created SchemaReference
*/
public SchemaReference createRedefine();
/**
* Add a redefine to this LightWeightSchema
*
* @param redefineSchema The redefine to be added, represented as a SchemaReference
*/
public void addRedefine(SchemaReference redefineSchema);
/**
* Set the DOM Element that represents this schema element.
*
* @param element the DOM element representing this schema
*/
public void setElement(Element element);
/**
* Get the DOM Element that represents this schema element.
*
* @return the DOM element representing this schema
*/
public Element getElement();
/**
* Set the document base URI of this schema definition. Can be used to
* represent the origin of the schema, and can be exploited
* when resolving relative URIs (e.g. in <import>s).
*
* @param documentBaseURI the document base URI of this schema
*/
public void setDocumentBaseURI(String documentBaseURI);
/**
* Get the document base URI of this schema
*
* @return the document base URI
*/
public String getDocumentBaseURI();
} wsdl4j-1.6.3/src/javax/wsdl/extensions/schema/SchemaImport.java 0000644 0001750 0001750 00000001021 12111773372 023240 0 ustar tony tony /*
* (c) Copyright IBM Corp 2004, 2005
*/
package javax.wsdl.extensions.schema;
/**
* Represents an import element within a schema element.
* Similar to an include or redefine, but includes a namespace.
*
* @author Jeremy Hughes
* There are no minimum features that must be supported.
*
* All feature names must be fully-qualified, Java package style. All
* names starting with javax.wsdl. are reserved for features defined
* by the JWSDL specification. It is recommended that implementation-
* specific features be fully-qualified to match the package name
* of that implementation. For example: com.abc.featureName
*
* @param name the name of the feature to be set.
* @param value the value to set the feature to.
* @throws IllegalArgumentException if the feature name is not recognized.
* @see #getFeature(String)
*/
public void setFeature(String name, boolean value)
throws IllegalArgumentException;
/**
* Gets the value of the specified feature.
*
* @param name the name of the feature to get the value of.
* @return the value of the feature.
* @throws IllegalArgumentException if the feature name is not recognized.
* @see #setFeature(String, boolean)
*/
public boolean getFeature(String name) throws IllegalArgumentException;
/**
* Return a document generated from the specified WSDL model.
*/
public Document getDocument(Definition wsdlDef) throws WSDLException;
/**
* Write the specified WSDL definition to the specified Writer.
*
* @param wsdlDef the WSDL definition to be written.
* @param sink the Writer to write the xml to.
*/
public void writeWSDL(Definition wsdlDef, Writer sink)
throws WSDLException;
/**
* Write the specified WSDL definition to the specified OutputStream.
*
* @param wsdlDef the WSDL definition to be written.
* @param sink the OutputStream to write the xml to.
*/
public void writeWSDL(Definition wsdlDef, OutputStream sink)
throws WSDLException;
} wsdl4j-1.6.3/src/javax/wsdl/xml/WSDLReader.java 0000644 0001750 0001750 00000015717 12111773372 017723 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl.xml;
import org.w3c.dom.*;
import org.xml.sax.*;
import javax.wsdl.*;
import javax.wsdl.extensions.*;
/**
* This interface describes a collection of methods
* that enable conversion of a WSDL document (in XML,
* following the WSDL schema described in the WSDL
* specification) into a WSDL model.
*
* @author Matthew J. Duftler
*/
public interface WSDLReader
{
/**
* Sets the specified feature to the specified value.
*
* The minimum features that must be supported are:
*
*
* All feature names must be fully-qualified, Java package style. All
* names starting with javax.wsdl. are reserved for features defined
* by the JWSDL specification. It is recommended that implementation-
* specific features be fully-qualified to match the package name
* of that implementation. For example: com.abc.featureName
*
* @param name the name of the feature to be set.
* @param value the value to set the feature to.
* @throws IllegalArgumentException if the feature name is not recognized.
* @see #getFeature(String)
*/
public void setFeature(String name, boolean value)
throws IllegalArgumentException;
/**
* Gets the value of the specified feature.
*
* @param name the name of the feature to get the value of.
* @return the value of feature
* @throws IllegalArgumentException if the feature name is not recognized.
* @see #setFeature(String, boolean)
*/
public boolean getFeature(String name) throws IllegalArgumentException;
/**
* Set the extension registry to be used when reading
* WSDL documents into a WSDL definition. If an
* extension registry is set, that is the extension
* registry that will be set as the extensionRegistry
* property of the definitions resulting from invoking
* readWSDL(...). Default is null.
*
* @param extReg the extension registry to use for new
* definitions
*/
public void setExtensionRegistry(ExtensionRegistry extReg);
/**
* Get the extension registry, if one was set. Default is
* null.
*/
public ExtensionRegistry getExtensionRegistry();
/**
* Set a different factory implementation to use for
* creating definitions when reading WSDL documents.
* As some WSDLReader implementations may only be
* capable of creating definitions using the same
* factory implementation from which the reader was
* obtained, this method is optional. Default is null.
*
* @param factoryImplName the fully-qualified class name of the
* class which provides a concrete implementation of the abstract
* class WSDLFactory.
* @throws UnsupportedOperationException if this method
* is invoked on an implementation which does not
* support it.
*/
public void setFactoryImplName(String factoryImplName)
throws UnsupportedOperationException;
/**
* Get the factoryImplName, if one was set. Default is null.
*/
public String getFactoryImplName();
/**
* Read the WSDL document accessible via the specified
* URI into a WSDL definition.
*
* @param wsdlURI a URI (can be a filename or URL) pointing to a
* WSDL XML definition.
* @return the definition.
*/
public Definition readWSDL(String wsdlURI) throws WSDLException;
/**
* Read the WSDL document accessible via the specified
* URI into a WSDL definition.
*
* @param contextURI the context in which to resolve the
* wsdlURI, if the wsdlURI is relative. Can be null, in which
* case it will be ignored.
* @param wsdlURI a URI (can be a filename or URL) pointing to a
* WSDL XML definition.
* @return the definition.
*/
public Definition readWSDL(String contextURI, String wsdlURI)
throws WSDLException;
/**
* Read the specified <wsdl:definitions> element into a WSDL
* definition.
*
* @param documentBaseURI the document base URI of the WSDL definition
* described by the element. Will be set as the documentBaseURI
* of the returned Definition. Can be null, in which case it
* will be ignored.
* @param definitionsElement the <wsdl:definitions> element
* @return the definition described by the element.
*/
public Definition readWSDL(String documentBaseURI,
Element definitionsElement)
throws WSDLException;
/**
* Read the specified <wsdl:definitions> element into a WSDL
* definition. The WSDLLocator is used to provide the document
* base URIs. The InputSource of the WSDLLocator is ignored, instead
* the WSDL is parsed from the given Element.
*
* @param locator A WSDLLocator object used to provide
* the document base URI of the WSDL definition described by the
* element.
* @param definitionsElement the <wsdl:definitions> element
* @return the definition described by the element.
*/
public Definition readWSDL(WSDLLocator locator,
Element definitionsElement)
throws WSDLException;
/**
* Read the specified WSDL document into a WSDL definition.
*
* @param documentBaseURI the document base URI of the WSDL definition
* described by the document. Will be set as the documentBaseURI
* of the returned Definition. Can be null, in which case it
* will be ignored.
* @param wsdlDocument the WSDL document, an XML
* document obeying the WSDL schema.
* @return the definition described in the document.
*/
public Definition readWSDL(String documentBaseURI, Document wsdlDocument)
throws WSDLException;
/**
* Read a WSDL document into a WSDL definition.
*
* @param documentBaseURI the document base URI of the WSDL definition
* described by the document. Will be set as the documentBaseURI
* of the returned Definition. Can be null, in which case it
* will be ignored.
* @param inputSource an InputSource pointing to the
* WSDL document, an XML document obeying the WSDL schema.
* @return the definition described in the document pointed to
* by the InputSource.
*/
public Definition readWSDL(String documentBaseURI, InputSource inputSource)
throws WSDLException;
/**
* Read a WSDL document into a WSDL definition.
*
* @param locator A WSDLLocator object used to provide InputSources
* pointing to the wsdl file.
* @return the definition described in the document
*/
public Definition readWSDL(WSDLLocator locator) throws WSDLException;
} wsdl4j-1.6.3/src/javax/wsdl/Operation.java 0000644 0001750 0001750 00000005673 12111773372 017167 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl;
import java.util.*;
/**
* This interface represents a WSDL operation.
* It includes information on input, output and fault
* messages associated with usage of the operation.
*
* @author Paul Fremantle (pzf@us.ibm.com)
* @author Nirmal Mukhi (nmukhi@us.ibm.com)
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public interface Operation extends WSDLElement
{
/**
* Set the name of this operation.
*
* @param name the desired name
*/
public void setName(String name);
/**
* Get the name of this operation.
*
* @return the operation name
*/
public String getName();
/**
* Set the input message specification for this operation.
*
* @param input the new input message
*/
public void setInput(Input input);
/**
* Get the input message specification for this operation.
*
* @return the input message
*/
public Input getInput();
/**
* Set the output message specification for this operation.
*
* @param output the new output message
*/
public void setOutput(Output output);
/**
* Get the output message specification for this operation.
*
* @return the output message specification for the operation
*/
public Output getOutput();
/**
* Add a fault message that must be associated with this
* operation.
*
* @param fault the new fault message
*/
public void addFault(Fault fault);
/**
* Get the specified fault message.
*
* @param name the name of the desired fault message.
* @return the corresponding fault message, or null if there wasn't
* any matching message
*/
public Fault getFault(String name);
/**
* Remove the specified fault message.
*
* @param name the name of the fault message to be removed.
* @return the fault message which was removed
*/
public Fault removeFault(String name);
/**
* Get all the fault messages associated with this operation.
*
* @return names of fault messages
*/
public Map getFaults();
/**
* Set the style for this operation (request-response,
* one way, solicit-response or notification).
*
* @param style the new operation style
*/
public void setStyle(OperationType style);
/**
* Get the operation type.
*
* @return the operation type
*/
public OperationType getStyle();
/**
* Set the parameter ordering for a request-response,
* or solicit-response operation.
*
* @param parameterOrder a list of named parameters
* containing the part names to reflect the desired
* order of parameters for RPC-style operations
*/
public void setParameterOrdering(List parameterOrder);
/**
* Get the parameter ordering for this operation.
*
* @return the parameter ordering, a list consisting
* of message part names
*/
public List getParameterOrdering();
public void setUndefined(boolean isUndefined);
public boolean isUndefined();
} wsdl4j-1.6.3/src/javax/wsdl/WSDLElement.java 0000644 0001750 0001750 00000001325 12111773372 017300 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package javax.wsdl;
import javax.wsdl.extensions.AttributeExtensible;
import javax.wsdl.extensions.ElementExtensible;
import org.w3c.dom.Element;
/**
* This interface represents all WSDL Elements
*/
public interface WSDLElement extends java.io.Serializable,
AttributeExtensible,
ElementExtensible
{
/**
* Set the documentation element for this document.
*
* @param docEl the documentation element
*/
public void setDocumentationElement(Element docEl);
/**
* Get the documentation element.
*
* @return the documentation element
*/
public Element getDocumentationElement();
} wsdl4j-1.6.3/src/javax/wsdl/Definition.java 0000644 0001750 0001750 00000024117 12111773372 017311 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl;
import java.util.*;
import javax.wsdl.extensions.*;
import javax.xml.namespace.*;
/**
* This interface represents a WSDL definition.
*
* @author Paul Fremantle
* @author Nirmal Mukhi
* @author Matthew J. Duftler
*/
public interface Definition extends WSDLElement
{
/**
* Set the document base URI of this definition. Can be used to
* represent the origin of the Definition, and can be exploited
* when resolving relative URIs (e.g. in <import>s).
*
* @param documentBaseURI the document base URI of this definition
*/
public void setDocumentBaseURI(String documentBaseURI);
/**
* Get the document base URI of this definition.
*
* @return the document base URI
*/
public String getDocumentBaseURI();
/**
* Set the name of this definition.
*
* @param name the desired name
*/
public void setQName(QName name);
/**
* Get the name of this definition.
*
* @return the definition name
*/
public QName getQName();
/**
* Set the target namespace in which WSDL elements are defined.
*
* @param targetNamespace the target namespace
*/
public void setTargetNamespace(String targetNamespace);
/**
* Get the target namespace in which the WSDL elements
* are defined.
*
* @return the target namespace
*/
public String getTargetNamespace();
/**
* This is a way to add a namespace association to a definition.
* It is similar to adding a namespace prefix declaration to the
* top of a <wsdl:definition> element. This has nothing to do
* with the <wsdl:import> element; there are separate methods for
* dealing with information described by <wsdl:import> elements.
*
* @param prefix the prefix to use for this namespace (when
* rendering this information as XML). Use null or an empty string
* to describe the default namespace (i.e. xmlns="...").
* @param namespaceURI the namespace URI to associate the prefix
* with. If you use null, the namespace association will be removed.
*/
public void addNamespace(String prefix, String namespaceURI);
/**
* Get the namespace URI associated with this prefix. Or null if
* there is no namespace URI associated with this prefix. This is
* unrelated to the <wsdl:import> element.
*
* @see #addNamespace(String, String)
* @see #getPrefix(String)
*/
public String getNamespace(String prefix);
/**
* Remove the namespace URI associated with this prefix.
*
* @param prefix the prefix of the namespace to be removed.
* @return the namespace URI which was removed.
*/
public String removeNamespace(String prefix);
/**
* Get a prefix associated with this namespace URI. Or null if
* there are no prefixes associated with this namespace URI. This is
* unrelated to the <wsdl:import> element.
*
* @see #addNamespace(String, String)
* @see #getNamespace(String)
*/
public String getPrefix(String namespaceURI);
/**
* Get all namespace associations in this definition. The keys are
* the prefixes, and the namespace URIs are the values. This is
* unrelated to the <wsdl:import> element.
*
* @see #addNamespace(String, String)
*/
public Map getNamespaces();
/**
* Set the types section.
*/
public void setTypes(Types types);
/**
* Get the types section.
*
* @return the types section
*/
public Types getTypes();
/**
* Add an import to this WSDL description.
*
* @param importDef the import to be added
*/
public void addImport(Import importDef);
/**
* Remove an import from this WSDL description.
*
* @param importDef the import to be removed
* @return the removed Import
*/
public Import removeImport(Import importDef);
/**
* Get the list of imports for the specified namespaceURI.
*
* @param namespaceURI the namespaceURI associated with the
* desired imports.
* @return a list of the corresponding imports, or null if
* there weren't any matching imports
*/
public List getImports(String namespaceURI);
/**
* Get a map of lists containing all the imports defined here.
* The map's keys are the namespaceURIs, and the map's values
* are lists. There is one list for each namespaceURI for which
* imports have been defined.
*/
public Map getImports();
/**
* Add a message to this WSDL description.
*
* @param message the message to be added
*/
public void addMessage(Message message);
/**
* Get the specified message. Also checks imported documents.
*
* @param name the name of the desired message.
* @return the corresponding message, or null if there wasn't
* any matching message
*/
public Message getMessage(QName name);
/**
* Remove the specified message from this definition.
*
* @param name the name of the message to remove
* @return the message previously associated with this qname, if there
* was one; may return null
*/
public Message removeMessage(QName name);
/**
* Get all the messages defined here.
*/
public Map getMessages();
/**
* Add a binding to this WSDL description.
*
* @param binding the binding to be added
*/
public void addBinding(Binding binding);
/**
* Get the specified binding. Also checks imported documents.
*
* @param name the name of the desired binding.
* @return the corresponding binding, or null if there wasn't
* any matching binding
*/
public Binding getBinding(QName name);
/**
* Remove the specified binding from this definition.
*
* @param name the name of the binding to remove
* @return the binding previously associated with this qname, if there
* was one; may return null
*/
public Binding removeBinding(QName name);
/**
* Get all the bindings defined in this Definition.
*/
public Map getBindings();
/**
* Get all the bindings defined in this Definition and
* those in any imported Definitions down the WSDL tree.
*/
public Map getAllBindings();
/**
* Add a portType to this WSDL description.
*
* @param portType the portType to be added
*/
public void addPortType(PortType portType);
/**
* Get the specified portType. Also checks imported documents.
*
* @param name the name of the desired portType.
* @return the corresponding portType, or null if there wasn't
* any matching portType
*/
public PortType getPortType(QName name);
/**
* Remove the specified portType from this definition.
*
* @param name the name of the portType to remove
* @return the portType previously associated with this qname, if there
* was one; may return null
*/
public PortType removePortType(QName name);
/**
* Get all the portTypes defined in this Definition.
*/
public Map getPortTypes();
/**
* Get all the portTypes defined in this Definition and
* those in any imported Definitions down the WSDL tree.
*/
public Map getAllPortTypes();
/**
* Add a service to this WSDL description.
*
* @param service the service to be added
*/
public void addService(Service service);
/**
* Get the specified service. Also checks imported documents.
*
* @param name the name of the desired service.
* @return the corresponding service, or null if there wasn't
* any matching service
*/
public Service getService(QName name);
/**
* Remove the specified service from this definition.
*
* @param name the name of the service to remove
* @return the service previously associated with this qname, if there
* was one; may return null
*/
public Service removeService(QName name);
/**
* Get all the services defined in this Definition.
*/
public Map getServices();
/**
* Get all the services defined in this Definition and
* those in any imported Definitions down the WSDL tree.
*/
public Map getAllServices();
/**
* Create a new binding.
*
* @return the newly created binding
*/
public Binding createBinding();
/**
* Create a new binding fault.
*
* @return the newly created binding fault
*/
public BindingFault createBindingFault();
/**
* Create a new binding input.
*
* @return the newly created binding input
*/
public BindingInput createBindingInput();
/**
* Create a new binding operation.
*
* @return the newly created binding operation
*/
public BindingOperation createBindingOperation();
/**
* Create a new binding output.
*
* @return the newly created binding output
*/
public BindingOutput createBindingOutput();
/**
* Create a new fault.
*
* @return the newly created fault
*/
public Fault createFault();
/**
* Create a new import.
*
* @return the newly created import
*/
public Import createImport();
/**
* Create a new input.
*
* @return the newly created input
*/
public Input createInput();
/**
* Create a new message.
*
* @return the newly created message
*/
public Message createMessage();
/**
* Create a new operation.
*
* @return the newly created operation
*/
public Operation createOperation();
/**
* Create a new output.
*
* @return the newly created output
*/
public Output createOutput();
/**
* Create a new part.
*
* @return the newly created part
*/
public Part createPart();
/**
* Create a new port.
*
* @return the newly created port
*/
public Port createPort();
/**
* Create a new port type.
*
* @return the newly created port type
*/
public PortType createPortType();
/**
* Create a new service.
*
* @return the newly created service
*/
public Service createService();
/**
* Create a new types section.
*
* @return the newly created types section
*/
public Types createTypes();
/**
* Get a reference to the ExtensionRegistry for this Definition.
*/
public ExtensionRegistry getExtensionRegistry();
/**
* Set the ExtensionRegistry for this Definition.
*/
public void setExtensionRegistry(ExtensionRegistry extReg);
} wsdl4j-1.6.3/src/javax/wsdl/Message.java 0000644 0001750 0001750 00000003135 12111773372 016602 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl;
import java.util.*;
import javax.xml.namespace.QName;
/**
* This interface describes a message used for communication with an operation.
*
* @author Paul Fremantle
* @author Nirmal Mukhi
* @author Matthew J. Duftler
*/
public interface Message extends WSDLElement
{
/**
* Set the name of this message.
*
* @param name the desired name
*/
public void setQName(QName name);
/**
* Get the name of this message.
*
* @return the message name
*/
public QName getQName();
/**
* Add a part to this message.
*
* @param part the part to be added
*/
public void addPart(Part part);
/**
* Get the specified part.
*
* @param name the name of the desired part.
* @return the corresponding part, or null if there wasn't
* any matching part
*/
public Part getPart(String name);
/**
* Remove the specified part.
*
* @param name the name of the part to be removed.
* @return the part which was removed
*/
public Part removePart(String name);
/**
* Get all the parts defined here.
*/
public Map getParts();
/**
* Get an ordered list of parts as specified by the partOrder
* argument.
*
* @param partOrder a list of strings, with each string referring
* to a part by its name. If this argument is null, the parts are
* returned in the order in which they were added to the message.
* @return the list of parts
*/
public List getOrderedParts(List partOrder);
public void setUndefined(boolean isUndefined);
public boolean isUndefined();
} wsdl4j-1.6.3/src/javax/wsdl/Binding.java 0000644 0001750 0001750 00000011030 12111773372 016561 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl;
import java.util.*;
import javax.xml.namespace.*;
/**
* This interface represents a port type binding and describes the
* protocol required for using operations in a port type.
*
* @author Paul Fremantle
* @author Nirmal Mukhi
* @author Matthew J. Duftler
*/
public interface Binding extends WSDLElement
{
/**
* Set the name of this binding.
*
* @param name the desired name
*/
public void setQName(QName name);
/**
* Get the name of this binding.
*
* @return the binding name
*/
public QName getQName();
/**
* Set the port type this is a binding for.
*
* @param portType the port type associated with this binding
*/
public void setPortType(PortType portType);
/**
* Get the port type this is a binding for.
*
* @return the associated port type
*/
public PortType getPortType();
/**
* Add an operation binding to binding.
*
* @param bindingOperation the operation binding to be added
*/
public void addBindingOperation(BindingOperation bindingOperation);
/**
* Get the specified operation binding. Note that operation names can
* be overloaded within a PortType. In case of overloading, the
* names of the input and output messages can be used to further
* refine the search.
*
* The search criteria will be the operation name parameter and any
* non-null input or output message name parameters.
* To exclude the input or output message name from the search criteria,
* specify a null value for the input or output message name parameter.
* To search for operations with unnamed input or output messages
* (i.e. <input> or <output> elements with the 'name' attribute omitted),
* specify the string "
* Note: the use of a string value "
* Usage of the input and output message name parameters is as
* described for the
* The search criteria will be the operation name parameter and any
* non-null input or output message name parameters.
* To exclude the input or output message name from the search criteria,
* specify a null value for the input or output message name parameter.
* To search for operations with unnamed input or output messages
* (i.e. <input> or <output> elements with the 'name' attribute omitted),
* specify the string "
* Note: the use of a string value "
* Usage of the input and output message name parameters is as
* described for the
* The search criteria will be the operation name parameter and any
* non-null input or output message name parameters.
* To exclude the input or output message name from the search criteria,
* specify a null value for the input or output message name parameter.
* To search for operations with unnamed input or output messages
* (i.e. <input> or <output> elements with the 'name' attribute omitted),
* specify the string "
* Note: the use of a string value "
* Usage of the input and output message name parameters is as
* described for the
* The supported features are:
*
*
* All feature names must be fully-qualified, Java package style. All
* names starting with javax.wsdl. are reserved for features defined
* by the JWSDL specification. It is recommended that implementation-
* specific features be fully-qualified to match the package name
* of that implementation. For example: com.abc.featureName
*
* @param name the name of the feature to be set.
* @param value the value to set the feature to.
* @throws IllegalArgumentException if the feature name is not recognized.
* @see #getFeature(String)
*/
public void setFeature(String name, boolean value)
throws IllegalArgumentException
{
if (name == null)
{
throw new IllegalArgumentException("Feature name must not be null.");
}
if (name.equals(Constants.FEATURE_VERBOSE))
{
verbose = value;
}
else if (name.equals(Constants.FEATURE_IMPORT_DOCUMENTS))
{
importDocuments = value;
}
else if (name.equals(Constants.FEATURE_PARSE_SCHEMA))
{
parseSchema = value;
}
else
{
throw new IllegalArgumentException("Feature name '" + name +
"' not recognized.");
}
}
/**
* Gets the value of the specified feature.
*
* @param name the name of the feature to get the value of.
* @return the value of the feature.
* @throws IllegalArgumentException if the feature name is not recognized.
* @see #setFeature(String, boolean)
*/
public boolean getFeature(String name) throws IllegalArgumentException
{
if (name == null)
{
throw new IllegalArgumentException("Feature name must not be null.");
}
if (name.equals(Constants.FEATURE_VERBOSE))
{
return verbose;
}
else if (name.equals(Constants.FEATURE_IMPORT_DOCUMENTS))
{
return importDocuments;
}
else
{
throw new IllegalArgumentException("Feature name '" + name +
"' not recognized.");
}
}
/**
* Set the extension registry to be used when reading
* WSDL documents into a WSDL definition. If an
* extension registry is set, that is the extension
* registry that will be set as the extensionRegistry
* property of the definitions resulting from invoking
* readWSDL(...). Default is null.
*
* @param extReg the extension registry to use for new
* definitions
*/
public void setExtensionRegistry(ExtensionRegistry extReg)
{
this.extReg = extReg;
}
/**
* Get the extension registry, if one was set. Default is
* null.
*/
public ExtensionRegistry getExtensionRegistry()
{
return extReg;
}
/**
* Get the WSDLFactory object cached in the reader, or use lazy
* instantiation if it is not cached yet.
*/
protected WSDLFactory getWSDLFactory() throws WSDLException
{
if (factory == null)
{
factory = (factoryImplName != null)
? WSDLFactory.newInstance(factoryImplName)
: WSDLFactory.newInstance();
}
return factory;
}
/**
* Set a different factory implementation to use for
* creating definitions when reading WSDL documents.
* As some WSDLReader implementations may only be
* capable of creating definitions using the same
* factory implementation from which the reader was
* obtained, this method is optional. Default is null.
*
* @param factoryImplName the fully-qualified class name of the
* class which provides a concrete implementation of the abstract
* class WSDLFactory.
* @throws UnsupportedOperationException if this method
* is invoked on an implementation which does not
* support it.
*/
public void setFactoryImplName(String factoryImplName)
throws UnsupportedOperationException
{
//check to see if we really need to change the factory name and clear the cache
if((this.factoryImplName == null && factoryImplName != null) ||
(this.factoryImplName != null && !this.factoryImplName.equals(factoryImplName)))
{
//the factory object is cached in the reader so set it
//to null if the factory impl name is reset.
this.factory = null;
this.factoryImplName = factoryImplName;
//if(verbose) System.out.println("WSDLFactory Impl Name set to : "+factoryImplName);
}
}
/**
* Get the factoryImplName, if one was set. Default is null.
*/
public String getFactoryImplName()
{
return factoryImplName;
}
protected Definition parseDefinitions(String documentBaseURI,
Element defEl,
Map importedDefs)
throws WSDLException
{
checkElementName(defEl, Constants.Q_ELEM_DEFINITIONS);
WSDLFactory factory = getWSDLFactory();
Definition def = factory.newDefinition();
if (extReg != null)
{
def.setExtensionRegistry(extReg);
}
String name = DOMUtils.getAttribute(defEl, Constants.ATTR_NAME);
String targetNamespace = DOMUtils.getAttribute(defEl,
Constants.ATTR_TARGET_NAMESPACE);
NamedNodeMap attrs = defEl.getAttributes();
if (importedDefs == null)
{
importedDefs = new Hashtable();
}
if (documentBaseURI != null)
{
def.setDocumentBaseURI(documentBaseURI);
importedDefs.put(documentBaseURI, def);
}
if (name != null)
{
def.setQName(new QName(targetNamespace, name));
}
if (targetNamespace != null)
{
def.setTargetNamespace(targetNamespace);
}
int size = attrs.getLength();
for (int i = 0; i < size; i++)
{
Attr attr = (Attr)attrs.item(i);
String namespaceURI = attr.getNamespaceURI();
String localPart = attr.getLocalName();
String value = attr.getValue();
if (namespaceURI != null && namespaceURI.equals(Constants.NS_URI_XMLNS))
{
if (localPart != null && !localPart.equals(Constants.ATTR_XMLNS))
{
def.addNamespace(localPart, value);
}
else
{
def.addNamespace(null, value);
}
}
}
Element tempEl = DOMUtils.getFirstChildElement(defEl);
while (tempEl != null)
{
if (QNameUtils.matches(Constants.Q_ELEM_IMPORT, tempEl))
{
def.addImport(parseImport(tempEl, def, importedDefs));
}
else if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
def.setDocumentationElement(tempEl);
}
else if (QNameUtils.matches(Constants.Q_ELEM_TYPES, tempEl))
{
def.setTypes(parseTypes(tempEl, def));
}
else if (QNameUtils.matches(Constants.Q_ELEM_MESSAGE, tempEl))
{
def.addMessage(parseMessage(tempEl, def));
}
else if (QNameUtils.matches(Constants.Q_ELEM_PORT_TYPE, tempEl))
{
def.addPortType(parsePortType(tempEl, def));
}
else if (QNameUtils.matches(Constants.Q_ELEM_BINDING, tempEl))
{
def.addBinding(parseBinding(tempEl, def));
}
else if (QNameUtils.matches(Constants.Q_ELEM_SERVICE, tempEl))
{
def.addService(parseService(tempEl, def));
}
else
{
def.addExtensibilityElement(
parseExtensibilityElement(Definition.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
parseExtensibilityAttributes(defEl, Definition.class, def, def);
return def;
}
protected Import parseImport(Element importEl,
Definition def,
Map importedDefs)
throws WSDLException
{
Import importDef = def.createImport();
try
{
String namespaceURI = DOMUtils.getAttribute(importEl,
Constants.ATTR_NAMESPACE);
String locationURI = DOMUtils.getAttribute(importEl,
Constants.ATTR_LOCATION);
String contextURI = null;
if (namespaceURI != null)
{
importDef.setNamespaceURI(namespaceURI);
}
if (locationURI != null)
{
importDef.setLocationURI(locationURI);
if (importDocuments)
{
try
{
contextURI = def.getDocumentBaseURI();
Definition importedDef = null;
InputStream inputStream = null;
InputSource inputSource = null;
URL url = null;
if (loc != null)
{
inputSource = loc.getImportInputSource(contextURI, locationURI);
/*
We now have available the latest import URI. This might
differ from the locationURI so check the importedDefs for it
since it is this that we pass as the documentBaseURI later.
*/
String liu = loc.getLatestImportURI();
importedDef = (Definition)importedDefs.get(liu);
inputSource.setSystemId(liu);
}
else
{
URL contextURL = (contextURI != null)
? StringUtils.getURL(null, contextURI)
: null;
url = StringUtils.getURL(contextURL, locationURI);
importedDef = (Definition)importedDefs.get(url.toString());
if (importedDef == null)
{
inputStream = StringUtils.getContentAsInputStream(url);
if (inputStream != null)
{
inputSource = new InputSource(inputStream);
inputSource.setSystemId(url.toString());
}
}
}
if (importedDef == null)
{
if (inputSource == null)
{
throw new WSDLException(WSDLException.OTHER_ERROR,
"Unable to locate imported document " +
"at '" + locationURI + "'" +
(contextURI == null
? "."
: ", relative to '" + contextURI +
"'."));
}
Document doc = getDocument(inputSource, inputSource.getSystemId());
if (inputStream != null)
{
inputStream.close();
}
Element documentElement = doc.getDocumentElement();
/*
Check if it's a wsdl document.
If it's not, don't retrieve and process it.
This should later be extended to allow other types of
documents to be retrieved and processed, such as schema
documents (".xsd"), etc...
*/
if (QNameUtils.matches(Constants.Q_ELEM_DEFINITIONS,
documentElement))
{
if (verbose)
{
System.out.println("Retrieving document at '" + locationURI +
"'" +
(contextURI == null
? "."
: ", relative to '" + contextURI + "'."));
}
String urlString =
(loc != null)
? loc.getLatestImportURI()
: (url != null)
? url.toString()
: locationURI;
importedDef = readWSDL(urlString,
documentElement,
importedDefs);
}
else
{
QName docElementQName = QNameUtils.newQName(documentElement);
if (SchemaConstants.XSD_QNAME_LIST.contains(docElementQName))
{
if (verbose)
{
System.out.println("Retrieving schema wsdl:imported from '" + locationURI +
"'" +
(contextURI == null
? "."
: ", relative to '" + contextURI + "'."));
}
WSDLFactory factory = getWSDLFactory();
importedDef = factory.newDefinition();
if (extReg != null)
{
importedDef.setExtensionRegistry(extReg);
}
String urlString =
(loc != null)
? loc.getLatestImportURI()
: (url != null)
? url.toString()
: locationURI;
importedDef.setDocumentBaseURI(urlString);
Types types = importedDef.createTypes();
types.addExtensibilityElement(
parseSchema(Types.class, documentElement, importedDef));
importedDef.setTypes(types);
}
}
}
if (importedDef != null)
{
importDef.setDefinition(importedDef);
}
}
catch (WSDLException e)
{
throw e;
}
catch (RuntimeException e)
{
throw e;
}
catch (Exception e)
{
throw new WSDLException(WSDLException.OTHER_ERROR,
"Unable to resolve imported document at '" +
locationURI +
(contextURI == null
? "'." : "', relative to '" + contextURI + "'")
, e);
}
} //end importDocs
} //end locationURI
}
catch (WSDLException e)
{
if (e.getLocation() == null)
{
e.setLocation(XPathUtils.getXPathExprFromNode(importEl));
}
else
{
//If definitions are being parsed recursively for nested imports
//the exception location must be built up recursively too so
//prepend this element's xpath to exception location.
String loc = XPathUtils.getXPathExprFromNode(importEl) + e.getLocation();
e.setLocation(loc);
}
throw e;
}
//register any NS decls with the Definition
NamedNodeMap attrs = importEl.getAttributes();
registerNSDeclarations(attrs, def);
Element tempEl = DOMUtils.getFirstChildElement(importEl);
while (tempEl != null)
{
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
importDef.setDocumentationElement(tempEl);
}
else
{
importDef.addExtensibilityElement(
parseExtensibilityElement(Import.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
parseExtensibilityAttributes(importEl, Import.class, importDef, def);
return importDef;
}
protected Types parseTypes(Element typesEl, Definition def)
throws WSDLException
{
//register any NS decls with the Definition
NamedNodeMap attrs = typesEl.getAttributes();
registerNSDeclarations(attrs, def);
Types types = def.createTypes();
Element tempEl = DOMUtils.getFirstChildElement(typesEl);
QName tempElType;
while (tempEl != null)
{
tempElType = QNameUtils.newQName(tempEl);
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
types.setDocumentationElement(tempEl);
}
else if ((SchemaConstants.XSD_QNAME_LIST).contains(tempElType))
{
if (parseSchema)
{
//the element qname indicates it is a schema.
types.addExtensibilityElement(
parseSchema(Types.class, tempEl, def));
}
else
{
types.addExtensibilityElement(parseExtensibilityElementAsDefaultExtensiblityElement(Types.class, tempEl, def));
}
}
else
{
types.addExtensibilityElement(
parseExtensibilityElement(Types.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
parseExtensibilityAttributes(typesEl, Types.class, types, def);
return types;
}
protected ExtensibilityElement parseSchema( Class parentType,
Element el,
Definition def)
throws WSDLException
{
QName elementType = null;
ExtensionRegistry extReg = null;
try
{
extReg = def.getExtensionRegistry();
if (extReg == null)
{
throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
"No ExtensionRegistry set for this " +
"Definition, so unable to deserialize " +
"a '" + elementType + "' element in the " +
"context of a '" + parentType.getName() +
"'.");
}
return parseSchema(parentType, el, def, extReg);
}
catch (WSDLException e)
{
if (e.getLocation() == null)
{
e.setLocation(XPathUtils.getXPathExprFromNode(el));
}
throw e;
}
}
protected ExtensibilityElement parseSchema( Class parentType,
Element el,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
/*
* This method returns ExtensibilityElement rather than Schema because we
* do not insist that a suitable XSD schema deserializer is registered.
* PopulatedExtensionRegistry registers SchemaDeserializer by default, but
* if the user chooses not to register a suitable deserializer then the
* UnknownDeserializer will be used, returning an UnknownExtensibilityElement.
*/
Schema schema = null;
SchemaReference schemaRef = null;
try
{
QName elementType = QNameUtils.newQName(el);
ExtensionDeserializer exDS =
extReg.queryDeserializer(parentType, elementType);
//Now unmarshall the DOM element.
ExtensibilityElement ee =
exDS.unmarshall(parentType, elementType, el, def, extReg);
if (ee instanceof Schema)
{
schema = (Schema) ee;
}
else
{
//Unknown extensibility element, so don't do any more schema parsing on it.
return ee;
}
//Keep track of parsed schemas to avoid duplicating Schema objects
//through duplicate or circular references (eg: A imports B imports A).
if (schema.getDocumentBaseURI() != null)
{
this.allSchemas.put(schema.getDocumentBaseURI(), schema);
}
//At this point, any SchemaReference objects held by the schema will not
//yet point to their referenced schemas, so we must now retrieve these
//schemas and set the schema references.
//First, combine the schema references for imports, includes and redefines
//into a single list
ArrayList allSchemaRefs = new ArrayList();
Collection ic = schema.getImports().values();
Iterator importsIterator = ic.iterator();
while(importsIterator.hasNext())
{
allSchemaRefs.addAll( (Collection) importsIterator.next() );
}
allSchemaRefs.addAll(schema.getIncludes());
allSchemaRefs.addAll(schema.getRedefines());
//Then, retrieve the schema referred to by each schema reference. If the
//schema has been read in previously, use the existing schema object.
//Otherwise unmarshall the DOM element into a new schema object.
ListIterator schemaRefIterator = allSchemaRefs.listIterator();
while(schemaRefIterator.hasNext())
{
try
{
schemaRef = (SchemaReference) schemaRefIterator.next();
if (schemaRef.getSchemaLocationURI() == null)
{
//cannot get the referenced schema, so ignore this schema reference
continue;
}
if (verbose)
{
System.out.println("Retrieving schema at '" +
schemaRef.getSchemaLocationURI() +
(schema.getDocumentBaseURI() == null
? "'."
: "', relative to '" +
schema.getDocumentBaseURI() + "'."));
}
InputStream inputStream = null;
InputSource inputSource = null;
//This is the child schema referred to by the schemaReference
Schema referencedSchema = null;
//This is the child schema's location obtained from the WSDLLocator or the URL
String location = null;
if (loc != null)
{
//Try to get the referenced schema using the wsdl locator
inputSource = loc.getImportInputSource(
schema.getDocumentBaseURI(), schemaRef.getSchemaLocationURI());
if (inputSource == null)
{
throw new WSDLException(WSDLException.OTHER_ERROR,
"Unable to locate with a locator "
+ "the schema referenced at '"
+ schemaRef.getSchemaLocationURI()
+ "' relative to document base '"
+ schema.getDocumentBaseURI() + "'");
}
location = loc.getLatestImportURI();
//if a schema from this location has been read previously, use it.
referencedSchema = (Schema) this.allSchemas.get(location);
}
else
{
// We don't have a wsdl locator, so try to retrieve the schema by its URL
String contextURI = schema.getDocumentBaseURI();
URL contextURL = (contextURI != null) ? StringUtils.getURL(null, contextURI) : null;
URL url = StringUtils.getURL(contextURL, schemaRef.getSchemaLocationURI());
location = url.toExternalForm();
//if a schema from this location has been retrieved previously, use it.
referencedSchema = (Schema) this.allSchemas.get(location);
if (referencedSchema == null)
{
// We haven't read this schema in before so do it now
inputStream = StringUtils.getContentAsInputStream(url);
if (inputStream != null)
{
inputSource = new InputSource(inputStream);
}
if (inputSource == null)
{
throw new WSDLException(WSDLException.OTHER_ERROR,
"Unable to locate with a url "
+ "the document referenced at '"
+ schemaRef.getSchemaLocationURI()
+ "'"
+ (contextURI == null ? "." : ", relative to '"
+ contextURI + "'."));
}
}
} //end if loc
// If we have not previously read the schema, get its DOM element now.
if (referencedSchema == null)
{
inputSource.setSystemId(location);
Document doc = getDocument(inputSource, location);
if (inputStream != null)
{
inputStream.close();
}
Element documentElement = doc.getDocumentElement();
// If it's a schema doc process it, otherwise the schema reference remains null
QName docElementQName = QNameUtils.newQName(documentElement);
if (SchemaConstants.XSD_QNAME_LIST.contains(docElementQName))
{
//We now need to call parseSchema recursively to parse the referenced
//schema. The document base URI of the referenced schema will be set to
//the document base URI of the current schema plus the schemaLocation in
//the schemaRef. We cannot explicitly pass in a new document base URI
//to the schema deserializer, so instead we will create a dummy
//Definition and set its documentBaseURI to the new document base URI.
//We can leave the other definition fields empty because we know
//that the SchemaDeserializer.unmarshall method uses the definition
//parameter only to get its documentBaseURI. If the unmarshall method
//implementation changes (ie: its use of definition changes) we may need
//to rethink this approach.
WSDLFactory factory = getWSDLFactory();
Definition dummyDef = factory.newDefinition();
dummyDef.setDocumentBaseURI(location);
//By this point, we know we have a SchemaDeserializer registered
//so we can safely cast the ExtensibilityElement to a Schema.
referencedSchema = (Schema) parseSchema( parentType,
documentElement,
dummyDef,
extReg);
}
} //end if referencedSchema
schemaRef.setReferencedSchema(referencedSchema);
}
catch (WSDLException e)
{
throw e;
}
catch (RuntimeException e)
{
throw e;
}
catch (Exception e)
{
throw new WSDLException(WSDLException.OTHER_ERROR,
"An error occurred trying to resolve schema referenced at '"
+ schemaRef.getSchemaLocationURI()
+ "'"
+ (schema.getDocumentBaseURI() == null ? "." : ", relative to '"
+ schema.getDocumentBaseURI() + "'."),
e);
}
} //end while loop
return schema;
}
catch (WSDLException e)
{
if (e.getLocation() == null)
{
e.setLocation(XPathUtils.getXPathExprFromNode(el));
}
else
{
//If this method has been called recursively for nested schemas
//the exception location must be built up recursively too so
//prepend this element's xpath to exception location.
String loc = XPathUtils.getXPathExprFromNode(el) + e.getLocation();
e.setLocation(loc);
}
throw e;
}
}
protected Binding parseBinding(Element bindingEl, Definition def)
throws WSDLException
{
Binding binding = null;
List remainingAttrs = DOMUtils.getAttributes(bindingEl);
String name = DOMUtils.getAttribute(bindingEl, Constants.ATTR_NAME, remainingAttrs);
QName portTypeName = getQualifiedAttributeValue(bindingEl,
Constants.ATTR_TYPE,
Constants.ELEM_BINDING,
def,
remainingAttrs);
PortType portType = null;
if (name != null)
{
QName bindingName = new QName(def.getTargetNamespace(), name);
binding = def.getBinding(bindingName);
if (binding == null)
{
binding = def.createBinding();
binding.setQName(bindingName);
}
}
else
{
binding = def.createBinding();
}
// Whether it was retrieved or created, the definition has been found.
binding.setUndefined(false);
if (portTypeName != null)
{
portType = def.getPortType(portTypeName);
if (portType == null)
{
portType = def.createPortType();
portType.setQName(portTypeName);
def.addPortType(portType);
}
binding.setPortType(portType);
}
//register any NS decls with the Definition
NamedNodeMap attrs = bindingEl.getAttributes();
registerNSDeclarations(attrs, def);
Element tempEl = DOMUtils.getFirstChildElement(bindingEl);
while (tempEl != null)
{
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
binding.setDocumentationElement(tempEl);
}
else if (QNameUtils.matches(Constants.Q_ELEM_OPERATION, tempEl))
{
binding.addBindingOperation(parseBindingOperation(tempEl,
portType,
def));
}
else
{
binding.addExtensibilityElement(parseExtensibilityElement(
Binding.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
parseExtensibilityAttributes(bindingEl, Binding.class, binding, def);
return binding;
}
protected BindingOperation parseBindingOperation(
Element bindingOperationEl,
PortType portType,
Definition def)
throws WSDLException
{
BindingOperation bindingOperation = def.createBindingOperation();
List remainingAttrs = DOMUtils.getAttributes(bindingOperationEl);
String name = DOMUtils.getAttribute(bindingOperationEl,
Constants.ATTR_NAME,
remainingAttrs);
if (name != null)
{
bindingOperation.setName(name);
}
//register any NS decls with the Definition
NamedNodeMap attrs = bindingOperationEl.getAttributes();
registerNSDeclarations(attrs, def);
Element tempEl = DOMUtils.getFirstChildElement(bindingOperationEl);
while (tempEl != null)
{
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
bindingOperation.setDocumentationElement(tempEl);
}
else if (QNameUtils.matches(Constants.Q_ELEM_INPUT, tempEl))
{
bindingOperation.setBindingInput(parseBindingInput(tempEl, def));
}
else if (QNameUtils.matches(Constants.Q_ELEM_OUTPUT, tempEl))
{
bindingOperation.setBindingOutput(parseBindingOutput(tempEl, def));
}
else if (QNameUtils.matches(Constants.Q_ELEM_FAULT, tempEl))
{
bindingOperation.addBindingFault(parseBindingFault(tempEl, def));
}
else
{
bindingOperation.addExtensibilityElement(
parseExtensibilityElement(BindingOperation.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
if (portType != null)
{
BindingInput bindingInput = bindingOperation.getBindingInput();
BindingOutput bindingOutput = bindingOperation.getBindingOutput();
String inputName = (bindingInput != null
? (bindingInput.getName() != null ? bindingInput.getName() : Constants.NONE)
: null);
String outputName = (bindingOutput != null
? (bindingOutput.getName() != null ? bindingOutput.getName() : Constants.NONE)
: null);
Operation op = portType.getOperation(name, inputName, outputName);
/*
* If the bindingOp input or output message names are null we will search first
* for a porttypeOp with corresponding unnamed input or output messages (using
* Constants.NONE for inputName or outputName, as above).
* However, input and output message names need not be used at all if operation
* overloading is not used, so if no match was found we will try again ignoring
* these unnamed messages from the search criteria (i.e. using null instead of
* Constants.NONE for inputName or outputName).
*/
if(op == null)
{
if(Constants.NONE.equals(inputName) && Constants.NONE.equals(outputName))
{
//There was no porttype op with unnamed input and output messages,
//so ignore input and output name and search on the op name only.
op = portType.getOperation(name, null, null);
}
else if(Constants.NONE.equals(inputName))
{
//There was no porttype op with an unnamed input message,
//so ignore input name and search on the op name and output name only.
op = portType.getOperation(name, null, outputName);
}
else if(Constants.NONE.equals(outputName))
{
//There was no porttype op with an unnamed output message,
//so ignore output name and search on the op name and input name only.
op = portType.getOperation(name, inputName, null);
}
}
if (op == null)
{
Input input = def.createInput();
Output output = def.createOutput();
op = def.createOperation();
op.setName(name);
input.setName(inputName);
output.setName(outputName);
op.setInput(input);
op.setOutput(output);
portType.addOperation(op);
}
bindingOperation.setOperation(op);
}
parseExtensibilityAttributes(bindingOperationEl, BindingOperation.class, bindingOperation, def);
return bindingOperation;
}
protected BindingInput parseBindingInput(Element bindingInputEl,
Definition def)
throws WSDLException
{
BindingInput bindingInput = def.createBindingInput();
List remainingAttrs = DOMUtils.getAttributes(bindingInputEl);
String name = DOMUtils.getAttribute(bindingInputEl,
Constants.ATTR_NAME,
remainingAttrs);
if (name != null)
{
bindingInput.setName(name);
}
//register any NS decls with the Definition
NamedNodeMap attrs = bindingInputEl.getAttributes();
registerNSDeclarations(attrs, def);
Element tempEl = DOMUtils.getFirstChildElement(bindingInputEl);
while (tempEl != null)
{
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
bindingInput.setDocumentationElement(tempEl);
}
else
{
bindingInput.addExtensibilityElement(
parseExtensibilityElement(BindingInput.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
parseExtensibilityAttributes(bindingInputEl, BindingInput.class, bindingInput, def);
return bindingInput;
}
protected BindingOutput parseBindingOutput(Element bindingOutputEl,
Definition def)
throws WSDLException
{
BindingOutput bindingOutput = def.createBindingOutput();
List remainingAttrs = DOMUtils.getAttributes(bindingOutputEl);
String name = DOMUtils.getAttribute(bindingOutputEl,
Constants.ATTR_NAME,
remainingAttrs);
if (name != null)
{
bindingOutput.setName(name);
}
//register any NS decls with the Definition
NamedNodeMap attrs = bindingOutputEl.getAttributes();
registerNSDeclarations(attrs, def);
Element tempEl = DOMUtils.getFirstChildElement(bindingOutputEl);
while (tempEl != null)
{
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
bindingOutput.setDocumentationElement(tempEl);
}
else
{
bindingOutput.addExtensibilityElement(
parseExtensibilityElement(BindingOutput.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
parseExtensibilityAttributes(bindingOutputEl, BindingOutput.class, bindingOutput, def);
return bindingOutput;
}
protected BindingFault parseBindingFault(Element bindingFaultEl,
Definition def)
throws WSDLException
{
BindingFault bindingFault = def.createBindingFault();
List remainingAttrs = DOMUtils.getAttributes(bindingFaultEl);
String name = DOMUtils.getAttribute(bindingFaultEl,
Constants.ATTR_NAME,
remainingAttrs);
if (name != null)
{
bindingFault.setName(name);
}
//register any NS decls with the Definition
NamedNodeMap attrs = bindingFaultEl.getAttributes();
registerNSDeclarations(attrs, def);
Element tempEl = DOMUtils.getFirstChildElement(bindingFaultEl);
while (tempEl != null)
{
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
bindingFault.setDocumentationElement(tempEl);
}
else
{
bindingFault.addExtensibilityElement(
parseExtensibilityElement(BindingFault.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
parseExtensibilityAttributes(bindingFaultEl, BindingFault.class, bindingFault, def);
return bindingFault;
}
protected Message parseMessage(Element msgEl, Definition def)
throws WSDLException
{
Message msg = null;
List remainingAttrs = DOMUtils.getAttributes(msgEl);
String name = DOMUtils.getAttribute(msgEl, Constants.ATTR_NAME, remainingAttrs);
if (name != null)
{
QName messageName = new QName(def.getTargetNamespace(), name);
msg = def.getMessage(messageName);
if (msg == null)
{
msg = def.createMessage();
msg.setQName(messageName);
}
}
else
{
msg = def.createMessage();
}
// Whether it was retrieved or created, the definition has been found.
msg.setUndefined(false);
//register any NS decls with the Definition
NamedNodeMap attrs = msgEl.getAttributes();
registerNSDeclarations(attrs, def);
Element tempEl = DOMUtils.getFirstChildElement(msgEl);
while (tempEl != null)
{
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
msg.setDocumentationElement(tempEl);
}
else if (QNameUtils.matches(Constants.Q_ELEM_PART, tempEl))
{
msg.addPart(parsePart(tempEl, def));
}
else
{
msg.addExtensibilityElement(
parseExtensibilityElement(Message.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
parseExtensibilityAttributes(msgEl, Message.class, msg, def);
return msg;
}
protected Part parsePart(Element partEl, Definition def)
throws WSDLException
{
Part part = def.createPart();
String name = DOMUtils.getAttribute(partEl, Constants.ATTR_NAME);
QName elementName = getQualifiedAttributeValue(partEl,
Constants.ATTR_ELEMENT,
Constants.ELEM_MESSAGE,
def);
QName typeName = getQualifiedAttributeValue(partEl,
Constants.ATTR_TYPE,
Constants.ELEM_MESSAGE,
def);
if (name != null)
{
part.setName(name);
}
if (elementName != null)
{
part.setElementName(elementName);
}
if (typeName != null)
{
part.setTypeName(typeName);
}
//register any NS decls with the Definition
NamedNodeMap attrs = partEl.getAttributes();
registerNSDeclarations(attrs, def);
Element tempEl = DOMUtils.getFirstChildElement(partEl);
while (tempEl != null)
{
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
part.setDocumentationElement(tempEl);
}
else
{
part.addExtensibilityElement(
parseExtensibilityElement(Part.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
parseExtensibilityAttributes(partEl, Part.class, part, def);
return part;
}
protected void parseExtensibilityAttributes(Element el,
Class parentType,
AttributeExtensible attrExt,
Definition def)
throws WSDLException
{
if (attrExt == null) return;
List nativeAttributeNames = attrExt.getNativeAttributeNames();
NamedNodeMap nodeMap = el.getAttributes();
int length = nodeMap.getLength();
for (int i = 0; i < length; i++)
{
Attr attribute = (Attr)nodeMap.item(i);
String localName = attribute.getLocalName();
String namespaceURI = attribute.getNamespaceURI();
String prefix = attribute.getPrefix();
QName qname = new QName(namespaceURI, localName);
if (namespaceURI != null && !namespaceURI.equals(Constants.NS_URI_WSDL))
{
if (!namespaceURI.equals(Constants.NS_URI_XMLNS))
{
DOMUtils.registerUniquePrefix(prefix, namespaceURI, def);
String strValue = attribute.getValue();
int attrType = AttributeExtensible.NO_DECLARED_TYPE;
ExtensionRegistry extReg = def.getExtensionRegistry();
if (extReg != null)
{
attrType = extReg.queryExtensionAttributeType(parentType, qname);
}
Object val = parseExtensibilityAttribute(el, attrType, strValue, def);
attrExt.setExtensionAttribute(qname, val);
}
}
else if (!nativeAttributeNames.contains(localName))
{
WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL,
"Encountered illegal " +
"extension attribute '" +
qname + "'. Extension " +
"attributes must be in " +
"a namespace other than " +
"WSDL's.");
wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el));
throw wsdlExc;
}
}
}
protected Object parseExtensibilityAttribute(Element el,
int attrType,
String attrValue,
Definition def)
throws WSDLException
{
if (attrType == AttributeExtensible.QNAME_TYPE)
{
return DOMUtils.getQName(attrValue, el, def);
}
else if (attrType == AttributeExtensible.LIST_OF_STRINGS_TYPE)
{
return StringUtils.parseNMTokens(attrValue);
}
else if (attrType == AttributeExtensible.LIST_OF_QNAMES_TYPE)
{
List oldList = StringUtils.parseNMTokens(attrValue);
int size = oldList.size();
List newList = new Vector(size);
for (int i = 0; i < size; i++)
{
String str = (String)oldList.get(i);
QName qValue = DOMUtils.getQName(str, el, def);
newList.add(qValue);
}
return newList;
}
else if (attrType == AttributeExtensible.STRING_TYPE)
{
return attrValue;
}
else
{
QName qValue = null;
try
{
qValue = DOMUtils.getQName(attrValue, el, def);
}
catch (WSDLException e)
{
qValue = new QName(attrValue);
}
return qValue;
}
}
protected PortType parsePortType(Element portTypeEl, Definition def)
throws WSDLException
{
PortType portType = null;
String name = DOMUtils.getAttribute(portTypeEl, Constants.ATTR_NAME);
if (name != null)
{
QName portTypeName = new QName(def.getTargetNamespace(), name);
portType = def.getPortType(portTypeName);
if (portType == null)
{
portType = def.createPortType();
portType.setQName(portTypeName);
}
}
else
{
portType = def.createPortType();
}
// Whether it was retrieved or created, the definition has been found.
portType.setUndefined(false);
//register any NS decls with the Definition
NamedNodeMap attrs = portTypeEl.getAttributes();
registerNSDeclarations(attrs, def);
Element tempEl = DOMUtils.getFirstChildElement(portTypeEl);
while (tempEl != null)
{
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
portType.setDocumentationElement(tempEl);
}
else if (QNameUtils.matches(Constants.Q_ELEM_OPERATION, tempEl))
{
Operation op = parseOperation(tempEl, portType, def);
if (op != null)
{
portType.addOperation(op);
}
}
else
{
portType.addExtensibilityElement(
parseExtensibilityElement(PortType.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
parseExtensibilityAttributes(portTypeEl, PortType.class, portType, def);
return portType;
}
protected Operation parseOperation(Element opEl,
PortType portType,
Definition def)
throws WSDLException
{
Operation op = null;
List remainingAttrs = DOMUtils.getAttributes(opEl);
String name = DOMUtils.getAttribute(opEl, Constants.ATTR_NAME, remainingAttrs);
String parameterOrderStr = DOMUtils.getAttribute(opEl,
Constants.ATTR_PARAMETER_ORDER,
remainingAttrs);
//register any NS decls with the Definition
NamedNodeMap attrs = opEl.getAttributes();
registerNSDeclarations(attrs, def);
Element tempEl = DOMUtils.getFirstChildElement(opEl);
List messageOrder = new Vector();
Element docEl = null;
Input input = null;
Output output = null;
List faults = new Vector();
List extElements = new Vector();
boolean retrieved = true;
while (tempEl != null)
{
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
docEl = tempEl;
}
else if (QNameUtils.matches(Constants.Q_ELEM_INPUT, tempEl))
{
input = parseInput(tempEl, def);
messageOrder.add(Constants.ELEM_INPUT);
}
else if (QNameUtils.matches(Constants.Q_ELEM_OUTPUT, tempEl))
{
output = parseOutput(tempEl, def);
messageOrder.add(Constants.ELEM_OUTPUT);
}
else if (QNameUtils.matches(Constants.Q_ELEM_FAULT, tempEl))
{
faults.add(parseFault(tempEl, def));
}
else
{
extElements.add(
parseExtensibilityElement(Operation.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
if (name != null)
{
String inputName = (input != null
? (input.getName() != null ? input.getName() : Constants.NONE)
: null);
String outputName = (output != null
? (output.getName() != null ? output.getName() : Constants.NONE)
: null);
op = portType.getOperation(name, inputName, outputName);
if (op != null && !op.isUndefined())
{
op = null;
}
if (op != null)
{
if (inputName == null)
{
Input tempIn = op.getInput();
if (tempIn != null)
{
if (tempIn.getName() != null)
{
op = null;
}
}
}
}
if (op != null)
{
if (outputName == null)
{
Output tempOut = op.getOutput();
if (tempOut != null)
{
if (tempOut.getName() != null)
{
op = null;
}
}
}
}
if (op == null)
{
op = def.createOperation();
op.setName(name);
retrieved = false;
}
}
else
{
op = def.createOperation();
retrieved = false;
}
// Whether it was retrieved or created, the definition has been found.
op.setUndefined(false);
if (parameterOrderStr != null)
{
op.setParameterOrdering(StringUtils.parseNMTokens(parameterOrderStr));
}
if (docEl != null)
{
op.setDocumentationElement(docEl);
}
if (input != null)
{
op.setInput(input);
}
if (output != null)
{
op.setOutput(output);
}
if (faults.size() > 0)
{
Iterator faultIterator = faults.iterator();
while (faultIterator.hasNext())
{
op.addFault((Fault)faultIterator.next());
}
}
if (extElements.size() > 0)
{
Iterator eeIterator = extElements.iterator();
while (eeIterator.hasNext())
{
op.addExtensibilityElement(
(ExtensibilityElement) eeIterator.next() );
}
}
OperationType style = null;
if (messageOrder.equals(STYLE_ONE_WAY))
{
style = OperationType.ONE_WAY;
}
else if (messageOrder.equals(STYLE_REQUEST_RESPONSE))
{
style = OperationType.REQUEST_RESPONSE;
}
else if (messageOrder.equals(STYLE_SOLICIT_RESPONSE))
{
style = OperationType.SOLICIT_RESPONSE;
}
else if (messageOrder.equals(STYLE_NOTIFICATION))
{
style = OperationType.NOTIFICATION;
}
if (style != null)
{
op.setStyle(style);
}
parseExtensibilityAttributes(opEl, Operation.class, op, def);
if (retrieved)
{
op = null;
}
return op;
}
protected Service parseService(Element serviceEl, Definition def)
throws WSDLException
{
Service service = def.createService();
List remainingAttrs = DOMUtils.getAttributes(serviceEl);
String name = DOMUtils.getAttribute(serviceEl, Constants.ATTR_NAME, remainingAttrs);
if (name != null)
{
service.setQName(new QName(def.getTargetNamespace(), name));
}
//register any NS decls with the Definition
NamedNodeMap attrs = serviceEl.getAttributes();
registerNSDeclarations(attrs, def);
Element tempEl = DOMUtils.getFirstChildElement(serviceEl);
while (tempEl != null)
{
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
service.setDocumentationElement(tempEl);
}
else if (QNameUtils.matches(Constants.Q_ELEM_PORT, tempEl))
{
service.addPort(parsePort(tempEl, def));
}
else
{
service.addExtensibilityElement(
parseExtensibilityElement(Service.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
parseExtensibilityAttributes(serviceEl, Service.class, service, def);
return service;
}
protected Port parsePort(Element portEl, Definition def)
throws WSDLException
{
Port port = def.createPort();
List remainingAttrs = DOMUtils.getAttributes(portEl);
String name = DOMUtils.getAttribute(portEl, Constants.ATTR_NAME, remainingAttrs);
QName bindingStr = getQualifiedAttributeValue(portEl,
Constants.ATTR_BINDING,
Constants.ELEM_PORT,
def,
remainingAttrs);
if (name != null)
{
port.setName(name);
}
if (bindingStr != null)
{
Binding binding = def.getBinding(bindingStr);
if (binding == null)
{
binding = def.createBinding();
binding.setQName(bindingStr);
def.addBinding(binding);
}
port.setBinding(binding);
}
//register any NS decls with the Definition
NamedNodeMap attrs = portEl.getAttributes();
registerNSDeclarations(attrs, def);
Element tempEl = DOMUtils.getFirstChildElement(portEl);
while (tempEl != null)
{
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
port.setDocumentationElement(tempEl);
}
else
{
port.addExtensibilityElement(parseExtensibilityElement(Port.class,
tempEl,
def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
parseExtensibilityAttributes(portEl, Port.class, port, def);
return port;
}
protected ExtensibilityElement parseExtensibilityElement(
Class parentType,
Element el,
Definition def)
throws WSDLException
{
QName elementType = QNameUtils.newQName(el);
String namespaceURI = el.getNamespaceURI();
try
{
if (namespaceURI == null || namespaceURI.equals(Constants.NS_URI_WSDL))
{
throw new WSDLException(WSDLException.INVALID_WSDL,
"Encountered illegal extension element '" +
elementType +
"' in the context of a '" +
parentType.getName() +
"'. Extension elements must be in " +
"a namespace other than WSDL's.");
}
ExtensionRegistry extReg = def.getExtensionRegistry();
if (extReg == null)
{
throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
"No ExtensionRegistry set for this " +
"Definition, so unable to deserialize " +
"a '" + elementType + "' element in the " +
"context of a '" + parentType.getName() +
"'.");
}
ExtensionDeserializer extDS = extReg.queryDeserializer(parentType,
elementType);
NamedNodeMap attrs = el.getAttributes();
registerNSDeclarations(attrs, def);
return extDS.unmarshall(parentType, elementType, el, def, extReg);
}
catch (WSDLException e)
{
if (e.getLocation() == null)
{
e.setLocation(XPathUtils.getXPathExprFromNode(el));
}
throw e;
}
}
/**
* Parse the element using the ExtensionRegistry default deserializer instead using the one
* registered. The default deserializer will create an UnknownExtensibilityElement from the element.
* @param parentType
* @param el
* @param def
* @return An instance of the default ExtensibilityElement as registered with the ExtensionRegistry
* @throws WSDLException
*/
protected ExtensibilityElement parseExtensibilityElementAsDefaultExtensiblityElement(
Class parentType, Element el, Definition def) throws WSDLException
{
QName elementType = QNameUtils.newQName(el);
String namespaceURI = el.getNamespaceURI();
try
{
if (namespaceURI == null || namespaceURI.equals(Constants.NS_URI_WSDL))
{
throw new WSDLException(WSDLException.INVALID_WSDL,
"Encountered illegal extension element '" + elementType
+ "' in the context of a '" + parentType.getName()
+ "'. Extension elements must be in "
+ "a namespace other than WSDL's.");
}
ExtensionRegistry extReg = def.getExtensionRegistry();
if (extReg == null)
{
throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
"No ExtensionRegistry set for this "
+ "Definition, so unable to deserialize " + "a '" + elementType
+ "' element in the " + "context of a '" + parentType.getName()
+ "'.");
}
ExtensionDeserializer extDS = extReg.getDefaultDeserializer();
NamedNodeMap attrs = el.getAttributes();
registerNSDeclarations(attrs, def);
return extDS.unmarshall(parentType, elementType, el, def, extReg);
} catch (WSDLException e)
{
if (e.getLocation() == null)
{
e.setLocation(XPathUtils.getXPathExprFromNode(el));
}
throw e;
}
}
protected Input parseInput(Element inputEl, Definition def)
throws WSDLException
{
Input input = def.createInput();
String name = DOMUtils.getAttribute(inputEl, Constants.ATTR_NAME);
QName messageName = getQualifiedAttributeValue(inputEl,
Constants.ATTR_MESSAGE,
Constants.ELEM_INPUT,
def);
if (name != null)
{
input.setName(name);
}
if (messageName != null)
{
Message message = def.getMessage(messageName);
if (message == null)
{
message = def.createMessage();
message.setQName(messageName);
def.addMessage(message);
}
input.setMessage(message);
}
//register any NS decls with the Definition
NamedNodeMap attrs = inputEl.getAttributes();
registerNSDeclarations(attrs, def);
Element tempEl = DOMUtils.getFirstChildElement(inputEl);
while (tempEl != null)
{
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
input.setDocumentationElement(tempEl);
}
else
{
input.addExtensibilityElement(
parseExtensibilityElement(Input.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
parseExtensibilityAttributes(inputEl, Input.class, input, def);
return input;
}
protected Output parseOutput(Element outputEl, Definition def)
throws WSDLException
{
Output output = def.createOutput();
String name = DOMUtils.getAttribute(outputEl, Constants.ATTR_NAME);
QName messageName = getQualifiedAttributeValue(outputEl,
Constants.ATTR_MESSAGE,
Constants.ELEM_OUTPUT,
def);
if (name != null)
{
output.setName(name);
}
if (messageName != null)
{
Message message = def.getMessage(messageName);
if (message == null)
{
message = def.createMessage();
message.setQName(messageName);
def.addMessage(message);
}
output.setMessage(message);
}
//register any NS decls with the Definition
NamedNodeMap attrs = outputEl.getAttributes();
registerNSDeclarations(attrs, def);
Element tempEl = DOMUtils.getFirstChildElement(outputEl);
while (tempEl != null)
{
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
output.setDocumentationElement(tempEl);
}
else
{
output.addExtensibilityElement(
parseExtensibilityElement(Output.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
parseExtensibilityAttributes(outputEl, Output.class, output, def);
return output;
}
protected Fault parseFault(Element faultEl, Definition def)
throws WSDLException
{
Fault fault = def.createFault();
String name = DOMUtils.getAttribute(faultEl, Constants.ATTR_NAME);
QName messageName = getQualifiedAttributeValue(faultEl,
Constants.ATTR_MESSAGE,
Constants.ELEM_FAULT,
def);
if (name != null)
{
fault.setName(name);
}
if (messageName != null)
{
Message message = def.getMessage(messageName);
if (message == null)
{
message = def.createMessage();
message.setQName(messageName);
def.addMessage(message);
}
fault.setMessage(message);
}
//register any NS decls with the Definition
NamedNodeMap attrs = faultEl.getAttributes();
registerNSDeclarations(attrs, def);
Element tempEl = DOMUtils.getFirstChildElement(faultEl);
while (tempEl != null)
{
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
{
fault.setDocumentationElement(tempEl);
}
else
{
fault.addExtensibilityElement(
parseExtensibilityElement(Fault.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
parseExtensibilityAttributes(faultEl, Fault.class, fault, def);
return fault;
}
/**
* This method should be used for elements that support extension
* attributes because it does not track unexpected remaining attributes.
*/
private static QName getQualifiedAttributeValue(Element el,
String attrName,
String elDesc,
Definition def)
throws WSDLException
{
try
{
return DOMUtils.getQualifiedAttributeValue(el,
attrName,
elDesc,
false,
def);
}
catch (WSDLException e)
{
if (e.getFaultCode().equals(WSDLException.NO_PREFIX_SPECIFIED))
{
String attrValue = DOMUtils.getAttribute(el, attrName);
return new QName(attrValue);
}
else
{
throw e;
}
}
}
/**
* This method should be used for elements that do not support extension
* attributes because it tracks unexpected remaining attributes.
*/
private static QName getQualifiedAttributeValue(Element el,
String attrName,
String elDesc,
Definition def,
List remainingAttrs)
throws WSDLException
{
try
{
return DOMUtils.getQualifiedAttributeValue(el,
attrName,
elDesc,
false,
def,
remainingAttrs);
}
catch (WSDLException e)
{
if (e.getFaultCode().equals(WSDLException.NO_PREFIX_SPECIFIED))
{
String attrValue = DOMUtils.getAttribute(el, attrName, remainingAttrs);
return new QName(attrValue);
}
else
{
throw e;
}
}
}
private static void checkElementName(Element el, QName qname)
throws WSDLException
{
if (!QNameUtils.matches(qname, el))
{
WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL,
"Expected element '" +
qname + "'.");
wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el));
throw wsdlExc;
}
}
private static Document getDocument(InputSource inputSource,
String desc) throws WSDLException
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(false);
try
{
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(inputSource);
return doc;
}
catch (RuntimeException e)
{
throw e;
}
catch (Exception e)
{
throw new WSDLException(WSDLException.PARSER_ERROR,
"Problem parsing '" + desc + "'.",
e);
}
}
private static void registerNSDeclarations(NamedNodeMap attrs, Definition def)
{
int size = attrs.getLength();
for (int i = 0; i < size; i++)
{
Attr attr = (Attr)attrs.item(i);
String namespaceURI = attr.getNamespaceURI();
String localPart = attr.getLocalName();
String value = attr.getValue();
if (namespaceURI != null && namespaceURI.equals(Constants.NS_URI_XMLNS))
{
if (localPart != null && !localPart.equals(Constants.ATTR_XMLNS))
{
DOMUtils.registerUniquePrefix(localPart, value, def);
}
else
{
DOMUtils.registerUniquePrefix(null, value, def);
}
}
}
}
/**
* Read the WSDL document accessible via the specified
* URI into a WSDL definition.
*
* @param wsdlURI a URI (can be a filename or URL) pointing to a
* WSDL XML definition.
* @return the definition.
*/
public Definition readWSDL(String wsdlURI) throws WSDLException
{
return readWSDL(null, wsdlURI);
}
/**
* Read the WSDL document accessible via the specified
* URI into a WSDL definition.
*
* @param contextURI the context in which to resolve the
* wsdlURI, if the wsdlURI is relative. Can be null, in which
* case it will be ignored.
* @param wsdlURI a URI (can be a filename or URL) pointing to a
* WSDL XML definition.
* @return the definition.
*/
public Definition readWSDL(String contextURI, String wsdlURI)
throws WSDLException
{
try
{
if (verbose)
{
System.out.println("Retrieving document at '" + wsdlURI + "'" +
(contextURI == null
? "."
: ", relative to '" + contextURI + "'."));
}
URL contextURL = (contextURI != null)
? StringUtils.getURL(null, contextURI)
: null;
URL url = StringUtils.getURL(contextURL, wsdlURI);
InputStream inputStream = StringUtils.getContentAsInputStream(url);
InputSource inputSource = new InputSource(inputStream);
inputSource.setSystemId(url.toString());
Document doc = getDocument(inputSource, url.toString());
inputStream.close();
Definition def = readWSDL(url.toString(), doc);
return def;
}
catch (WSDLException e)
{
throw e;
}
catch (RuntimeException e)
{
throw e;
}
catch (Exception e)
{
throw new WSDLException(WSDLException.OTHER_ERROR,
"Unable to resolve imported document at '" +
wsdlURI +
(contextURI == null
? "'."
: "', relative to '" + contextURI + "'.")
, e);
}
}
/**
* Read the specified <wsdl:definitions> element into a WSDL
* definition.
*
* @param documentBaseURI the document base URI of the WSDL definition
* described by the element. Will be set as the documentBaseURI
* of the returned Definition. Can be null, in which case it
* will be ignored.
* @param definitionsElement the <wsdl:definitions> element
* @return the definition described by the element.
*/
public Definition readWSDL(String documentBaseURI,
Element definitionsElement)
throws WSDLException
{
return readWSDL(documentBaseURI, definitionsElement, null);
}
/**
* Read the specified <wsdl:definitions> element into a WSDL
* definition. The WSDLLocator is used to provide the document
* base URIs. The InputSource of the WSDLLocator is ignored, instead
* the WSDL is parsed from the given Element.
*
* @param locator A WSDLLocator object used to provide
* the document base URI of the WSDL definition described by the
* element.
* @param definitionsElement the <wsdl:definitions> element
* @return the definition described by the element.
*/
public Definition readWSDL(WSDLLocator locator,
Element definitionsElement)
throws WSDLException
{
try
{
this.loc = locator;
return readWSDL(locator.getBaseURI(), definitionsElement, null);
}
finally
{
locator.close();
this.loc = null;
}
}
protected Definition readWSDL(String documentBaseURI,
Element definitionsElement,
Map importedDefs)
throws WSDLException
{
return parseDefinitions(documentBaseURI, definitionsElement, importedDefs);
}
/**
* Read the specified WSDL document into a WSDL definition.
*
* @param documentBaseURI the document base URI of the WSDL definition
* described by the document. Will be set as the documentBaseURI
* of the returned Definition. Can be null, in which case it
* will be ignored.
* @param wsdlDocument the WSDL document, an XML
* document obeying the WSDL schema.
* @return the definition described in the document.
*/
public Definition readWSDL(String documentBaseURI, Document wsdlDocument)
throws WSDLException
{
return readWSDL(documentBaseURI, wsdlDocument.getDocumentElement());
}
/**
* Read a WSDL document into a WSDL definition.
*
* @param documentBaseURI the document base URI of the WSDL definition
* described by the document. Will be set as the documentBaseURI
* of the returned Definition. Can be null, in which case it
* will be ignored.
* @param inputSource an InputSource pointing to the
* WSDL document, an XML document obeying the WSDL schema.
* @return the definition described in the document pointed to
* by the InputSource.
*/
public Definition readWSDL(String documentBaseURI, InputSource inputSource)
throws WSDLException
{
String location = (inputSource.getSystemId() != null ?
inputSource.getSystemId() : "- WSDL Document -");
return readWSDL(documentBaseURI,
getDocument(inputSource, location));
}
/**
* Read a WSDL document into a WSDL definition.
*
* @param locator A WSDLLocator object used to provide InputSources
* pointing to the wsdl file.
* @return the definition described in the document
*/
public Definition readWSDL(WSDLLocator locator) throws WSDLException
{
InputSource is = locator.getBaseInputSource();
String base = locator.getBaseURI();
if (is == null)
{
throw new WSDLException(WSDLException.OTHER_ERROR,
"Unable to locate document at '" + base + "'.");
}
is.setSystemId(base);
this.loc = locator;
if (verbose)
{
System.out.println("Retrieving document at '" + base + "'.");
}
try
{
return readWSDL(base, is);
}
finally
{
this.loc.close();
this.loc = null;
}
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/xml/WSDLWriterImpl.java 0000644 0001750 0001750 00000104100 12111773372 021014 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl.xml;
import java.io.*;
import java.util.*;
import javax.xml.namespace.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import javax.wsdl.*;
import javax.wsdl.extensions.*;
import javax.wsdl.factory.*;
import javax.wsdl.xml.*;
import com.ibm.wsdl.*;
import com.ibm.wsdl.util.*;
import com.ibm.wsdl.util.xml.*;
/**
* This class describes a collection of methods
* that allow a WSDL model to be written to a writer
* in an XML format that follows the WSDL schema.
*
* @author Matthew J. Duftler
* @author Nirmal Mukhi
*/
public class WSDLWriterImpl implements WSDLWriter
{
/**
* Sets the specified feature to the specified value.
*
* There are no minimum features that must be supported.
*
* All feature names must be fully-qualified, Java package style. All
* names starting with javax.wsdl. are reserved for features defined
* by the JWSDL specification. It is recommended that implementation-
* specific features be fully-qualified to match the package name
* of that implementation. For example: com.abc.featureName
*
* @param name the name of the feature to be set.
* @param value the value to set the feature to.
* @throws IllegalArgumentException if the feature name is not recognized.
* @see #getFeature(String)
*/
public void setFeature(String name, boolean value)
throws IllegalArgumentException
{
if (name == null)
{
throw new IllegalArgumentException("Feature name must not be null.");
}
else
{
throw new IllegalArgumentException("Feature name '" + name +
"' not recognized.");
}
}
/**
* Gets the value of the specified feature.
*
* @param name the name of the feature to get the value of.
* @return the value of the feature.
* @throws IllegalArgumentException if the feature name is not recognized.
* @see #setFeature(String, boolean)
*/
public boolean getFeature(String name) throws IllegalArgumentException
{
if (name == null)
{
throw new IllegalArgumentException("Feature name must not be null.");
}
else
{
throw new IllegalArgumentException("Feature name '" + name +
"' not recognized.");
}
}
protected void printDefinition(Definition def, PrintWriter pw)
throws WSDLException
{
if (def == null)
{
return;
}
if (def.getPrefix(Constants.NS_URI_WSDL) == null)
{
String prefix = "wsdl";
int subscript = 0;
while (def.getNamespace(prefix) != null)
{
prefix = "wsdl" + subscript++;
}
def.addNamespace(prefix, Constants.NS_URI_WSDL);
}
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_DEFINITIONS,
def);
pw.print('<' + tagName);
QName name = def.getQName();
String targetNamespace = def.getTargetNamespace();
Map namespaces = def.getNamespaces();
if (name != null)
{
DOMUtils.printAttribute(Constants.ATTR_NAME, name.getLocalPart(), pw);
}
DOMUtils.printAttribute(Constants.ATTR_TARGET_NAMESPACE,
targetNamespace,
pw);
printExtensibilityAttributes(Definition.class, def, def, pw);
printNamespaceDeclarations(namespaces, pw);
pw.println('>');
printDocumentation(def.getDocumentationElement(), def, pw);
printImports(def.getImports(), def, pw);
printTypes(def.getTypes(), def, pw);
printMessages(def.getMessages(), def, pw);
printPortTypes(def.getPortTypes(), def, pw);
printBindings(def.getBindings(), def, pw);
printServices(def.getServices(), def, pw);
List extElements = def.getExtensibilityElements();
printExtensibilityElements(Definition.class, extElements, def, pw);
pw.println("" + tagName + '>');
pw.flush();
}
protected void printServices(Map services,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (services != null)
{
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_SERVICE,
def);
Iterator serviceIterator = services.values().iterator();
while (serviceIterator.hasNext())
{
Service service = (Service)serviceIterator.next();
pw.print(" <" + tagName);
QName name = service.getQName();
if (name != null)
{
DOMUtils.printAttribute(Constants.ATTR_NAME,
name.getLocalPart(),
pw);
}
printExtensibilityAttributes(Service.class, service, def, pw);
pw.println('>');
printDocumentation(service.getDocumentationElement(), def, pw);
printPorts(service.getPorts(), def, pw);
List extElements = service.getExtensibilityElements();
printExtensibilityElements(Service.class, extElements, def, pw);
pw.println(" " + tagName + '>');
}
}
}
protected void printPorts(Map ports, Definition def, PrintWriter pw)
throws WSDLException
{
if (ports != null)
{
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_PORT,
def);
Iterator portIterator = ports.values().iterator();
while (portIterator.hasNext())
{
Port port = (Port)portIterator.next();
pw.print(" <" + tagName);
DOMUtils.printAttribute(Constants.ATTR_NAME, port.getName(), pw);
Binding binding = port.getBinding();
if (binding != null)
{
DOMUtils.printQualifiedAttribute(Constants.ATTR_BINDING,
binding.getQName(),
def,
pw);
}
printExtensibilityAttributes(Port.class, port, def, pw);
pw.println('>');
printDocumentation(port.getDocumentationElement(), def, pw);
List extElements = port.getExtensibilityElements();
printExtensibilityElements(Port.class, extElements, def, pw);
pw.println(" " + tagName + '>');
}
}
}
protected void printBindings(Map bindings,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (bindings != null)
{
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_BINDING,
def);
Iterator bindingIterator = bindings.values().iterator();
while (bindingIterator.hasNext())
{
Binding binding = (Binding)bindingIterator.next();
if (!binding.isUndefined())
{
pw.print(" <" + tagName);
QName name = binding.getQName();
if (name != null)
{
DOMUtils.printAttribute(Constants.ATTR_NAME,
name.getLocalPart(),
pw);
}
PortType portType = binding.getPortType();
if (portType != null)
{
DOMUtils.printQualifiedAttribute(Constants.ATTR_TYPE,
portType.getQName(),
def,
pw);
}
pw.println('>');
printDocumentation(binding.getDocumentationElement(), def, pw);
List extElements = binding.getExtensibilityElements();
printExtensibilityElements(Binding.class, extElements, def, pw);
printBindingOperations(binding.getBindingOperations(), def, pw);
pw.println(" " + tagName + '>');
}
}
}
}
protected void printBindingOperations(List bindingOperations,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (bindingOperations != null)
{
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_OPERATION,
def);
Iterator bindingOperationIterator = bindingOperations.iterator();
while (bindingOperationIterator.hasNext())
{
BindingOperation bindingOperation =
(BindingOperation)bindingOperationIterator.next();
pw.print(" <" + tagName);
DOMUtils.printAttribute(Constants.ATTR_NAME,
bindingOperation.getName(),
pw);
printExtensibilityAttributes(BindingOperation.class, bindingOperation, def, pw);
pw.println('>');
printDocumentation(bindingOperation.getDocumentationElement(), def, pw);
List extElements = bindingOperation.getExtensibilityElements();
printExtensibilityElements(BindingOperation.class,
extElements,
def,
pw);
printBindingInput(bindingOperation.getBindingInput(), def, pw);
printBindingOutput(bindingOperation.getBindingOutput(), def, pw);
printBindingFaults(bindingOperation.getBindingFaults(), def, pw);
pw.println(" " + tagName + '>');
}
}
}
protected void printBindingInput(BindingInput bindingInput,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (bindingInput != null)
{
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_INPUT,
def);
pw.print(" <" + tagName);
DOMUtils.printAttribute(Constants.ATTR_NAME,
bindingInput.getName(),
pw);
printExtensibilityAttributes(BindingInput.class, bindingInput, def, pw);
pw.println('>');
printDocumentation(bindingInput.getDocumentationElement(), def, pw);
List extElements = bindingInput.getExtensibilityElements();
printExtensibilityElements(BindingInput.class, extElements, def, pw);
pw.println(" " + tagName + '>');
}
}
protected void printBindingOutput(BindingOutput bindingOutput,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (bindingOutput != null)
{
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_OUTPUT,
def);
pw.print(" <" + tagName);
DOMUtils.printAttribute(Constants.ATTR_NAME,
bindingOutput.getName(),
pw);
pw.println('>');
printDocumentation(bindingOutput.getDocumentationElement(), def, pw);
List extElements = bindingOutput.getExtensibilityElements();
printExtensibilityElements(BindingOutput.class, extElements, def, pw);
pw.println(" " + tagName + '>');
}
}
protected void printBindingFaults(Map bindingFaults,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (bindingFaults != null)
{
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_FAULT,
def);
Iterator bindingFaultIterator = bindingFaults.values().iterator();
while (bindingFaultIterator.hasNext())
{
BindingFault bindingFault = (BindingFault)bindingFaultIterator.next();
pw.print(" <" + tagName);
DOMUtils.printAttribute(Constants.ATTR_NAME,
bindingFault.getName(),
pw);
printExtensibilityAttributes(BindingFault.class, bindingFault, def, pw);
pw.println('>');
printDocumentation(bindingFault.getDocumentationElement(), def, pw);
List extElements = bindingFault.getExtensibilityElements();
printExtensibilityElements(BindingFault.class, extElements, def, pw);
pw.println(" " + tagName + '>');
}
}
}
protected void printPortTypes(Map portTypes,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (portTypes != null)
{
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_PORT_TYPE,
def);
Iterator portTypeIterator = portTypes.values().iterator();
while (portTypeIterator.hasNext())
{
PortType portType = (PortType)portTypeIterator.next();
if (!portType.isUndefined())
{
pw.print(" <" + tagName);
QName name = portType.getQName();
if (name != null)
{
DOMUtils.printAttribute(Constants.ATTR_NAME,
name.getLocalPart(),
pw);
}
printExtensibilityAttributes(PortType.class, portType, def, pw);
pw.println('>');
printDocumentation(portType.getDocumentationElement(), def, pw);
printOperations(portType.getOperations(), def, pw);
List extElements = portType.getExtensibilityElements();
printExtensibilityElements(PortType.class, extElements, def, pw);
pw.println(" " + tagName + '>');
}
}
}
}
protected void printOperations(List operations,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (operations != null)
{
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_OPERATION,
def);
Iterator operationIterator = operations.iterator();
while (operationIterator.hasNext())
{
Operation operation = (Operation)operationIterator.next();
if (!operation.isUndefined())
{
pw.print(" <" + tagName);
DOMUtils.printAttribute(Constants.ATTR_NAME,
operation.getName(),
pw);
DOMUtils.printAttribute(Constants.ATTR_PARAMETER_ORDER,
StringUtils.getNMTokens(operation.getParameterOrdering()),
pw);
printExtensibilityAttributes(Operation.class, operation, def, pw);
pw.println('>');
printDocumentation(operation.getDocumentationElement(), def, pw);
OperationType operationType = operation.getStyle();
if (operationType == OperationType.ONE_WAY)
{
printInput(operation.getInput(), def, pw);
}
else if (operationType == OperationType.SOLICIT_RESPONSE)
{
printOutput(operation.getOutput(), def, pw);
printInput(operation.getInput(), def, pw);
}
else if (operationType == OperationType.NOTIFICATION)
{
printOutput(operation.getOutput(), def, pw);
}
else
{
// Must be OperationType.REQUEST_RESPONSE.
printInput(operation.getInput(), def, pw);
printOutput(operation.getOutput(), def, pw);
}
printFaults(operation.getFaults(), def, pw);
List extElements = operation.getExtensibilityElements();
printExtensibilityElements(Operation.class, extElements, def, pw);
pw.println(" " + tagName + '>');
}
}
}
}
protected void printInput(Input input,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (input != null)
{
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_INPUT,
def);
pw.print(" <" + tagName);
DOMUtils.printAttribute(Constants.ATTR_NAME, input.getName(), pw);
Message message = input.getMessage();
if (message != null)
{
DOMUtils.printQualifiedAttribute(Constants.ATTR_MESSAGE,
message.getQName(),
def,
pw);
}
printExtensibilityAttributes(Input.class, input, def, pw);
pw.println('>');
printDocumentation(input.getDocumentationElement(), def, pw);
List extElements = input.getExtensibilityElements();
printExtensibilityElements(Input.class, extElements, def, pw);
pw.println(" " + tagName + '>');
}
}
protected void printOutput(Output output,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (output != null)
{
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_OUTPUT,
def);
pw.print(" <" + tagName);
DOMUtils.printAttribute(Constants.ATTR_NAME, output.getName(), pw);
Message message = output.getMessage();
if (message != null)
{
DOMUtils.printQualifiedAttribute(Constants.ATTR_MESSAGE,
message.getQName(),
def,
pw);
}
printExtensibilityAttributes(Output.class, output, def, pw);
pw.println('>');
printDocumentation(output.getDocumentationElement(), def, pw);
List extElements = output.getExtensibilityElements();
printExtensibilityElements(Output.class, extElements, def, pw);
pw.println(" " + tagName + '>');
}
}
protected void printFaults(Map faults,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (faults != null)
{
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_FAULT,
def);
Iterator faultIterator = faults.values().iterator();
while (faultIterator.hasNext())
{
Fault fault = (Fault)faultIterator.next();
pw.print(" <" + tagName);
DOMUtils.printAttribute(Constants.ATTR_NAME, fault.getName(), pw);
Message message = fault.getMessage();
if (message != null)
{
DOMUtils.printQualifiedAttribute(Constants.ATTR_MESSAGE,
message.getQName(),
def,
pw);
}
printExtensibilityAttributes(Fault.class, fault, def, pw);
pw.println('>');
printDocumentation(fault.getDocumentationElement(), def, pw);
List extElements = fault.getExtensibilityElements();
printExtensibilityElements(Fault.class, extElements, def, pw);
pw.println(" " + tagName + '>');
}
}
}
protected void printMessages(Map messages,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (messages != null)
{
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_MESSAGE,
def);
Iterator messageIterator = messages.values().iterator();
while (messageIterator.hasNext())
{
Message message = (Message)messageIterator.next();
if (!message.isUndefined())
{
pw.print(" <" + tagName);
QName name = message.getQName();
if (name != null)
{
DOMUtils.printAttribute(Constants.ATTR_NAME,
name.getLocalPart(),
pw);
}
printExtensibilityAttributes(Message.class, message, def, pw);
pw.println('>');
printDocumentation(message.getDocumentationElement(), def, pw);
printParts(message.getOrderedParts(null), def, pw);
List extElements = message.getExtensibilityElements();
printExtensibilityElements(Message.class, extElements, def, pw);
pw.println(" " + tagName + '>');
}
}
}
}
protected void printParts(List parts, Definition def, PrintWriter pw)
throws WSDLException
{
if (parts != null)
{
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_PART,
def);
Iterator partIterator = parts.iterator();
while (partIterator.hasNext())
{
Part part = (Part)partIterator.next();
pw.print(" <" + tagName);
DOMUtils.printAttribute(Constants.ATTR_NAME, part.getName(), pw);
DOMUtils.printQualifiedAttribute(Constants.ATTR_ELEMENT,
part.getElementName(),
def,
pw);
DOMUtils.printQualifiedAttribute(Constants.ATTR_TYPE,
part.getTypeName(),
def,
pw);
printExtensibilityAttributes(Part.class, part, def, pw);
pw.println('>');
printDocumentation(part.getDocumentationElement(), def, pw);
List extElements = part.getExtensibilityElements();
printExtensibilityElements(Part.class, extElements, def, pw);
pw.println(" " + tagName + '>');
}
}
}
protected void printExtensibilityAttributes(Class parentType,
AttributeExtensible attrExt,
Definition def,
PrintWriter pw)
throws WSDLException
{
Map extensionAttributes = attrExt.getExtensionAttributes();
Iterator attrNames = extensionAttributes.keySet().iterator();
while (attrNames.hasNext())
{
QName attrName = (QName)attrNames.next();
Object attrValue = extensionAttributes.get(attrName);
String attrStrValue = null;
QName attrQNameValue = null;
if (attrValue instanceof String)
{
attrStrValue = (String)attrValue;
}
else if (attrValue instanceof QName)
{
attrQNameValue = (QName)attrValue;
}
else if (attrValue instanceof List)
{
List attrValueList = (List)attrValue;
int size = attrValueList.size();
if (size > 0)
{
Object tempAttrVal = attrValueList.get(0);
if (tempAttrVal instanceof String)
{
attrStrValue = StringUtils.getNMTokens(attrValueList);
}
else if (tempAttrVal instanceof QName)
{
StringBuffer strBuf = new StringBuffer();
for (int i = 0; i < size; i++)
{
QName tempQName = (QName)attrValueList.get(i);
strBuf.append((i > 0 ? " " : "") +
DOMUtils.getQualifiedValue(tempQName.getNamespaceURI(),
tempQName.getLocalPart(),
def));
}
attrStrValue = strBuf.toString();
}
else
{
throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
"Unknown type of extension attribute '" +
attrName + "': " +
tempAttrVal.getClass().getName());
}
}
else
{
attrStrValue = "";
}
}
else
{
throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
"Unknown type of extension attribute '" +
attrName + "': " +
attrValue.getClass().getName());
}
if (attrQNameValue != null)
{
DOMUtils.printQualifiedAttribute(attrName, attrQNameValue, def, pw);
}
else
{
DOMUtils.printQualifiedAttribute(attrName, attrStrValue, def, pw);
}
}
}
protected void printDocumentation(Element docElement,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (docElement != null)
{
DOM2Writer.serializeAsXML(docElement, def.getNamespaces(), pw);
pw.println();
}
}
protected void printTypes(Types types, Definition def, PrintWriter pw)
throws WSDLException
{
if (types != null)
{
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_TYPES,
def);
pw.print(" <" + tagName);
printExtensibilityAttributes(Types.class, types, def, pw);
pw.println('>');
printDocumentation(types.getDocumentationElement(), def, pw);
List extElements = types.getExtensibilityElements();
printExtensibilityElements(Types.class, extElements, def, pw);
pw.println(" " + tagName + '>');
}
}
protected void printImports(Map imports, Definition def, PrintWriter pw)
throws WSDLException
{
if (imports != null)
{
String tagName =
DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL,
Constants.ELEM_IMPORT,
def);
Iterator importListIterator = imports.values().iterator();
while (importListIterator.hasNext())
{
List importList = (List)importListIterator.next();
Iterator importIterator = importList.iterator();
while (importIterator.hasNext())
{
Import importDef = (Import)importIterator.next();
pw.print(" <" + tagName);
DOMUtils.printAttribute(Constants.ATTR_NAMESPACE,
importDef.getNamespaceURI(),
pw);
DOMUtils.printAttribute(Constants.ATTR_LOCATION,
importDef.getLocationURI(),
pw);
printExtensibilityAttributes(Import.class, importDef, def, pw);
pw.println('>');
printDocumentation(importDef.getDocumentationElement(), def, pw);
List extElements = importDef.getExtensibilityElements();
printExtensibilityElements(Import.class, extElements, def, pw);
pw.println(" " + tagName + '>');
}
}
}
}
protected void printNamespaceDeclarations(Map namespaces,
PrintWriter pw)
throws WSDLException
{
if (namespaces != null)
{
Set keys = namespaces.keySet();
Iterator keyIterator = keys.iterator();
while (keyIterator.hasNext())
{
String prefix = (String)keyIterator.next();
if (prefix == null)
{
prefix = "";
}
DOMUtils.printAttribute(Constants.ATTR_XMLNS +
(!prefix.equals("") ? ":" + prefix : ""),
(String)namespaces.get(prefix),
pw);
}
}
}
protected void printExtensibilityElements(Class parentType,
List extensibilityElements,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (extensibilityElements != null)
{
Iterator extensibilityElementIterator = extensibilityElements.iterator();
while (extensibilityElementIterator.hasNext())
{
ExtensibilityElement ext =
(ExtensibilityElement)extensibilityElementIterator.next();
QName elementType = ext.getElementType();
ExtensionRegistry extReg = def.getExtensionRegistry();
if (extReg == null)
{
throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
"No ExtensionRegistry set for this " +
"Definition, so unable to serialize a '" +
elementType +
"' element in the context of a '" +
parentType.getName() + "'.");
}
// If the wsdl was parsed using the parseSchema feature set to false
// then the extensibility will be an UnknownExtensibilityElement rather
// than a schema. Serialize this using the default serializer.
ExtensionSerializer extSer;
if (ext instanceof UnknownExtensibilityElement)
{
extSer = extReg.getDefaultSerializer();
}
else
{
extSer = extReg.querySerializer(parentType,elementType);
}
extSer.marshall(parentType, elementType, ext, pw, def, extReg);
}
}
}
private static Document getDocument(InputSource inputSource,
String desc) throws WSDLException
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(false);
try
{
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(inputSource);
return doc;
}
catch (RuntimeException e)
{
throw e;
}
catch (Exception e)
{
throw new WSDLException(WSDLException.PARSER_ERROR,
"Problem parsing '" + desc + "'.",
e);
}
}
/**
* Return a document generated from the specified WSDL model.
*/
public Document getDocument(Definition wsdlDef) throws WSDLException
{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
writeWSDL(wsdlDef, pw);
StringReader sr = new StringReader(sw.toString());
InputSource is = new InputSource(sr);
return getDocument(is, "- WSDL Document -");
}
/**
* Write the specified WSDL definition to the specified Writer.
*
* @param wsdlDef the WSDL definition to be written.
* @param sink the Writer to write the xml to.
*/
public void writeWSDL(Definition wsdlDef, Writer sink)
throws WSDLException
{
PrintWriter pw = new PrintWriter(sink);
String javaEncoding = (sink instanceof OutputStreamWriter)
? ((OutputStreamWriter)sink).getEncoding()
: null;
String xmlEncoding = DOM2Writer.java2XMLEncoding(javaEncoding);
if (xmlEncoding == null)
{
throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
"Unsupported Java encoding for writing " +
"wsdl file: '" + javaEncoding + "'.");
}
pw.println(Constants.XML_DECL_START +
xmlEncoding +
Constants.XML_DECL_END);
printDefinition(wsdlDef, pw);
}
/**
* Write the specified WSDL definition to the specified OutputStream.
*
* @param wsdlDef the WSDL definition to be written.
* @param sink the OutputStream to write the xml to.
*/
public void writeWSDL(Definition wsdlDef, OutputStream sink)
throws WSDLException
{
Writer writer = null;
try
{
writer = new OutputStreamWriter(sink, "UTF8");
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
writer = new OutputStreamWriter(sink);
}
writeWSDL(wsdlDef, writer);
}
/**
* A test driver.
*
*
*
*
*
*
* Name
* Description
* Default Value
*
*
*
* If set to true, status messages will be displayed.
*
*
*
*
* If set to true, imported WSDL documents will be
* retrieved and processed.
*
* :none
" for the input or output message name parameter.
* :none
" rather than null to search for
* unnamed input or output messages is necessary to retain backward compatibility
* with earlier versions of the JWSDL API, which defined a null value to
* mean 'ignore this parameter'.
* The colon in ":none
" is to avoid name clashes with input or output
* message names, which must be of type NCName (i.e. they cannot contain colons).
*
* @param name the name of the desired operation binding.
* @param inputName the name of the input message; if this is null
* it will be ignored, if this is ":none
" it means search for an input
* message without a name.
* @param outputName the name of the output message; if this is null
* it will be ignored, if this is ":none
" it means search for an output
* message without a name.
* @return the corresponding operation binding, or null if there wasn't
* any matching operation binding
*
* @throws IllegalArgumentException if duplicate operations are found.
*/
public BindingOperation getBindingOperation(String name,
String inputName,
String outputName);
/**
* Get all the operation bindings defined here.
*/
public List getBindingOperations();
/**
* Remove the specified operation binding. Note that operation names can
* be overloaded within a PortType. In case of overloading, the
* names of the input and output messages can be used to further
* refine the search.
* getBindingOperation
method.
*
* @param name the name of the operation binding to be removed.
* @param inputName the name of the input message; if this is null
* it will be ignored, if this is ":none
" it means search for an input
* message without a name.
* @param outputName the name of the output message; if this is null
* it will be ignored, if this is ":none
" it means search for an output
* message without a name.
* @return the binding operation which was removed, or null if there wasn't
* any matching operation
*
* @throws IllegalArgumentException if duplicate operations are found.
*
* @see #getBindingOperation(String, String, String)
*/
public BindingOperation removeBindingOperation(String name,
String inputName,
String outputName);
public void setUndefined(boolean isUndefined);
public boolean isUndefined();
} wsdl4j-1.6.3/src/javax/wsdl/BindingInput.java 0000644 0001750 0001750 00000001157 12111773372 017612 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl;
/**
* This interface represents an input binding. That is, it contains
* the information that would be specified in an input element
* contained within an operation element contained within a
* binding element.
*
* @author Matthew J. Duftler
*/
public interface BindingInput extends WSDLElement
{
/**
* Set the name of this input binding.
*
* @param name the desired name
*/
public void setName(String name);
/**
* Get the name of this input binding.
*
* @return the input binding name
*/
public String getName();
} wsdl4j-1.6.3/src/javax/wsdl/BindingOperation.java 0000644 0001750 0001750 00000004665 12111773372 020462 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl;
import java.util.*;
/**
* This interface represents a WSDL operation binding.
* That is, it holds the information that would be
* specified in the operation element contained within
* a binding element.
*
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public interface BindingOperation extends WSDLElement
{
/**
* Set the name of this operation binding.
*
* @param name the desired name
*/
public void setName(String name);
/**
* Get the name of this operation binding.
*
* @return the operation binding name
*/
public String getName();
/**
* Set the operation that this operation binding binds.
*
* @param operation the operation this operation binding binds
*/
public void setOperation(Operation operation);
/**
* Get the operation that this operation binding binds.
*
* @return the operation that this operation binding binds
*/
public Operation getOperation();
/**
* Set the input binding for this operation binding.
*
* @param bindingInput the new input binding
*/
public void setBindingInput(BindingInput bindingInput);
/**
* Get the input binding for this operation binding.
*
* @return the input binding
*/
public BindingInput getBindingInput();
/**
* Set the output binding for this operation binding.
*
* @param bindingOutput the new output binding
*/
public void setBindingOutput(BindingOutput bindingOutput);
/**
* Get the output binding for this operation binding.
*
* @return the output binding for the operation binding
*/
public BindingOutput getBindingOutput();
/**
* Add a fault binding.
*
* @param bindingFault the new fault binding
*/
public void addBindingFault(BindingFault bindingFault);
/**
* Remove a fault binding.
*
* @param name the name of the fault binding to be removed
* @return the BindingFault which was removed
*/
public BindingFault removeBindingFault(String name);
/**
* Get the specified fault binding.
*
* @param name the name of the desired fault binding.
* @return the corresponding fault binding, or null if there wasn't
* any matching fault binding
*/
public BindingFault getBindingFault(String name);
/**
* Get all the fault bindings associated with this operation binding.
*
* @return names of fault bindings
*/
public Map getBindingFaults();
} wsdl4j-1.6.3/src/javax/wsdl/Import.java 0000644 0001750 0001750 00000002760 12111773372 016473 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package javax.wsdl;
/**
* This interface represents an import, and may contain a reference
* to the imported definition.
*
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public interface Import extends WSDLElement
{
/**
* Set the namespace URI of this import.
*
* @param namespaceURI the desired namespace URI
*/
public void setNamespaceURI(String namespaceURI);
/**
* Get the namespace URI of this import.
*/
public String getNamespaceURI();
/**
* Set the location URI of this import.
*
* @param locationURI the desired location URI
*/
public void setLocationURI(String locationURI);
/**
* Get the location URI of this import.
*/
public String getLocationURI();
/**
* This property can be used to hang a referenced Definition,
* and the top-level Definition (i.e. the one with the <import>)
* will use this Definition when resolving referenced WSDL parts.
* This would need to be made into a generic reference to handle
* other types of referenced documents.
*/
public void setDefinition(Definition definition);
/**
* This property can be used to hang a referenced Definition,
* and the top-level Definition (i.e. the one with the <import>)
* will use this Definition when resolving referenced WSDL parts.
* This would need to be made into a generic reference to handle
* other types of referenced documents.
*/
public Definition getDefinition();
} wsdl4j-1.6.3/src/com/ 0000755 0001750 0001750 00000000000 12111773372 013045 5 ustar tony tony wsdl4j-1.6.3/src/com/ibm/ 0000755 0001750 0001750 00000000000 12111773372 013614 5 ustar tony tony wsdl4j-1.6.3/src/com/ibm/wsdl/ 0000755 0001750 0001750 00000000000 12111773372 014565 5 ustar tony tony wsdl4j-1.6.3/src/com/ibm/wsdl/InputImpl.java 0000644 0001750 0001750 00000003125 12111773372 017352 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl;
import java.util.*;
import javax.wsdl.*;
/**
* This class represents an input message, and contains the name
* of the input and the message itself.
*
* @author Matthew J. Duftler
*/
public class InputImpl extends AbstractWSDLElement implements Input
{
protected String name = null;
protected Message message = null;
protected List nativeAttributeNames =
Arrays.asList(Constants.INPUT_ATTR_NAMES);
public static final long serialVersionUID = 1;
/**
* Set the name of this input message.
*
* @param name the desired name
*/
public void setName(String name)
{
this.name = name;
}
/**
* Get the name of this input message.
*
* @return the input message name
*/
public String getName()
{
return name;
}
public void setMessage(Message message)
{
this.message = message;
}
public Message getMessage()
{
return message;
}
/**
* Get the list of local attribute names defined for this element in
* the WSDL specification.
*
* @return a List of Strings, one for each local attribute name
*/
public List getNativeAttributeNames()
{
return nativeAttributeNames;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("Input: name=" + name);
if (message != null)
{
strBuf.append("\n" + message);
}
String superString = super.toString();
if(!superString.equals(""))
{
strBuf.append("\n");
strBuf.append(superString);
}
return strBuf.toString();
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/FaultImpl.java 0000644 0001750 0001750 00000003126 12111773372 017327 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl;
import java.util.*;
import javax.wsdl.*;
/**
* This class represents a fault message, and contains the name
* of the fault and the message itself.
*
* @author Matthew J. Duftler
*/
public class FaultImpl extends AbstractWSDLElement implements Fault
{
protected String name = null;
protected Message message = null;
protected List nativeAttributeNames =
Arrays.asList(Constants.FAULT_ATTR_NAMES);
public static final long serialVersionUID = 1;
/**
* Set the name of this fault message.
*
* @param name the desired name
*/
public void setName(String name)
{
this.name = name;
}
/**
* Get the name of this fault message.
*
* @return the fault message name
*/
public String getName()
{
return name;
}
public void setMessage(Message message)
{
this.message = message;
}
public Message getMessage()
{
return message;
}
/**
* Get the list of local attribute names defined for this element in
* the WSDL specification.
*
* @return a List of Strings, one for each local attribute name
*/
public List getNativeAttributeNames()
{
return nativeAttributeNames;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("Fault: name=" + name);
if (message != null)
{
strBuf.append("\n" + message);
}
String superString = super.toString();
if(!superString.equals(""))
{
strBuf.append("\n");
strBuf.append(superString);
}
return strBuf.toString();
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/PortImpl.java 0000644 0001750 0001750 00000003504 12111773372 017200 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl;
import java.util.*;
import javax.wsdl.*;
/**
* This class represents a port, an endpoint for the
* functionality described by a particular port type.
*
* @author Paul Fremantle
* @author Nirmal Mukhi
* @author Matthew J. Duftler
*/
public class PortImpl extends AbstractWSDLElement implements Port
{
protected String name = null;
protected Binding binding = null;
protected List nativeAttributeNames =
Arrays.asList(Constants.PORT_ATTR_NAMES);
public static final long serialVersionUID = 1;
/**
* Set the name of this port.
*
* @param name the desired name
*/
public void setName(String name)
{
this.name = name;
}
/**
* Get the name of this port.
*
* @return the port name
*/
public String getName()
{
return name;
}
/**
* Set the binding this port should refer to.
*
* @param binding the desired binding
*/
public void setBinding(Binding binding)
{
this.binding = binding;
}
/**
* Get the binding this port refers to.
*
* @return the binding associated with this port
*/
public Binding getBinding()
{
return binding;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("Port: name=" + name);
if (binding != null)
{
strBuf.append("\n" + binding);
}
String superString = super.toString();
if(!superString.equals(""))
{
strBuf.append("\n");
strBuf.append(superString);
}
return strBuf.toString();
}
/**
* Get the list of local attribute names defined for this element in
* the WSDL specification.
*
* @return a List of Strings, one for each local attribute name
*/
public List getNativeAttributeNames()
{
return nativeAttributeNames;
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/factory/ 0000755 0001750 0001750 00000000000 12111773372 016234 5 ustar tony tony wsdl4j-1.6.3/src/com/ibm/wsdl/factory/WSDLFactoryImpl.java 0000644 0001750 0001750 00000003070 12111773372 022022 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package com.ibm.wsdl.factory;
import javax.wsdl.*;
import javax.wsdl.extensions.*;
import javax.wsdl.factory.*;
import javax.wsdl.xml.*;
import com.ibm.wsdl.*;
import com.ibm.wsdl.extensions.*;
import com.ibm.wsdl.xml.*;
/**
* This class is a concrete implementation of the abstract class
* WSDLFactory. Some ideas used here have been shamelessly
* copied from the wonderful JAXP and Xerces work.
*
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class WSDLFactoryImpl extends WSDLFactory
{
/**
* Create a new instance of a Definition, with an instance
* of a PopulatedExtensionRegistry as its ExtensionRegistry.
*
* @see com.ibm.wsdl.extensions.PopulatedExtensionRegistry
*/
public Definition newDefinition()
{
Definition def = new DefinitionImpl();
ExtensionRegistry extReg = newPopulatedExtensionRegistry();
def.setExtensionRegistry(extReg);
return def;
}
/**
* Create a new instance of a WSDLReader.
*/
public WSDLReader newWSDLReader()
{
return new WSDLReaderImpl();
}
/**
* Create a new instance of a WSDLWriter.
*/
public WSDLWriter newWSDLWriter()
{
return new WSDLWriterImpl();
}
/**
* Create a new instance of an ExtensionRegistry with pre-registered
* serializers/deserializers for the SOAP, HTTP and MIME
* extensions. Java extensionTypes are also mapped for all
* the SOAP, HTTP and MIME extensions.
*/
public ExtensionRegistry newPopulatedExtensionRegistry()
{
return new PopulatedExtensionRegistry();
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/AbstractWSDLElement.java 0000644 0001750 0001750 00000011635 12111773372 021205 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package com.ibm.wsdl;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import javax.wsdl.WSDLElement;
import javax.wsdl.extensions.ExtensibilityElement;
import javax.xml.namespace.QName;
import org.w3c.dom.Element;
/**
* Abstract super class for all WSDL Elements, providing some basic
* common functionality.
*/
public abstract class AbstractWSDLElement implements WSDLElement
{
protected Element docEl;
protected List extElements = new Vector();
protected Map extensionAttributes = new HashMap();
/**
* Set the documentation element for this document. This dependency
* on org.w3c.dom.Element should eventually be removed when a more
* appropriate way of representing this information is employed.
*
* @param docEl the documentation element
*/
public void setDocumentationElement(Element docEl)
{
this.docEl = docEl;
}
/**
* Get the documentation element. This dependency on org.w3c.dom.Element
* should eventually be removed when a more appropriate way of
* representing this information is employed.
*
* @return the documentation element
*/
public Element getDocumentationElement()
{
return docEl;
}
/**
* Add an extensibility element.
*
* @param extElement the extensibility element to be added
*/
public void addExtensibilityElement(ExtensibilityElement extElement)
{
extElements.add(extElement);
}
/**
* Remove an extensibility element.
*
* @param extElement the extensibility element to be removed.
* @return the extensibility element which was removed.
*/
public ExtensibilityElement removeExtensibilityElement(ExtensibilityElement extElement)
{
if(extElements.remove(extElement))
{
return extElement;
}
else
{
return null;
}
}
/**
* Get all the extensibility elements defined here.
*/
public List getExtensibilityElements()
{
return extElements;
}
/**
* Set an extension attribute on this element. Pass in a null value to remove
* an extension attribute.
*
* @param name the extension attribute name
* @param value the extension attribute value. Can be a String, a QName, a
* List of Strings, or a List of QNames.
*
* @see #getExtensionAttribute
* @see #getExtensionAttributes
* @see
* javax.wsdl.extensions.ExtensionRegistry#registerExtensionAttributeType
* @see
* javax.wsdl.extensions.ExtensionRegistry#queryExtensionAttributeType
*/
public void setExtensionAttribute(QName name, Object value)
{
if (value != null)
{
extensionAttributes.put(name, value);
}
else
{
extensionAttributes.remove(name);
}
}
/**
* Retrieve an extension attribute from this element. If the extension
* attribute is not defined, null is returned.
*
* @param name the extension attribute name
*
* @return the value of the extension attribute, or null if
* it is not defined. Can be a String, a QName, a List of Strings, or a List
* of QNames.
*
* @see #setExtensionAttribute
* @see #getExtensionAttributes
* @see
* javax.wsdl.extensions.ExtensionRegistry#registerExtensionAttributeType
* @see
* javax.wsdl.extensions.ExtensionRegistry#queryExtensionAttributeType
*/
public Object getExtensionAttribute(QName name)
{
return extensionAttributes.get(name);
}
/**
* Get the map containing all the extension attributes defined
* on this element. The keys are the qnames of the attributes.
*
* @return a map containing all the extension attributes defined
* on this element
*
* @see #setExtensionAttribute
* @see #getExtensionAttribute
*/
public Map getExtensionAttributes()
{
return extensionAttributes;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
if (extElements.size() > 0)
{
Iterator extIterator = extElements.iterator();
if(extIterator.hasNext())
{
strBuf.append(extIterator.next());
while (extIterator.hasNext())
{
strBuf.append("\n");
strBuf.append(extIterator.next());
}
}
}
if(extensionAttributes.size() > 0)
{
Iterator keys = extensionAttributes.keySet().iterator();
if(keys.hasNext())
{
QName name = (QName)keys.next();
strBuf.append("extension attribute: ");
strBuf.append(name);
strBuf.append("=");
strBuf.append(extensionAttributes.get(name));
while (keys.hasNext())
{
name = (QName)keys.next();
strBuf.append("\n");
strBuf.append("extension attribute: ");
strBuf.append(name);
strBuf.append("=");
strBuf.append(extensionAttributes.get(name));
}
}
}
return strBuf.toString();
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/MessageImpl.java 0000644 0001750 0001750 00000006721 12111773372 017644 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl;
import java.util.*;
import javax.wsdl.*;
import javax.xml.namespace.*;
/**
* This class describes a message used for communication with an operation.
*
* @author Paul Fremantle
* @author Nirmal Mukhi
* @author Matthew J. Duftler
*/
public class MessageImpl extends AbstractWSDLElement implements Message
{
protected Map parts = new HashMap();
protected List additionOrderOfParts = new Vector();
protected QName name = null;
protected List nativeAttributeNames =
Arrays.asList(Constants.MESSAGE_ATTR_NAMES);
protected boolean isUndefined = true;
public static final long serialVersionUID = 1;
/**
* Set the name of this message.
*
* @param name the desired name
*/
public void setQName(QName name)
{
this.name = name;
}
/**
* Get the name of this message.
*
* @return the message name
*/
public QName getQName()
{
return name;
}
/**
* Add a part to this message.
*
* @param part the part to be added
*/
public void addPart(Part part)
{
String partName = part.getName();
parts.put(partName, part);
additionOrderOfParts.add(partName);
}
/**
* Get the specified part.
*
* @param name the name of the desired part.
* @return the corresponding part, or null if there wasn't
* any matching part
*/
public Part getPart(String name)
{
return (Part)parts.get(name);
}
/**
* Remove the specified part.
*
* @param name the name of the part to be removed.
* @return the part which was removed
*/
public Part removePart(String name)
{
return (Part)parts.remove(name);
}
/**
* Get all the parts defined here.
*/
public Map getParts()
{
return parts;
}
/**
* Get an ordered list of parts as specified by the partOrder
* argument.
*
* @param partOrder a list of strings, with each string referring
* to a part by its name. If this argument is null, the parts are
* returned in the order in which they were added to the message.
* @return the list of parts
*/
public List getOrderedParts(List partOrder)
{
List orderedParts = new Vector();
if (partOrder == null)
{
partOrder = additionOrderOfParts;
}
Iterator partNameIterator = partOrder.iterator();
while (partNameIterator.hasNext())
{
String partName = (String)partNameIterator.next();
Part part = getPart(partName);
if (part != null)
{
orderedParts.add(part);
}
}
return orderedParts;
}
public void setUndefined(boolean isUndefined)
{
this.isUndefined = isUndefined;
}
public boolean isUndefined()
{
return isUndefined;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("Message: name=" + name);
if (parts != null)
{
Iterator partsIterator = parts.values().iterator();
while (partsIterator.hasNext())
{
strBuf.append("\n" + partsIterator.next());
}
}
String superString = super.toString();
if(!superString.equals(""))
{
strBuf.append("\n");
strBuf.append(superString);
}
return strBuf.toString();
}
/**
* Get the list of local attribute names defined for this element in
* the WSDL specification.
*
* @return a List of Strings, one for each local attribute name
*/
public List getNativeAttributeNames()
{
return nativeAttributeNames;
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/DefinitionImpl.java 0000644 0001750 0001750 00000047171 12111773372 020354 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl;
import java.util.*;
import javax.wsdl.*;
import javax.wsdl.extensions.*;
import javax.xml.namespace.*;
/**
* This class represents a WSDL definition.
*
* @author Paul Fremantle
* @author Nirmal Mukhi
* @author Matthew J. Duftler
*/
public class DefinitionImpl extends AbstractWSDLElement implements Definition
{
protected String documentBaseURI = null;
protected QName name = null;
protected String targetNamespace = null;
protected Map namespaces = new HashMap();
protected Map imports = new HashMap();
protected Types types = null;
protected Map messages = new HashMap();
protected Map bindings = new HashMap();
protected Map portTypes = new HashMap();
protected Map services = new HashMap();
protected List nativeAttributeNames =
Arrays.asList(Constants.DEFINITION_ATTR_NAMES);
protected ExtensionRegistry extReg = null;
public static final long serialVersionUID = 1;
/**
* Set the document base URI of this definition. Can be used to
* represent the origin of the Definition, and can be exploited
* when resolving relative URIs (e.g. in <import>s).
*
* @param documentBaseURI the document base URI of this definition
*/
public void setDocumentBaseURI(String documentBaseURI)
{
this.documentBaseURI = documentBaseURI;
}
/**
* Get the document base URI of this definition.
*
* @return the document base URI
*/
public String getDocumentBaseURI()
{
return documentBaseURI;
}
/**
* Set the name of this definition.
*
* @param name the desired name
*/
public void setQName(QName name)
{
this.name = name;
}
/**
* Get the name of this definition.
*
* @return the definition name
*/
public QName getQName()
{
return name;
}
/**
* Set the target namespace in which WSDL elements are defined.
*
* @param targetNamespace the target namespace
*/
public void setTargetNamespace(String targetNamespace)
{
this.targetNamespace = targetNamespace;
}
/**
* Get the target namespace in which the WSDL elements
* are defined.
*
* @return the target namespace
*/
public String getTargetNamespace()
{
return targetNamespace;
}
/**
* This is a way to add a namespace association to a definition.
* It is similar to adding a namespace prefix declaration to the
* top of a <wsdl:definition> element. This has nothing to do
* with the <wsdl:import> element; there are separate methods for
* dealing with information described by <wsdl:import> elements.
*
* @param prefix the prefix to use for this namespace (when
* rendering this information as XML). Use null or an empty string
* to describe the default namespace (i.e. xmlns="...").
* @param namespaceURI the namespace URI to associate the prefix
* with. If you use null, the namespace association will be removed.
*/
public void addNamespace(String prefix, String namespaceURI)
{
if (prefix == null)
{
prefix = "";
}
if (namespaceURI != null)
{
namespaces.put(prefix, namespaceURI);
}
else
{
namespaces.remove(prefix);
}
}
/**
* Get the namespace URI associated with this prefix. Or null if
* there is no namespace URI associated with this prefix. This is
* unrelated to the <wsdl:import> element.
*
* @see #addNamespace(String, String)
* @see #getPrefix(String)
*/
public String getNamespace(String prefix)
{
if (prefix == null)
{
prefix = "";
}
return (String)namespaces.get(prefix);
}
/**
* Remove the namespace URI associated with this prefix.
*
* @param prefix the prefix of the namespace to be removed.
* @return the namespace URI which was removed
*/
public String removeNamespace(String prefix)
{
if (prefix == null)
{
prefix = "";
}
return (String)namespaces.remove(prefix);
}
/**
* Get a prefix associated with this namespace URI. Or null if
* there are no prefixes associated with this namespace URI. This is
* unrelated to the <wsdl:import> element.
*
* @see #addNamespace(String, String)
* @see #getNamespace(String)
*/
public String getPrefix(String namespaceURI)
{
if (namespaceURI == null)
{
return null;
}
Iterator entryIterator = namespaces.entrySet().iterator();
while (entryIterator.hasNext())
{
Map.Entry entry = (Map.Entry)entryIterator.next();
String prefix = (String)entry.getKey();
String assocNamespaceURI = (String)entry.getValue();
if (namespaceURI.equals(assocNamespaceURI))
{
return prefix;
}
}
return null;
}
/**
* Get all namespace associations in this definition. The keys are
* the prefixes, and the namespace URIs are the values. This is
* unrelated to the <wsdl:import> element.
*
* @see #addNamespace(String, String)
*/
public Map getNamespaces()
{
return namespaces;
}
/**
* Set the types section.
*/
public void setTypes(Types types)
{
this.types = types;
}
/**
* Get the types section.
*
* @return the types section
*/
public Types getTypes()
{
return types;
}
/**
* Add an import to this WSDL description.
*
* @param importDef the import to be added
*/
public void addImport(Import importDef)
{
String namespaceURI = importDef.getNamespaceURI();
List importList = (List)imports.get(namespaceURI);
if (importList == null)
{
importList = new Vector();
imports.put(namespaceURI, importList);
}
importList.add(importDef);
}
/**
* Remove an import from this WSDL description.
*
* @param importDef the import to be removed
*/
public Import removeImport(Import importDef)
{
String namespaceURI = importDef.getNamespaceURI();
List importList = (List)imports.get(namespaceURI);
Import removed = null;
if (importList != null && importList.remove(importDef))
{
removed = importDef;
}
return removed;
}
/**
* Get the list of imports for the specified namespaceURI.
*
* @param namespaceURI the namespaceURI associated with the
* desired imports.
* @return a list of the corresponding imports, or null if
* there weren't any matching imports
*/
public List getImports(String namespaceURI)
{
return (List)imports.get(namespaceURI);
}
/**
* Get a map of lists containing all the imports defined here.
* The map's keys are the namespaceURIs, and the map's values
* are lists. There is one list for each namespaceURI for which
* imports have been defined.
*/
public Map getImports()
{
return imports;
}
/**
* Add a message to this WSDL description.
*
* @param message the message to be added
*/
public void addMessage(Message message)
{
messages.put(message.getQName(), message);
}
/**
* Get the specified message. Also checks imported documents.
*
* @param name the name of the desired message.
* @return the corresponding message, or null if there wasn't
* any matching message
*/
public Message getMessage(QName name)
{
Message message = (Message)messages.get(name);
if (message == null && name != null)
{
message = (Message)getFromImports(Constants.ELEM_MESSAGE, name);
}
return message;
}
/**
* Remove the specified message from this definition.
*
* @param name the name of the message to remove
* @return the message previously associated with this qname, if there
* was one; may return null
*/
public Message removeMessage(QName name)
{
return (Message) messages.remove(name);
}
/**
* Get all the messages defined here.
*/
public Map getMessages()
{
return messages;
}
/**
* Add a binding to this WSDL description.
*
* @param binding the binding to be added
*/
public void addBinding(Binding binding)
{
bindings.put(binding.getQName(), binding);
}
/**
* Get the specified binding. Also checks imported documents.
*
* @param name the name of the desired binding.
* @return the corresponding binding, or null if there wasn't
* any matching binding
*/
public Binding getBinding(QName name)
{
Binding binding = (Binding)bindings.get(name);
if (binding == null && name != null)
{
binding = (Binding)getFromImports(Constants.ELEM_BINDING, name);
}
return binding;
}
/**
* Remove the specified binding from this definition.
*
* @param name the name of the binding to remove
* @return the binding previously associated with this qname, if there
* was one; may return null
*/
public Binding removeBinding(QName name)
{
return (Binding) bindings.remove(name);
}
/**
* Get all the bindings defined in this Definition.
*/
public Map getBindings()
{
return bindings;
}
/**
* Add a portType to this WSDL description.
*
* @param portType the portType to be added
*/
public void addPortType(PortType portType)
{
portTypes.put(portType.getQName(), portType);
}
/**
* Get the specified portType. Also checks imported documents.
*
* @param name the name of the desired portType.
* @return the corresponding portType, or null if there wasn't
* any matching portType
*/
public PortType getPortType(QName name)
{
PortType portType = (PortType)portTypes.get(name);
if (portType == null && name != null)
{
portType = (PortType)getFromImports(Constants.ELEM_PORT_TYPE, name);
}
return portType;
}
/**
* Remove the specified portType from this definition.
*
* @param name the name of the portType to remove
* @return the portType previously associated with this qname, if there
* was one; may return null
*/
public PortType removePortType(QName name)
{
return (PortType) portTypes.remove(name);
}
/**
* Get all the portTypes defined in this Definition.
*/
public Map getPortTypes()
{
return portTypes;
}
/**
* Add a service to this WSDL description.
*
* @param service the service to be added
*/
public void addService(Service service)
{
services.put(service.getQName(), service);
}
/**
* Get the specified service. Also checks imported documents.
*
* @param name the name of the desired service.
* @return the corresponding service, or null if there wasn't
* any matching service
*/
public Service getService(QName name)
{
Service service = (Service)services.get(name);
if (service == null && name != null)
{
service = (Service)getFromImports(Constants.ELEM_SERVICE, name);
}
return service;
}
/**
* Remove the specified service from this definition.
*
* @param name the name of the service to remove
* @return the service previously associated with this qname, if there
* was one; may return null
*/
public Service removeService(QName name)
{
return (Service) services.remove(name);
}
/**
* Get all the services defined in this Definition.
*/
public Map getServices()
{
return services;
}
/**
* Create a new binding.
*
* @return the newly created binding
*/
public Binding createBinding()
{
return new BindingImpl();
}
/**
* Create a new binding fault.
*
* @return the newly created binding fault
*/
public BindingFault createBindingFault()
{
return new BindingFaultImpl();
}
/**
* Create a new binding input.
*
* @return the newly created binding input
*/
public BindingInput createBindingInput()
{
return new BindingInputImpl();
}
/**
* Create a new binding operation.
*
* @return the newly created binding operation
*/
public BindingOperation createBindingOperation()
{
return new BindingOperationImpl();
}
/**
* Create a new binding output.
*
* @return the newly created binding output
*/
public BindingOutput createBindingOutput()
{
return new BindingOutputImpl();
}
/**
* Create a new fault.
*
* @return the newly created fault
*/
public Fault createFault()
{
return new FaultImpl();
}
/**
* Create a new import.
*
* @return the newly created import
*/
public Import createImport()
{
return new ImportImpl();
}
/**
* Create a new input.
*
* @return the newly created input
*/
public Input createInput()
{
return new InputImpl();
}
/**
* Create a new message.
*
* @return the newly created message
*/
public Message createMessage()
{
return new MessageImpl();
}
/**
* Create a new operation.
*
* @return the newly created operation
*/
public Operation createOperation()
{
return new OperationImpl();
}
/**
* Create a new output.
*
* @return the newly created output
*/
public Output createOutput()
{
return new OutputImpl();
}
/**
* Create a new part.
*
* @return the newly created part
*/
public Part createPart()
{
return new PartImpl();
}
/**
* Create a new port.
*
* @return the newly created port
*/
public Port createPort()
{
return new PortImpl();
}
/**
* Create a new port type.
*
* @return the newly created port type
*/
public PortType createPortType()
{
return new PortTypeImpl();
}
/**
* Create a new service.
*
* @return the newly created service
*/
public Service createService()
{
return new ServiceImpl();
}
/**
* Create a new types section.
*
* @return the newly created types section
*/
public Types createTypes()
{
return new TypesImpl();
}
/**
* Set the ExtensionRegistry for this Definition.
*/
public void setExtensionRegistry(ExtensionRegistry extReg)
{
this.extReg = extReg;
}
/**
* Get a reference to the ExtensionRegistry for this Definition.
*/
public ExtensionRegistry getExtensionRegistry()
{
return extReg;
}
private Object getFromImports(String typeOfDefinition, QName name)
{
Object ret = null;
List importList = getImports(name.getNamespaceURI());
if (importList != null)
{
Iterator importIterator = importList.iterator();
while (importIterator.hasNext())
{
Import importDef = (Import)importIterator.next();
if (importDef != null)
{
Definition importedDef = importDef.getDefinition();
if (importedDef != null)
{
/*
These object comparisons will work fine because
this private method is only called from within
this class, using only the pre-defined constants
from the Constants class as the typeOfDefinition
argument.
*/
if (typeOfDefinition == Constants.ELEM_SERVICE)
{
ret = importedDef.getService(name);
}
else if (typeOfDefinition == Constants.ELEM_MESSAGE)
{
ret = importedDef.getMessage(name);
}
else if (typeOfDefinition == Constants.ELEM_BINDING)
{
ret = importedDef.getBinding(name);
}
else if (typeOfDefinition == Constants.ELEM_PORT_TYPE)
{
ret = importedDef.getPortType(name);
}
if (ret != null)
{
return ret;
}
}
}
}
}
return ret;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("Definition: name=" + name +
" targetNamespace=" + targetNamespace);
if (imports != null)
{
Iterator importIterator = imports.values().iterator();
while (importIterator.hasNext())
{
strBuf.append("\n" + importIterator.next());
}
}
if (types != null)
{
strBuf.append("\n" + types);
}
if (messages != null)
{
Iterator msgsIterator = messages.values().iterator();
while (msgsIterator.hasNext())
{
strBuf.append("\n" + msgsIterator.next());
}
}
if (portTypes != null)
{
Iterator portTypeIterator = portTypes.values().iterator();
while (portTypeIterator.hasNext())
{
strBuf.append("\n" + portTypeIterator.next());
}
}
if (bindings != null)
{
Iterator bindingIterator = bindings.values().iterator();
while (bindingIterator.hasNext())
{
strBuf.append("\n" + bindingIterator.next());
}
}
if (services != null)
{
Iterator serviceIterator = services.values().iterator();
while (serviceIterator.hasNext())
{
strBuf.append("\n" + serviceIterator.next());
}
}
String superString = super.toString();
if(!superString.equals(""))
{
strBuf.append("\n");
strBuf.append(superString);
}
return strBuf.toString();
}
/**
* Get the list of local attribute names defined for this element in
* the WSDL specification.
*
* @return a List of Strings, one for each local attribute name
*/
public List getNativeAttributeNames()
{
return nativeAttributeNames;
}
/**
* Get all the bindings defined in this Definition and
* those in any imported Definitions in the WSDL tree.
*/
public Map getAllBindings()
{
Map allBindings = new HashMap(getBindings());
Map importMap = getImports();
Iterator mapItr = importMap.values().iterator();
while(mapItr.hasNext())
{
Vector importDefs = (Vector) mapItr.next();
Iterator vecItr = importDefs.iterator();
while(vecItr.hasNext())
{
Import importDef = (Import) vecItr.next();
Definition importedDef = importDef.getDefinition();
//importedDef may be null (e.g. if the javax.wsdl.importDocuments feature is disabled).
if(importedDef != null)
{
allBindings.putAll(importedDef.getAllBindings());
}
}
}
return allBindings;
}
/**
* Get all the portTypes defined in this Definition and
* those in any imported Definitions in the WSDL tree.
*/
public Map getAllPortTypes()
{
Map allPortTypes = new HashMap(getPortTypes());
Map importMap = getImports();
Iterator mapItr = importMap.values().iterator();
while(mapItr.hasNext())
{
Vector importDefs = (Vector) mapItr.next();
Iterator vecItr = importDefs.iterator();
while(vecItr.hasNext())
{
Import importDef = (Import) vecItr.next();
Definition importedDef = importDef.getDefinition();
//importedDef may be null (e.g. if the javax.wsdl.importDocuments feature is disabled).
if(importedDef != null)
{
allPortTypes.putAll(importedDef.getAllPortTypes());
}
}
}
return allPortTypes;
}
/**
* Get all the services defined in this Definition and
* those in any imported Definitions in the WSDL tree.
*/
public Map getAllServices()
{
Map allServices = new HashMap(getServices());
Map importMap = getImports();
Iterator mapItr = importMap.values().iterator();
while(mapItr.hasNext())
{
Vector importDefs = (Vector) mapItr.next();
Iterator vecItr = importDefs.iterator();
while(vecItr.hasNext())
{
Import importDef = (Import) vecItr.next();
Definition importedDef = importDef.getDefinition();
//importedDef may be null (e.g. if the javax.wsdl.importDocuments feature is disabled).
if(importedDef != null)
{
allServices.putAll(importedDef.getAllServices());
}
}
}
return allServices;
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/BindingImpl.java 0000644 0001750 0001750 00000023606 12111773372 017633 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl;
import java.util.*;
import javax.wsdl.*;
import javax.xml.namespace.*;
/**
* This class represents a port type binding and describes the
* protocol required for using operations in a port type.
*
* @author Paul Fremantle
* @author Nirmal Mukhi
* @author Matthew J. Duftler
*/
public class BindingImpl extends AbstractWSDLElement implements Binding
{
protected QName name = null;
protected PortType portType = null;
protected List bindingOperations = new Vector();
protected List nativeAttributeNames =
Arrays.asList(Constants.BINDING_ATTR_NAMES);
protected boolean isUndefined = true;
public static final long serialVersionUID = 1;
/**
* Set the name of this binding.
*
* @param name the desired name
*/
public void setQName(QName name)
{
this.name = name;
}
/**
* Get the name of this binding.
*
* @return the binding name
*/
public QName getQName()
{
return name;
}
/**
* Set the port type this is a binding for.
*
* @param portType the port type associated with this binding
*/
public void setPortType(PortType portType)
{
this.portType = portType;
}
/**
* Get the port type this is a binding for.
*
* @return the associated port type
*/
public PortType getPortType()
{
return portType;
}
/**
* Add an operation binding to binding.
*
* @param bindingOperation the operation binding to be added
*/
public void addBindingOperation(BindingOperation bindingOperation)
{
bindingOperations.add(bindingOperation);
}
/**
* Get the specified operation binding. Note that operation names can
* be overloaded within a PortType. In case of overloading, the
* names of the input and output messages can be used to further
* refine the search.
* :none
" for the input or output message name parameter.
* :none
" rather than null to search for
* unnamed input or output messages is necessary to retain backward compatibility
* with earlier versions of the JWSDL API, which defined a null value to
* mean 'ignore this parameter'.
* The colon in ":none
" is to avoid name clashes with input or output
* message names, which must be of type NCName (i.e. they cannot contain colons).
*
* @param name the name of the desired operation binding.
* @param inputName the name of the input message; if this is null
* it will be ignored, if this is ":none
" it means search for an input
* message without a name.
* @param outputName the name of the output message; if this is null
* it will be ignored, if this is ":none
" it means search for an output
* message without a name.
* @return the corresponding operation binding, or null if there wasn't
* any matching operation binding
*
* @throws IllegalArgumentException if duplicate operations are found.
*/
public BindingOperation getBindingOperation(String name,
String inputName,
String outputName)
{
boolean found = false;
BindingOperation ret = null;
Iterator opBindingIterator = bindingOperations.iterator();
while (opBindingIterator.hasNext())
{
BindingOperation op = (BindingOperation)opBindingIterator.next();
String opName = op.getName();
if (name != null && opName != null)
{
if (!name.equals(opName))
{
op = null;
}
}
else if (name != null || opName != null)
{
op = null;
}
if (op != null && inputName != null)
{
PortType pt = getPortType();
OperationType opStyle = null;
if (pt != null)
{
Operation tempOp = pt.getOperation(name, inputName, outputName);
if (tempOp != null)
{
opStyle = tempOp.getStyle();
}
}
String defaultInputName = opName;
if (opStyle == OperationType.REQUEST_RESPONSE)
{
defaultInputName = opName + "Request";
}
else if (opStyle == OperationType.SOLICIT_RESPONSE)
{
defaultInputName = opName + "Solicit";
}
boolean specifiedDefault = inputName.equals(defaultInputName);
BindingInput input = op.getBindingInput();
if (input != null)
{
String opInputName = input.getName();
if (opInputName == null)
{
if (!specifiedDefault && !inputName.equals(Constants.NONE))
{
op = null;
}
}
else if (!opInputName.equals(inputName))
{
op = null;
}
}
else
{
op = null;
}
}
if (op != null && outputName != null)
{
PortType pt = getPortType();
OperationType opStyle = null;
if (pt != null)
{
Operation tempOp = pt.getOperation(name, inputName, outputName);
if (tempOp != null)
{
opStyle = tempOp.getStyle();
}
}
String defaultOutputName = opName;
if (opStyle == OperationType.REQUEST_RESPONSE
|| opStyle == OperationType.SOLICIT_RESPONSE)
{
defaultOutputName = opName + "Response";
}
boolean specifiedDefault = outputName.equals(defaultOutputName);
BindingOutput output = op.getBindingOutput();
if (output != null)
{
String opOutputName = output.getName();
if (opOutputName == null)
{
if (!specifiedDefault && !outputName.equals(Constants.NONE))
{
op = null;
}
}
else if (!opOutputName.equals(outputName))
{
op = null;
}
}
else
{
op = null;
}
}
if (op != null)
{
if (found)
{
throw new IllegalArgumentException("Duplicate operation with " +
"name=" + name +
(inputName != null
? ", inputName=" + inputName
: "") +
(outputName != null
? ", outputName=" + outputName
: "") +
", found in binding '" +
getQName() + "'.");
}
else
{
found = true;
ret = op;
}
}
} //end while loop
return ret;
}
/**
* Get all the operation bindings defined here.
*/
public List getBindingOperations()
{
return bindingOperations;
}
/**
* Remove the specified operation binding. Note that operation names can
* be overloaded within a PortType. In case of overloading, the
* names of the input and output messages can be used to further
* refine the search.
* getBindingOperation
method.
*
* @param name the name of the operation binding to be removed.
* @param inputName the name of the input message; if this is null
* it will be ignored, if this is ":none
" it means search for an input
* message without a name.
* @param outputName the name of the output message; if this is null
* it will be ignored, if this is ":none
" it means search for an output
* message without a name.
* @return the binding operation which was removed, or null if there wasn't
* any matching operation
*
* @throws IllegalArgumentException if duplicate operations are found.
*
* @see #getBindingOperation(String, String, String)
*/
public BindingOperation removeBindingOperation(String name,
String inputName,
String outputName)
{
BindingOperation op = getBindingOperation(name,inputName,outputName);
if(bindingOperations.remove(op))
{
return op;
}
else return null;
}
public void setUndefined(boolean isUndefined)
{
this.isUndefined = isUndefined;
}
public boolean isUndefined()
{
return isUndefined;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("Binding: name=");
strBuf.append(name);
if (portType != null)
{
strBuf.append("\n");
strBuf.append(portType);
}
if (bindingOperations != null)
{
Iterator bindingOperationIterator = bindingOperations.iterator();
while (bindingOperationIterator.hasNext())
{
strBuf.append("\n");
strBuf.append(bindingOperationIterator.next());
}
}
String superString = super.toString();
if(!superString.equals(""))
{
strBuf.append("\n");
strBuf.append(superString);
}
return strBuf.toString();
}
/**
* Get the list of local attribute names defined for this element in
* the WSDL specification.
*
* @return a List of Strings, one for each local attribute name
*/
public List getNativeAttributeNames()
{
return nativeAttributeNames;
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/PortTypeImpl.java 0000644 0001750 0001750 00000020754 12111773372 020050 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl;
import java.util.*;
import javax.wsdl.*;
import javax.xml.namespace.*;
/**
* This class represents a port type. It contains information about
* operations associated with this port type.
*
* @author Paul Fremantle
* @author Nirmal Mukhi
* @author Matthew J. Duftler
*/
public class PortTypeImpl extends AbstractWSDLElement implements PortType
{
protected QName name = null;
protected List operations = new Vector();
protected List nativeAttributeNames =
Arrays.asList(Constants.PORT_TYPE_ATTR_NAMES);
protected boolean isUndefined = true;
public static final long serialVersionUID = 1;
/**
* Set the name of this port type.
*
* @param name the desired name
*/
public void setQName(QName name)
{
this.name = name;
}
/**
* Get the name of this port type.
*
* @return the port type name
*/
public QName getQName()
{
return name;
}
/**
* Add an operation to this port type.
*
* @param operation the operation to be added
*/
public void addOperation(Operation operation)
{
operations.add(operation);
}
/**
* Get the specified operation. Note that operation names can
* be overloaded within a PortType. In case of overloading, the
* names of the input and output messages can be used to further
* refine the search.
* :none
" for the input or output message name parameter.
* :none
" rather than null to search for
* unnamed input or output messages is necessary to retain backward compatibility
* with earlier versions of the JWSDL API, which defined a null value to
* mean 'ignore this parameter'.
* The colon in ":none
" is to avoid name clashes with input or output
* message names, which must be of type NCName (i.e. they cannot contain colons).
*
* @param name the name of the desired operation.
* @param inputName the name of the input message; if this is null
* it will be ignored, if this is ":none
" it means search for an input
* message without a name.
* @param outputName the name of the output message; if this is null
* it will be ignored, if this is ":none
" it means search for an output
* message without a name.
* @return the corresponding operation, or null if there wasn't
* any matching operation
*
* @throws IllegalArgumentException if duplicate operations are found.
*/
public Operation getOperation(String name,
String inputName,
String outputName)
{
boolean found = false;
Operation ret = null;
Iterator opIterator = operations.iterator();
while (opIterator.hasNext())
{
Operation op = (Operation)opIterator.next();
String opName = op.getName();
if (name != null && opName != null)
{
if (!name.equals(opName))
{
op = null;
}
}
else if (name != null || opName != null)
{
op = null;
}
if (op != null && inputName != null)
{
OperationType opStyle = op.getStyle();
String defaultInputName = opName;
if (opStyle == OperationType.REQUEST_RESPONSE)
{
defaultInputName = opName + "Request";
}
else if (opStyle == OperationType.SOLICIT_RESPONSE)
{
defaultInputName = opName + "Solicit";
}
boolean specifiedDefault = inputName.equals(defaultInputName);
Input input = op.getInput();
if (input != null)
{
String opInputName = input.getName();
if (opInputName == null)
{
if (!specifiedDefault && !inputName.equals(Constants.NONE))
{
op = null;
}
}
else if (!opInputName.equals(inputName))
{
op = null;
}
}
else
{
op = null;
}
}
if (op != null && outputName != null)
{
OperationType opStyle = op.getStyle();
String defaultOutputName = opName;
if (opStyle == OperationType.REQUEST_RESPONSE
|| opStyle == OperationType.SOLICIT_RESPONSE)
{
defaultOutputName = opName + "Response";
}
boolean specifiedDefault = outputName.equals(defaultOutputName);
Output output = op.getOutput();
if (output != null)
{
String opOutputName = output.getName();
if (opOutputName == null)
{
if (!specifiedDefault && !outputName.equals(Constants.NONE))
{
op = null;
}
}
else if (!opOutputName.equals(outputName))
{
op = null;
}
}
else
{
op = null;
}
}
if (op != null)
{
if (found)
{
throw new IllegalArgumentException("Duplicate operation with " +
"name=" + name +
(inputName != null
? ", inputName=" + inputName
: "") +
(outputName != null
? ", outputName=" + outputName
: "") +
", found in portType '" +
getQName() + "'.");
}
else
{
found = true;
ret = op;
}
}
} //end while loop
return ret;
}
/**
* Get all the operations defined here.
*/
public List getOperations()
{
return operations;
}
/**
* Remove the specified operation. Note that operation names can
* be overloaded within a PortType. In case of overloading, the
* names of the input and output messages can be used to further
* refine the search.
* getOperation
method.
*
* @param name the name of the desired operation.
* @param inputName the name of the input message; if this is null
* it will be ignored, if this is ":none
" it means search for an input
* message without a name.
* @param outputName the name of the output message; if this is null
* it will be ignored, if this is ":none
" it means search for an output
* message without a name.
* @return the operation which was removed, or null if there wasn't
* any matching operation
*
* @throws IllegalArgumentException if duplicate operations are found.
*
* @see #getOperation(String, String, String)
*/
public Operation removeOperation(String name,
String inputName,
String outputName)
{
Operation op = getOperation(name,inputName,outputName);
if(operations.remove(op))
{
return op;
}
else return null;
}
public void setUndefined(boolean isUndefined)
{
this.isUndefined = isUndefined;
}
public boolean isUndefined()
{
return isUndefined;
}
/**
* Get the list of local attribute names defined for this element in
* the WSDL specification.
*
* @return a List of Strings, one for each local attribute name
*/
public List getNativeAttributeNames()
{
return nativeAttributeNames;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("PortType: name=" + name);
if (operations != null)
{
Iterator opIterator = operations.iterator();
while (opIterator.hasNext())
{
strBuf.append("\n" + opIterator.next());
}
}
String superString = super.toString();
if(!superString.equals(""))
{
strBuf.append("\n");
strBuf.append(superString);
}
return strBuf.toString();
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/Constants.java 0000644 0001750 0001750 00000012457 12111773372 017415 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl;
import javax.xml.namespace.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class Constants
{
// Namespace URIs.
public static final String NS_URI_WSDL =
"http://schemas.xmlsoap.org/wsdl/";
public static final String NS_URI_XMLNS =
"http://www.w3.org/2000/xmlns/";
// Top-level element names.
public static final String ELEM_DEFINITIONS = "definitions";
public static final String ELEM_IMPORT = "import";
public static final String ELEM_TYPES = "types";
public static final String ELEM_MESSAGE = "message";
public static final String ELEM_PORT_TYPE = "portType";
public static final String ELEM_BINDING = "binding";
public static final String ELEM_SERVICE = "service";
// Non top-level element names.
public static final String ELEM_PART = "part";
public static final String ELEM_OPERATION = "operation";
public static final String ELEM_INPUT = "input";
public static final String ELEM_OUTPUT = "output";
public static final String ELEM_FAULT = "fault";
public static final String ELEM_PORT = "port";
public static final String ELEM_DOCUMENTATION = "documentation";
// Top-level qualified element names.
public static final QName Q_ELEM_DEFINITIONS =
new QName(NS_URI_WSDL, ELEM_DEFINITIONS);
public static final QName Q_ELEM_IMPORT =
new QName(NS_URI_WSDL, ELEM_IMPORT);
public static final QName Q_ELEM_TYPES =
new QName(NS_URI_WSDL, ELEM_TYPES);
public static final QName Q_ELEM_MESSAGE =
new QName(NS_URI_WSDL, ELEM_MESSAGE);
public static final QName Q_ELEM_PORT_TYPE =
new QName(NS_URI_WSDL, ELEM_PORT_TYPE);
public static final QName Q_ELEM_BINDING =
new QName(NS_URI_WSDL, ELEM_BINDING);
public static final QName Q_ELEM_SERVICE =
new QName(NS_URI_WSDL, ELEM_SERVICE);
// Non top-level qualified element names.
public static final QName Q_ELEM_PART =
new QName(NS_URI_WSDL, ELEM_PART);
public static final QName Q_ELEM_OPERATION =
new QName(NS_URI_WSDL, ELEM_OPERATION);
public static final QName Q_ELEM_INPUT =
new QName(NS_URI_WSDL, ELEM_INPUT);
public static final QName Q_ELEM_OUTPUT =
new QName(NS_URI_WSDL, ELEM_OUTPUT);
public static final QName Q_ELEM_FAULT =
new QName(NS_URI_WSDL, ELEM_FAULT);
public static final QName Q_ELEM_PORT =
new QName(NS_URI_WSDL, ELEM_PORT);
public static final QName Q_ELEM_DOCUMENTATION =
new QName(NS_URI_WSDL, ELEM_DOCUMENTATION);
// Attribute names.
public static final String ATTR_NAME = "name";
public static final String ATTR_TARGET_NAMESPACE = "targetNamespace";
public static final String ATTR_ELEMENT = "element";
public static final String ATTR_TYPE = "type";
public static final String ATTR_MESSAGE = "message";
public static final String ATTR_PARAMETER_ORDER = "parameterOrder";
public static final String ATTR_BINDING = "binding";
public static final String ATTR_XMLNS = "xmlns";
public static final String ATTR_NAMESPACE = "namespace";
public static final String ATTR_LOCATION = "location";
public static final String ATTR_REQUIRED = "required";
// Lists of native attribute names.
public static final String[] DEFINITION_ATTR_NAMES =
new String[]{ATTR_NAME, ATTR_TARGET_NAMESPACE};
public static final String[] PART_ATTR_NAMES =
new String[]{ATTR_NAME, ATTR_TYPE, ATTR_ELEMENT};
public static final String[] BINDING_ATTR_NAMES =
new String[]{ATTR_NAME, ATTR_TYPE};
public static final String[] BINDING_FAULT_ATTR_NAMES =
new String[]{ATTR_NAME};
public static final String[] BINDING_INPUT_ATTR_NAMES =
new String[]{ATTR_NAME};
public static final String[] BINDING_OPERATION_ATTR_NAMES =
new String[]{ATTR_NAME};
public static final String[] BINDING_OUTPUT_ATTR_NAMES =
new String[]{ATTR_NAME};
public static final String[] FAULT_ATTR_NAMES =
new String[]{ATTR_NAME, ATTR_MESSAGE};
public static final String[] IMPORT_ATTR_NAMES =
new String[]{ATTR_NAMESPACE, ATTR_LOCATION};
public static final String[] INPUT_ATTR_NAMES =
new String[]{ATTR_NAME, ATTR_MESSAGE};
public static final String[] MESSAGE_ATTR_NAMES =
new String[]{ATTR_NAME};
public static final String[] OPERATION_ATTR_NAMES =
new String[]{ATTR_NAME, ATTR_PARAMETER_ORDER};
public static final String[] OUTPUT_ATTR_NAMES =
new String[]{ATTR_NAME, ATTR_MESSAGE};
public static final String[] PORT_ATTR_NAMES =
new String[]{ATTR_NAME, ATTR_BINDING};
public static final String[] PORT_TYPE_ATTR_NAMES =
new String[]{ATTR_NAME};
public static final String[] SERVICE_ATTR_NAMES =
new String[]{ATTR_NAME};
public static final String[] TYPES_ATTR_NAMES =
new String[]{};
// Qualified attribute names.
public static final QName Q_ATTR_REQUIRED =
new QName(NS_URI_WSDL, ATTR_REQUIRED);
// XML Declaration string.
public static final String XML_DECL_DEFAULT = "UTF-8";
public static final String XML_DECL_START =
"";
// Feature names.
public static final String FEATURE_VERBOSE = "javax.wsdl.verbose";
public static final String FEATURE_IMPORT_DOCUMENTS =
"javax.wsdl.importDocuments";
public static final String FEATURE_PARSE_SCHEMA =
"com.ibm.wsdl.parseXMLSchemas";
// Other
public static final String NONE = ":none";
}
wsdl4j-1.6.3/src/com/ibm/wsdl/BindingOperationImpl.java 0000644 0001750 0001750 00000010442 12111773372 021506 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl;
import java.util.*;
import javax.wsdl.*;
/**
* This class represents a WSDL operation binding.
* That is, it holds the information that would be
* specified in the operation element contained within
* a binding element.
*
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class BindingOperationImpl extends AbstractWSDLElement implements BindingOperation
{
protected String name = null;
protected Operation operation = null;
protected BindingInput bindingInput = null;
protected BindingOutput bindingOutput = null;
protected Map bindingFaults = new HashMap();
protected List nativeAttributeNames =
Arrays.asList(Constants.BINDING_OPERATION_ATTR_NAMES);
public static final long serialVersionUID = 1;
/**
* Set the name of this operation binding.
*
* @param name the desired name
*/
public void setName(String name)
{
this.name = name;
}
/**
* Get the name of this operation binding.
*
* @return the operation binding name
*/
public String getName()
{
return name;
}
/**
* Set the operation that this operation binding binds.
*
* @param operation the operation this operation binding binds
*/
public void setOperation(Operation operation)
{
this.operation = operation;
}
/**
* Get the operation that this operation binding binds.
*
* @return the operation that this operation binding binds
*/
public Operation getOperation()
{
return operation;
}
/**
* Set the input binding for this operation binding.
*
* @param bindingInput the new input binding
*/
public void setBindingInput(BindingInput bindingInput)
{
this.bindingInput = bindingInput;
}
/**
* Get the input binding for this operation binding.
*
* @return the input binding
*/
public BindingInput getBindingInput()
{
return bindingInput;
}
/**
* Set the output binding for this operation binding.
*
* @param bindingOutput the new output binding
*/
public void setBindingOutput(BindingOutput bindingOutput)
{
this.bindingOutput = bindingOutput;
}
/**
* Get the output binding for this operation binding.
*
* @return the output binding for the operation binding
*/
public BindingOutput getBindingOutput()
{
return bindingOutput;
}
/**
* Add a fault binding.
*
* @param bindingFault the new fault binding
*/
public void addBindingFault(BindingFault bindingFault)
{
bindingFaults.put(bindingFault.getName(), bindingFault);
}
/**
* Get the specified fault binding.
*
* @param name the name of the desired fault binding.
* @return the corresponding fault binding, or null if there wasn't
* any matching fault binding
*/
public BindingFault getBindingFault(String name)
{
return (BindingFault)bindingFaults.get(name);
}
/**
* Remove the specified fault binding.
*
* @param name the name of the fault binding to be removed.
* @return the fault binding which was removed
*/
public BindingFault removeBindingFault(String name)
{
return (BindingFault)bindingFaults.remove(name);
}
/**
* Get all the fault bindings associated with this operation binding.
*
* @return names of fault bindings
*/
public Map getBindingFaults()
{
return bindingFaults;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("BindingOperation: name=" + name);
if (bindingInput != null)
{
strBuf.append("\n" + bindingInput);
}
if (bindingOutput != null)
{
strBuf.append("\n" + bindingOutput);
}
if (bindingFaults != null)
{
Iterator faultIterator = bindingFaults.values().iterator();
while (faultIterator.hasNext())
{
strBuf.append("\n" + faultIterator.next());
}
}
String superString = super.toString();
if(!superString.equals(""))
{
strBuf.append("\n");
strBuf.append(superString);
}
return strBuf.toString();
}
/**
* Get the list of local attribute names defined for this element in
* the WSDL specification.
*
* @return a List of Strings, one for each local attribute name
*/
public List getNativeAttributeNames()
{
return nativeAttributeNames;
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/ 0000755 0001750 0001750 00000000000 12111773372 016764 5 ustar tony tony wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/http/ 0000755 0001750 0001750 00000000000 12111773372 017743 5 ustar tony tony wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/http/HTTPUrlReplacementImpl.java 0000644 0001750 0001750 00000002731 12111773372 025055 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package com.ibm.wsdl.extensions.http;
import javax.wsdl.extensions.http.*;
import javax.xml.namespace.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class HTTPUrlReplacementImpl implements HTTPUrlReplacement
{
protected QName elementType = HTTPConstants.Q_ELEM_HTTP_URL_REPLACEMENT;
// Uses the wrapper type so we can tell if it was set or not.
protected Boolean required = null;
public static final long serialVersionUID = 1;
/**
* Set the type of this extensibility element.
*
* @param elementType the type
*/
public void setElementType(QName elementType)
{
this.elementType = elementType;
}
/**
* Get the type of this extensibility element.
*
* @return the extensibility element's type
*/
public QName getElementType()
{
return elementType;
}
/**
* Set whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public void setRequired(Boolean required)
{
this.required = required;
}
/**
* Get whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public Boolean getRequired()
{
return required;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("HTTPUrlReplacement (" + elementType + "):");
strBuf.append("\nrequired=" + required);
return strBuf.toString();
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/http/HTTPBindingSerializer.java 0000644 0001750 0001750 00000005223 12111773372 024714 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package com.ibm.wsdl.extensions.http;
import java.io.*;
import org.w3c.dom.*;
import javax.wsdl.*;
import javax.wsdl.extensions.*;
import javax.wsdl.extensions.http.*;
import javax.xml.namespace.*;
import com.ibm.wsdl.*;
import com.ibm.wsdl.util.xml.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class HTTPBindingSerializer implements ExtensionSerializer,
ExtensionDeserializer,
Serializable
{
public static final long serialVersionUID = 1;
public void marshall(Class parentType,
QName elementType,
ExtensibilityElement extension,
PrintWriter pw,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
HTTPBinding httpBinding = (HTTPBinding)extension;
if (httpBinding != null)
{
String tagName =
DOMUtils.getQualifiedValue(HTTPConstants.NS_URI_HTTP,
"binding",
def);
pw.print(" <" + tagName);
DOMUtils.printAttribute(HTTPConstants.ATTR_VERB,
httpBinding.getVerb(),
pw);
Boolean required = httpBinding.getRequired();
if (required != null)
{
DOMUtils.printQualifiedAttribute(Constants.Q_ATTR_REQUIRED,
required.toString(),
def,
pw);
}
pw.println("/>");
}
}
public ExtensibilityElement unmarshall(Class parentType,
QName elementType,
Element el,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
HTTPBinding httpBinding = (HTTPBinding)extReg.createExtension(parentType,
elementType);
String verb = DOMUtils.getAttribute(el, HTTPConstants.ATTR_VERB);
String requiredStr = DOMUtils.getAttributeNS(el,
Constants.NS_URI_WSDL,
Constants.ATTR_REQUIRED);
if (verb != null)
{
httpBinding.setVerb(verb);
}
if (requiredStr != null)
{
httpBinding.setRequired(new Boolean(requiredStr));
}
return httpBinding;
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/http/HTTPBindingImpl.java 0000644 0001750 0001750 00000003455 12111773372 023511 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package com.ibm.wsdl.extensions.http;
import javax.wsdl.extensions.http.*;
import javax.xml.namespace.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class HTTPBindingImpl implements HTTPBinding
{
protected QName elementType = HTTPConstants.Q_ELEM_HTTP_BINDING;
// Uses the wrapper type so we can tell if it was set or not.
protected Boolean required = null;
protected String verb = null;
public static final long serialVersionUID = 1;
/**
* Set the type of this extensibility element.
*
* @param elementType the type
*/
public void setElementType(QName elementType)
{
this.elementType = elementType;
}
/**
* Get the type of this extensibility element.
*
* @return the extensibility element's type
*/
public QName getElementType()
{
return elementType;
}
/**
* Set whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public void setRequired(Boolean required)
{
this.required = required;
}
/**
* Get whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public Boolean getRequired()
{
return required;
}
/**
* Set the verb for this HTTP binding.
*
* @param verb the desired verb
*/
public void setVerb(String verb)
{
this.verb = verb;
}
/**
* Get the verb for this HTTP binding.
*/
public String getVerb()
{
return verb;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("HTTPBinding (" + elementType + "):");
strBuf.append("\nrequired=" + required);
if (verb != null)
{
strBuf.append("\nverb=" + verb);
}
return strBuf.toString();
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/http/HTTPOperationSerializer.java 0000644 0001750 0001750 00000005234 12111773372 025304 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package com.ibm.wsdl.extensions.http;
import java.io.*;
import org.w3c.dom.*;
import javax.wsdl.*;
import javax.wsdl.extensions.*;
import javax.wsdl.extensions.http.*;
import javax.xml.namespace.*;
import com.ibm.wsdl.*;
import com.ibm.wsdl.util.xml.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class HTTPOperationSerializer implements ExtensionSerializer,
ExtensionDeserializer,
Serializable
{
public static final long serialVersionUID = 1;
public void marshall(Class parentType,
QName elementType,
ExtensibilityElement extension,
PrintWriter pw,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
HTTPOperation httpOperation = (HTTPOperation)extension;
if (httpOperation != null)
{
String tagName =
DOMUtils.getQualifiedValue(HTTPConstants.NS_URI_HTTP,
"operation",
def);
pw.print(" <" + tagName);
DOMUtils.printAttribute(Constants.ATTR_LOCATION,
httpOperation.getLocationURI(),
pw);
Boolean required = httpOperation.getRequired();
if (required != null)
{
DOMUtils.printQualifiedAttribute(Constants.Q_ATTR_REQUIRED,
required.toString(),
def,
pw);
}
pw.println("/>");
}
}
public ExtensibilityElement unmarshall(Class parentType,
QName elementType,
Element el,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
HTTPOperation httpOperation =
(HTTPOperation)extReg.createExtension(parentType, elementType);
String locationURI = DOMUtils.getAttribute(el, Constants.ATTR_LOCATION);
String requiredStr = DOMUtils.getAttributeNS(el,
Constants.NS_URI_WSDL,
Constants.ATTR_REQUIRED);
if (locationURI != null)
{
httpOperation.setLocationURI(locationURI);
}
if (requiredStr != null)
{
httpOperation.setRequired(new Boolean(requiredStr));
}
return httpOperation;
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/http/HTTPOperationImpl.java 0000644 0001750 0001750 00000003636 12111773372 024100 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package com.ibm.wsdl.extensions.http;
import javax.wsdl.extensions.http.*;
import javax.xml.namespace.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class HTTPOperationImpl implements HTTPOperation
{
protected QName elementType = HTTPConstants.Q_ELEM_HTTP_OPERATION;
// Uses the wrapper type so we can tell if it was set or not.
protected Boolean required = null;
protected String locationURI = null;
public static final long serialVersionUID = 1;
/**
* Set the type of this extensibility element.
*
* @param elementType the type
*/
public void setElementType(QName elementType)
{
this.elementType = elementType;
}
/**
* Get the type of this extensibility element.
*
* @return the extensibility element's type
*/
public QName getElementType()
{
return elementType;
}
/**
* Set whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public void setRequired(Boolean required)
{
this.required = required;
}
/**
* Get whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public Boolean getRequired()
{
return required;
}
/**
* Set the location URI for this HTTP operation.
*
* @param locationURI the desired location URI
*/
public void setLocationURI(String locationURI)
{
this.locationURI = locationURI;
}
/**
* Get the location URI for this HTTP operation.
*/
public String getLocationURI()
{
return locationURI;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("HTTPOperation (" + elementType + "):");
strBuf.append("\nrequired=" + required);
if (locationURI != null)
{
strBuf.append("\nlocationURI=" + locationURI);
}
return strBuf.toString();
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/http/HTTPConstants.java 0000644 0001750 0001750 00000002204 12111773372 023260 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package com.ibm.wsdl.extensions.http;
import javax.xml.namespace.*;
import com.ibm.wsdl.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class HTTPConstants
{
// Namespace URIs.
public static final String NS_URI_HTTP =
"http://schemas.xmlsoap.org/wsdl/http/";
// Element names.
public static final String ELEM_ADDRESS = "address";
public static final String ELEM_URL_ENCODED = "urlEncoded";
public static final String ELEM_URL_REPLACEMENT = "urlReplacement";
// Qualified element names.
public static final QName Q_ELEM_HTTP_BINDING =
new QName(NS_URI_HTTP, Constants.ELEM_BINDING);
public static final QName Q_ELEM_HTTP_OPERATION =
new QName(NS_URI_HTTP, Constants.ELEM_OPERATION);
public static final QName Q_ELEM_HTTP_ADDRESS =
new QName(NS_URI_HTTP, ELEM_ADDRESS);
public static final QName Q_ELEM_HTTP_URL_ENCODED =
new QName(NS_URI_HTTP, ELEM_URL_ENCODED);
public static final QName Q_ELEM_HTTP_URL_REPLACEMENT =
new QName(NS_URI_HTTP, ELEM_URL_REPLACEMENT);
// Attribute names.
public static final String ATTR_VERB = "verb";
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/http/HTTPUrlReplacementSerializer.java 0000644 0001750 0001750 00000004643 12111773372 026271 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package com.ibm.wsdl.extensions.http;
import java.io.*;
import org.w3c.dom.*;
import javax.wsdl.*;
import javax.wsdl.extensions.*;
import javax.wsdl.extensions.http.*;
import javax.xml.namespace.*;
import com.ibm.wsdl.*;
import com.ibm.wsdl.util.xml.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class HTTPUrlReplacementSerializer implements ExtensionSerializer,
ExtensionDeserializer,
Serializable
{
public static final long serialVersionUID = 1;
public void marshall(Class parentType,
QName elementType,
ExtensibilityElement extension,
PrintWriter pw,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
HTTPUrlReplacement httpUrlReplacement = (HTTPUrlReplacement)extension;
if (httpUrlReplacement != null)
{
String tagName =
DOMUtils.getQualifiedValue(HTTPConstants.NS_URI_HTTP,
"urlReplacement",
def);
pw.print(" <" + tagName);
Boolean required = httpUrlReplacement.getRequired();
if (required != null)
{
DOMUtils.printQualifiedAttribute(Constants.Q_ATTR_REQUIRED,
required.toString(),
def,
pw);
}
pw.println("/>");
}
}
public ExtensibilityElement unmarshall(Class parentType,
QName elementType,
Element el,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
HTTPUrlReplacement httpUrlReplacement =
(HTTPUrlReplacement)extReg.createExtension(parentType, elementType);
String requiredStr = DOMUtils.getAttributeNS(el,
Constants.NS_URI_WSDL,
Constants.ATTR_REQUIRED);
if (requiredStr != null)
{
httpUrlReplacement.setRequired(new Boolean(requiredStr));
}
return httpUrlReplacement;
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/http/HTTPAddressImpl.java 0000644 0001750 0001750 00000003622 12111773372 023520 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package com.ibm.wsdl.extensions.http;
import javax.wsdl.extensions.http.*;
import javax.xml.namespace.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class HTTPAddressImpl implements HTTPAddress
{
protected QName elementType = HTTPConstants.Q_ELEM_HTTP_ADDRESS;
// Uses the wrapper type so we can tell if it was set or not.
protected Boolean required = null;
protected String locationURI = null;
public static final long serialVersionUID = 1;
/**
* Set the type of this extensibility element.
*
* @param elementType the type
*/
public void setElementType(QName elementType)
{
this.elementType = elementType;
}
/**
* Get the type of this extensibility element.
*
* @return the extensibility element's type
*/
public QName getElementType()
{
return elementType;
}
/**
* Set whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public void setRequired(Boolean required)
{
this.required = required;
}
/**
* Get whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public Boolean getRequired()
{
return required;
}
/**
* Set the location URI for this HTTP address.
*
* @param locationURI the desired location URI
*/
public void setLocationURI(String locationURI)
{
this.locationURI = locationURI;
}
/**
* Get the location URI for this HTTP address.
*/
public String getLocationURI()
{
return locationURI;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("HTTPAddress (" + elementType + "):");
strBuf.append("\nrequired=" + required);
if (locationURI != null)
{
strBuf.append("\nlocationURI=" + locationURI);
}
return strBuf.toString();
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/http/HTTPUrlEncodedSerializer.java 0000644 0001750 0001750 00000004553 12111773372 025373 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package com.ibm.wsdl.extensions.http;
import java.io.*;
import org.w3c.dom.*;
import javax.wsdl.*;
import javax.wsdl.extensions.*;
import javax.wsdl.extensions.http.*;
import javax.xml.namespace.*;
import com.ibm.wsdl.*;
import com.ibm.wsdl.util.xml.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class HTTPUrlEncodedSerializer implements ExtensionSerializer,
ExtensionDeserializer,
Serializable
{
public static final long serialVersionUID = 1;
public void marshall(Class parentType,
QName elementType,
ExtensibilityElement extension,
PrintWriter pw,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
HTTPUrlEncoded httpUrlEncoded = (HTTPUrlEncoded)extension;
if (httpUrlEncoded != null)
{
String tagName =
DOMUtils.getQualifiedValue(HTTPConstants.NS_URI_HTTP,
"urlEncoded",
def);
pw.print(" <" + tagName);
Boolean required = httpUrlEncoded.getRequired();
if (required != null)
{
DOMUtils.printQualifiedAttribute(Constants.Q_ATTR_REQUIRED,
required.toString(),
def,
pw);
}
pw.println("/>");
}
}
public ExtensibilityElement unmarshall(Class parentType,
QName elementType,
Element el,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
HTTPUrlEncoded httpUrlEncoded =
(HTTPUrlEncoded)extReg.createExtension(parentType, elementType);
String requiredStr = DOMUtils.getAttributeNS(el,
Constants.NS_URI_WSDL,
Constants.ATTR_REQUIRED);
if (requiredStr != null)
{
httpUrlEncoded.setRequired(new Boolean(requiredStr));
}
return httpUrlEncoded;
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/http/HTTPUrlEncodedImpl.java 0000644 0001750 0001750 00000002711 12111773372 024155 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package com.ibm.wsdl.extensions.http;
import javax.wsdl.extensions.http.*;
import javax.xml.namespace.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class HTTPUrlEncodedImpl implements HTTPUrlEncoded
{
protected QName elementType = HTTPConstants.Q_ELEM_HTTP_URL_ENCODED;
// Uses the wrapper type so we can tell if it was set or not.
protected Boolean required = null;
public static final long serialVersionUID = 1;
/**
* Set the type of this extensibility element.
*
* @param elementType the type
*/
public void setElementType(QName elementType)
{
this.elementType = elementType;
}
/**
* Get the type of this extensibility element.
*
* @return the extensibility element's type
*/
public QName getElementType()
{
return elementType;
}
/**
* Set whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public void setRequired(Boolean required)
{
this.required = required;
}
/**
* Get whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public Boolean getRequired()
{
return required;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("HTTPUrlEncoded (" + elementType + "):");
strBuf.append("\nrequired=" + required);
return strBuf.toString();
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/http/HTTPAddressSerializer.java 0000644 0001750 0001750 00000005270 12111773372 024731 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package com.ibm.wsdl.extensions.http;
import java.io.*;
import org.w3c.dom.*;
import javax.wsdl.*;
import javax.wsdl.extensions.*;
import javax.wsdl.extensions.http.*;
import javax.xml.namespace.*;
import com.ibm.wsdl.*;
import com.ibm.wsdl.util.xml.*;
/**
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class HTTPAddressSerializer implements ExtensionSerializer,
ExtensionDeserializer,
Serializable
{
public static final long serialVersionUID = 1;
public void marshall(Class parentType,
QName elementType,
ExtensibilityElement extension,
PrintWriter pw,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
HTTPAddress httpAddress = (HTTPAddress)extension;
if (httpAddress != null)
{
String tagName =
DOMUtils.getQualifiedValue(HTTPConstants.NS_URI_HTTP,
"address",
def);
pw.print(" <" + tagName);
DOMUtils.printAttribute(Constants.ATTR_LOCATION,
httpAddress.getLocationURI(),
pw);
Boolean required = httpAddress.getRequired();
if (required != null)
{
DOMUtils.printQualifiedAttribute(Constants.Q_ATTR_REQUIRED,
required.toString(),
def,
pw);
}
pw.println("/>");
}
}
public ExtensibilityElement unmarshall(Class parentType,
QName elementType,
Element el,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
HTTPAddress httpAddress = (HTTPAddress)extReg.createExtension(parentType,
elementType);
String locationURI = DOMUtils.getAttribute(el, Constants.ATTR_LOCATION);
String requiredStr = DOMUtils.getAttributeNS(el,
Constants.NS_URI_WSDL,
Constants.ATTR_REQUIRED);
if (locationURI != null)
{
httpAddress.setLocationURI(locationURI);
}
if (requiredStr != null)
{
httpAddress.setRequired(new Boolean(requiredStr));
}
return httpAddress;
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/soap12/ 0000755 0001750 0001750 00000000000 12111773372 020071 5 ustar tony tony wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/soap12/SOAP12FaultImpl.java 0000644 0001750 0001750 00000006023 12111773372 023460 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package com.ibm.wsdl.extensions.soap12;
import javax.wsdl.extensions.soap12.*;
import javax.xml.namespace.*;
/**
* Based on com.ibm.wsdl.extensions.soap.SOAPFaultImpl
*/
public class SOAP12FaultImpl implements SOAP12Fault
{
protected QName elementType = SOAP12Constants.Q_ELEM_SOAP_FAULT;
protected Boolean required = null;
protected String name = null;
protected String use = null;
protected String encodingStyle = null;
protected String namespaceURI = null;
public static final long serialVersionUID = 1;
/**
* Set the type of this extensibility element.
*
* @param elementType the type
*/
public void setElementType(QName elementType)
{
this.elementType = elementType;
}
/**
* Get the type of this extensibility element.
*
* @return the extensibility element's type
*/
public QName getElementType()
{
return elementType;
}
/**
* Set whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public void setRequired(Boolean required)
{
this.required = required;
}
/**
* Get whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public Boolean getRequired()
{
return required;
}
/**
* Set the name for this SOAP fault.
*
* @param name the desired name
*/
public void setName(String name)
{
this.name = name;
}
/**
* Get the name for this SOAP fault.
*/
public String getName()
{
return name;
}
/**
* Set the use for this SOAP fault.
*
* @param use the desired use
*/
public void setUse(String use)
{
this.use = use;
}
/**
* Get the use for this SOAP fault.
*/
public String getUse()
{
return use;
}
/**
* Set the encodingStyle for this SOAP fault.
*
* @param encodingStyle the desired encodingStyle
*/
public void setEncodingStyle(String encodingStyle)
{
this.encodingStyle = encodingStyle;
}
/**
* Get the encodingStyle for this SOAP fault.
*/
public String getEncodingStyle()
{
return encodingStyle;
}
/**
* Set the namespace URI for this SOAP fault.
*
* @param namespaceURI the desired namespace URI
*/
public void setNamespaceURI(String namespaceURI)
{
this.namespaceURI = namespaceURI;
}
/**
* Get the namespace URI for this SOAP fault.
*/
public String getNamespaceURI()
{
return namespaceURI;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("SOAPFault (" + elementType + "):");
strBuf.append("\nrequired=" + required);
if (name != null)
{
strBuf.append("\nname=" + name);
}
if (use != null)
{
strBuf.append("\nuse=" + use);
}
if (encodingStyle != null)
{
strBuf.append("\nencodingStyle=" + encodingStyle);
}
if (namespaceURI != null)
{
strBuf.append("\nnamespaceURI=" + namespaceURI);
}
return strBuf.toString();
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/soap12/SOAP12Constants.java 0000644 0001750 0001750 00000003403 12111773372 023536 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package com.ibm.wsdl.extensions.soap12;
import javax.xml.namespace.*;
import com.ibm.wsdl.*;
/**
* Based on com.ibm.wsdl.extensions.soap.SOAPConstants
*/
public class SOAP12Constants
{
// Namespace URIs.
public static final String NS_URI_SOAP12 =
"http://schemas.xmlsoap.org/wsdl/soap12/";
// Element names.
public static final String ELEM_BODY = "body";
public static final String ELEM_HEADER = "header";
public static final String ELEM_HEADER_FAULT = "headerfault";
public static final String ELEM_ADDRESS = "address";
// Qualified element names.
public static final QName Q_ELEM_SOAP_BINDING =
new QName(NS_URI_SOAP12, Constants.ELEM_BINDING);
public static final QName Q_ELEM_SOAP_BODY =
new QName(NS_URI_SOAP12, ELEM_BODY);
public static final QName Q_ELEM_SOAP_HEADER =
new QName(NS_URI_SOAP12, ELEM_HEADER);
public static final QName Q_ELEM_SOAP_HEADER_FAULT =
new QName(NS_URI_SOAP12, ELEM_HEADER_FAULT);
public static final QName Q_ELEM_SOAP_ADDRESS =
new QName(NS_URI_SOAP12, ELEM_ADDRESS);
public static final QName Q_ELEM_SOAP_OPERATION =
new QName(NS_URI_SOAP12, Constants.ELEM_OPERATION);
public static final QName Q_ELEM_SOAP_FAULT =
new QName(NS_URI_SOAP12, Constants.ELEM_FAULT);
// Attribute names.
public static final String ATTR_TRANSPORT = "transport";
public static final String ATTR_STYLE = "style";
public static final String ATTR_SOAP_ACTION = "soapAction";
public static final String ATTR_SOAP_ACTION_REQUIRED = "soapActionRequired";
public static final String ATTR_PARTS = "parts";
public static final String ATTR_USE = "use";
public static final String ATTR_ENCODING_STYLE = "encodingStyle";
public static final String ATTR_PART = "part";
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/soap12/SOAP12BindingImpl.java 0000644 0001750 0001750 00000004536 12111773372 023766 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package com.ibm.wsdl.extensions.soap12;
import javax.wsdl.extensions.soap12.*;
import javax.xml.namespace.*;
/**
* Copied from com.ibm.wsdl.extensions.soap.SOAPBindingImpl
*/
public class SOAP12BindingImpl implements SOAP12Binding
{
protected QName elementType = SOAP12Constants.Q_ELEM_SOAP_BINDING;
protected Boolean required = null;
protected String style = null;
protected String transportURI = null;
public static final long serialVersionUID = 1;
/**
* Set the type of this extensibility element.
*
* @param elementType the type
*/
public void setElementType(QName elementType)
{
this.elementType = elementType;
}
/**
* Get the type of this extensibility element.
*
* @return the extensibility element's type
*/
public QName getElementType()
{
return elementType;
}
/**
* Set whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public void setRequired(Boolean required)
{
this.required = required;
}
/**
* Get whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public Boolean getRequired()
{
return required;
}
/**
* Set the style for this SOAP binding.
*
* @param style the desired style
*/
public void setStyle(String style)
{
this.style = style;
}
/**
* Get the style for this SOAP binding.
*/
public String getStyle()
{
return style;
}
/**
* Set the SOAP transport URI to be used for communicating
* with this binding.
*
* @param transportURI the URI describing the transport
* to be used
*/
public void setTransportURI(String transportURI)
{
this.transportURI = transportURI;
}
/**
* Get the transport URI to be used with this binding.
*
* @return the transport URI to be used
*/
public String getTransportURI()
{
return transportURI;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("SOAPBinding (" + elementType + "):");
strBuf.append("\nrequired=" + required);
if (transportURI != null)
{
strBuf.append("\ntransportURI=" + transportURI);
}
if (style != null)
{
strBuf.append("\nstyle=" + style);
}
return strBuf.toString();
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/soap12/SOAP12HeaderImpl.java 0000644 0001750 0001750 00000010006 12111773372 023571 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package com.ibm.wsdl.extensions.soap12;
import java.util.*;
import javax.wsdl.extensions.soap12.*;
import javax.xml.namespace.*;
/**
* Based on com.ibm.wsdl.extensions.soap.SOAPHeaderImpl
*/
public class SOAP12HeaderImpl implements SOAP12Header
{
protected QName elementType = SOAP12Constants.Q_ELEM_SOAP_HEADER;
protected Boolean required = null;
protected QName message = null;
protected String part = null;
protected String use = null;
protected String encodingStyle = null;
protected String namespaceURI = null;
protected List soapHeaderFaults = new Vector();
public static final long serialVersionUID = 1;
/**
* Set the type of this extensibility element.
*
* @param elementType the type
*/
public void setElementType(QName elementType)
{
this.elementType = elementType;
}
/**
* Get the type of this extensibility element.
*
* @return the extensibility element's type
*/
public QName getElementType()
{
return elementType;
}
/**
* Set whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public void setRequired(Boolean required)
{
this.required = required;
}
/**
* Get whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public Boolean getRequired()
{
return required;
}
/**
* Set the message for this SOAP header.
*
* @param message the desired message
*/
public void setMessage(QName message)
{
this.message = message;
}
/**
* Get the message for this SOAP header.
*/
public QName getMessage()
{
return message;
}
/**
* Set the part for this SOAP header.
*
* @param part the desired part
*/
public void setPart(String part)
{
this.part = part;
}
/**
* Get the part for this SOAP header.
*/
public String getPart()
{
return part;
}
/**
* Set the use for this SOAP header.
*
* @param use the desired use
*/
public void setUse(String use)
{
this.use = use;
}
/**
* Get the use for this SOAP header.
*/
public String getUse()
{
return use;
}
/**
* Set the encodingStyle for this SOAP header.
*
* @param encodingStyle the desired encodingStyle
*/
public void setEncodingStyle(String encodingStyle)
{
this.encodingStyle = encodingStyle;
}
/**
* Get the encodingStyle for this SOAP header.
*/
public String getEncodingStyle()
{
return encodingStyle;
}
/**
* Set the namespace URI for this SOAP header.
*
* @param namespaceURI the desired namespace URI
*/
public void setNamespaceURI(String namespaceURI)
{
this.namespaceURI = namespaceURI;
}
/**
* Get the namespace URI for this SOAP header.
*/
public String getNamespaceURI()
{
return namespaceURI;
}
public void addSOAP12HeaderFault(SOAP12HeaderFault soap12HeaderFault)
{
soapHeaderFaults.add(soap12HeaderFault);
}
public SOAP12HeaderFault removeSOAP12HeaderFault(SOAP12HeaderFault soap12HeaderFault)
{
if(soapHeaderFaults.remove(soap12HeaderFault))
return soap12HeaderFault;
else
return null;
}
public List getSOAP12HeaderFaults()
{
return soapHeaderFaults;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("SOAPHeader (" + elementType + "):");
strBuf.append("\nrequired=" + required);
if (message != null)
{
strBuf.append("\nmessage=" + message);
}
if (part != null)
{
strBuf.append("\npart=" + part);
}
if (use != null)
{
strBuf.append("\nuse=" + use);
}
if (encodingStyle != null)
{
strBuf.append("\nencodingStyle=" + encodingStyle);
}
if (namespaceURI != null)
{
strBuf.append("\nnamespaceURI=" + namespaceURI);
}
if (soapHeaderFaults != null)
{
strBuf.append("\nsoapHeaderFaults=" + soapHeaderFaults);
}
return strBuf.toString();
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/soap12/SOAP12HeaderSerializer.java 0000644 0001750 0001750 00000021461 12111773372 025010 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package com.ibm.wsdl.extensions.soap12;
import java.io.*;
import java.util.*;
import org.w3c.dom.*;
import javax.wsdl.*;
import javax.wsdl.extensions.*;
import javax.wsdl.extensions.soap12.*;
import javax.xml.namespace.*;
import com.ibm.wsdl.*;
import com.ibm.wsdl.util.xml.*;
/**
* Based on com.ibm.wsdl.extensions.soap.SOAPHeaderSerializer
*/
public class SOAP12HeaderSerializer implements ExtensionSerializer,
ExtensionDeserializer,
Serializable
{
public static final long serialVersionUID = 1;
public void marshall(Class parentType,
QName elementType,
ExtensibilityElement extension,
PrintWriter pw,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
SOAP12Header soapHeader = (SOAP12Header)extension;
if (soapHeader != null)
{
String tagName =
DOMUtils.getQualifiedValue(SOAP12Constants.NS_URI_SOAP12,
"header",
def);
pw.print(" <" + tagName);
DOMUtils.printQualifiedAttribute(Constants.ATTR_MESSAGE,
soapHeader.getMessage(),
def,
pw);
DOMUtils.printAttribute(SOAP12Constants.ATTR_PART,
soapHeader.getPart(),
pw);
DOMUtils.printAttribute(SOAP12Constants.ATTR_USE, soapHeader.getUse(), pw);
DOMUtils.printAttribute(SOAP12Constants.ATTR_ENCODING_STYLE,
soapHeader.getEncodingStyle(),
pw);
DOMUtils.printAttribute(Constants.ATTR_NAMESPACE,
soapHeader.getNamespaceURI(),
pw);
Boolean required = soapHeader.getRequired();
if (required != null)
{
DOMUtils.printQualifiedAttribute(Constants.Q_ATTR_REQUIRED,
required.toString(),
def,
pw);
}
pw.println('>');
printSoapHeaderFaults(soapHeader.getSOAP12HeaderFaults(), def, pw);
pw.println(" " + tagName + '>');
}
}
private static void printSoapHeaderFaults(List soapHeaderFaults,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (soapHeaderFaults != null)
{
String tagName =
DOMUtils.getQualifiedValue(SOAP12Constants.NS_URI_SOAP12,
"headerfault",
def);
Iterator soapHeaderFaultIterator = soapHeaderFaults.iterator();
while (soapHeaderFaultIterator.hasNext())
{
SOAP12HeaderFault soapHeaderFault =
(SOAP12HeaderFault)soapHeaderFaultIterator.next();
if (soapHeaderFault != null)
{
pw.print(" <" + tagName);
DOMUtils.printQualifiedAttribute(Constants.ATTR_MESSAGE,
soapHeaderFault.getMessage(),
def,
pw);
DOMUtils.printAttribute(SOAP12Constants.ATTR_PART,
soapHeaderFault.getPart(),
pw);
DOMUtils.printAttribute(SOAP12Constants.ATTR_USE,
soapHeaderFault.getUse(),
pw);
DOMUtils.printAttribute(SOAP12Constants.ATTR_ENCODING_STYLE,
soapHeaderFault.getEncodingStyle(),
pw);
DOMUtils.printAttribute(Constants.ATTR_NAMESPACE,
soapHeaderFault.getNamespaceURI(),
pw);
Boolean required = soapHeaderFault.getRequired();
if (required != null)
{
DOMUtils.printQualifiedAttribute(Constants.Q_ATTR_REQUIRED,
required.toString(),
def,
pw);
}
pw.println("/>");
}
}
}
}
public ExtensibilityElement unmarshall(Class parentType,
QName elementType,
Element el,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
SOAP12Header soapHeader = (SOAP12Header)extReg.createExtension(parentType,
elementType);
QName message =
DOMUtils.getQualifiedAttributeValue(el,
Constants.ATTR_MESSAGE,
SOAP12Constants.ELEM_HEADER,
false,
def);
String part = DOMUtils.getAttribute(el, SOAP12Constants.ATTR_PART);
String use = DOMUtils.getAttribute(el, SOAP12Constants.ATTR_USE);
String encStyleStr = DOMUtils.getAttribute(el,
SOAP12Constants.ATTR_ENCODING_STYLE);
String namespaceURI = DOMUtils.getAttribute(el, Constants.ATTR_NAMESPACE);
String requiredStr = DOMUtils.getAttributeNS(el,
Constants.NS_URI_WSDL,
Constants.ATTR_REQUIRED);
if (message != null)
{
soapHeader.setMessage(message);
}
if (part != null)
{
soapHeader.setPart(part);
}
if (use != null)
{
soapHeader.setUse(use);
}
if (encStyleStr != null)
{
soapHeader.setEncodingStyle(encStyleStr);
}
if (namespaceURI != null)
{
soapHeader.setNamespaceURI(namespaceURI);
}
if (requiredStr != null)
{
soapHeader.setRequired(new Boolean(requiredStr));
}
Element tempEl = DOMUtils.getFirstChildElement(el);
while (tempEl != null)
{
if (QNameUtils.matches(SOAP12Constants.Q_ELEM_SOAP_HEADER_FAULT, tempEl))
{
soapHeader.addSOAP12HeaderFault(
parseSoapHeaderFault(SOAP12Header.class,
SOAP12Constants.Q_ELEM_SOAP_HEADER_FAULT,
tempEl,
extReg,
def));
}
else
{
DOMUtils.throwWSDLException(tempEl);
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
return soapHeader;
}
private static SOAP12HeaderFault parseSoapHeaderFault(Class parentType,
QName elementType,
Element el,
ExtensionRegistry extReg,
Definition def)
throws WSDLException
{
SOAP12HeaderFault soapHeaderFault =
(SOAP12HeaderFault)extReg.createExtension(parentType, elementType);
QName message =
DOMUtils.getQualifiedAttributeValue(el,
Constants.ATTR_MESSAGE,
SOAP12Constants.ELEM_HEADER,
false,
def);
String part = DOMUtils.getAttribute(el, SOAP12Constants.ATTR_PART);
String use = DOMUtils.getAttribute(el, SOAP12Constants.ATTR_USE);
String encStyleStr = DOMUtils.getAttribute(el,
SOAP12Constants.ATTR_ENCODING_STYLE);
String namespaceURI = DOMUtils.getAttribute(el, Constants.ATTR_NAMESPACE);
String requiredStr = DOMUtils.getAttributeNS(el,
Constants.NS_URI_WSDL,
Constants.ATTR_REQUIRED);
if (message != null)
{
soapHeaderFault.setMessage(message);
}
if (part != null)
{
soapHeaderFault.setPart(part);
}
if (use != null)
{
soapHeaderFault.setUse(use);
}
if (encStyleStr != null)
{
soapHeaderFault.setEncodingStyle(encStyleStr);
}
if (namespaceURI != null)
{
soapHeaderFault.setNamespaceURI(namespaceURI);
}
if (requiredStr != null)
{
soapHeaderFault.setRequired(new Boolean(requiredStr));
}
return soapHeaderFault;
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/soap12/SOAP12AddressImpl.java 0000644 0001750 0001750 00000003637 12111773372 024002 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package com.ibm.wsdl.extensions.soap12;
import javax.wsdl.extensions.soap12.*;
import javax.xml.namespace.*;
/**
* Copied from com.ibm.wsdl.extensions.soap.SOAPAddressImpl
*/
public class SOAP12AddressImpl implements SOAP12Address
{
protected QName elementType = SOAP12Constants.Q_ELEM_SOAP_ADDRESS;
// Uses the wrapper type so we can tell if it was set or not.
protected Boolean required = null;
protected String locationURI = null;
public static final long serialVersionUID = 1;
/**
* Set the type of this extensibility element.
*
* @param elementType the type
*/
public void setElementType(QName elementType)
{
this.elementType = elementType;
}
/**
* Get the type of this extensibility element.
*
* @return the extensibility element's type
*/
public QName getElementType()
{
return elementType;
}
/**
* Set whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public void setRequired(Boolean required)
{
this.required = required;
}
/**
* Get whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public Boolean getRequired()
{
return required;
}
/**
* Set the location URI for this SOAP address.
*
* @param locationURI the desired location URI
*/
public void setLocationURI(String locationURI)
{
this.locationURI = locationURI;
}
/**
* Get the location URI for this SOAP address.
*/
public String getLocationURI()
{
return locationURI;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("SOAPAddress (" + elementType + "):");
strBuf.append("\nrequired=" + required);
if (locationURI != null)
{
strBuf.append("\nlocationURI=" + locationURI);
}
return strBuf.toString();
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/soap12/SOAP12BodyImpl.java 0000644 0001750 0001750 00000006042 12111773372 023303 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package com.ibm.wsdl.extensions.soap12;
import java.util.*;
import javax.wsdl.extensions.soap12.*;
import javax.xml.namespace.*;
/**
* Based on com.ibm.wsdl.extensions.soap.SOAPBodyImpl
*/
public class SOAP12BodyImpl implements SOAP12Body
{
protected QName elementType = SOAP12Constants.Q_ELEM_SOAP_BODY;
protected Boolean required = null;
protected List parts = null;
protected String use = null;
protected String encodingStyle = null;
protected String namespaceURI = null;
public static final long serialVersionUID = 1;
/**
* Set the type of this extensibility element.
*
* @param elementType the type
*/
public void setElementType(QName elementType)
{
this.elementType = elementType;
}
/**
* Get the type of this extensibility element.
*
* @return the extensibility element's type
*/
public QName getElementType()
{
return elementType;
}
/**
* Set whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public void setRequired(Boolean required)
{
this.required = required;
}
/**
* Get whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public Boolean getRequired()
{
return required;
}
/**
* Set the parts for this SOAP body.
*
* @param parts the desired parts
*/
public void setParts(List parts)
{
this.parts = parts;
}
/**
* Get the parts for this SOAP body.
*/
public List getParts()
{
return parts;
}
/**
* Set the use for this SOAP body.
*
* @param use the desired use
*/
public void setUse(String use)
{
this.use = use;
}
/**
* Get the use for this SOAP body.
*/
public String getUse()
{
return use;
}
/**
* Set the encodingStyle for this SOAP body.
*
* @param encodingStyle the desired encodingStyle
*/
public void setEncodingStyle(String encodingStyle)
{
this.encodingStyle = encodingStyle;
}
/**
* Get the encodingStyle for this SOAP body.
*/
public String getEncodingStyle()
{
return encodingStyle;
}
/**
* Set the namespace URI for this SOAP body.
*
* @param namespaceURI the desired namespace URI
*/
public void setNamespaceURI(String namespaceURI)
{
this.namespaceURI = namespaceURI;
}
/**
* Get the namespace URI for this SOAP body.
*/
public String getNamespaceURI()
{
return namespaceURI;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("SOAPBody (" + elementType + "):");
strBuf.append("\nrequired=" + required);
if (parts != null)
{
strBuf.append("\nparts=" + parts);
}
if (use != null)
{
strBuf.append("\nuse=" + use);
}
if (encodingStyle != null)
{
strBuf.append("\nencodingStyle=" + encodingStyle);
}
if (namespaceURI != null)
{
strBuf.append("\nnamespaceURI=" + namespaceURI);
}
return strBuf.toString();
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/soap12/SOAP12BindingSerializer.java 0000644 0001750 0001750 00000006072 12111773372 025173 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package com.ibm.wsdl.extensions.soap12;
import java.io.*;
import org.w3c.dom.*;
import javax.wsdl.*;
import javax.wsdl.extensions.*;
import javax.wsdl.extensions.soap12.*;
import javax.xml.namespace.*;
import com.ibm.wsdl.*;
import com.ibm.wsdl.util.xml.*;
/**
* Copied from com.ibm.wsdl.extensions.soap.SOAPBindingSerializer
*/
public class SOAP12BindingSerializer implements ExtensionSerializer,
ExtensionDeserializer,
Serializable
{
public static final long serialVersionUID = 1;
public void marshall(Class parentType,
QName elementType,
ExtensibilityElement extension,
PrintWriter pw,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
SOAP12Binding soapBinding = (SOAP12Binding)extension;
if (soapBinding != null)
{
String tagName =
DOMUtils.getQualifiedValue(SOAP12Constants.NS_URI_SOAP12,
"binding",
def);
pw.print(" <" + tagName);
DOMUtils.printAttribute(SOAP12Constants.ATTR_STYLE,
soapBinding.getStyle(),
pw);
DOMUtils.printAttribute(SOAP12Constants.ATTR_TRANSPORT,
soapBinding.getTransportURI(),
pw);
Boolean required = soapBinding.getRequired();
if (required != null)
{
DOMUtils.printQualifiedAttribute(Constants.Q_ATTR_REQUIRED,
required.toString(),
def,
pw);
}
pw.println("/>");
}
}
public ExtensibilityElement unmarshall(Class parentType,
QName elementType,
Element el,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
SOAP12Binding soapBinding = (SOAP12Binding)extReg.createExtension(parentType,
elementType);
String transportURI = DOMUtils.getAttribute(el,
SOAP12Constants.ATTR_TRANSPORT);
String style = DOMUtils.getAttribute(el, SOAP12Constants.ATTR_STYLE);
String requiredStr = DOMUtils.getAttributeNS(el,
Constants.NS_URI_WSDL,
Constants.ATTR_REQUIRED);
if (transportURI != null)
{
soapBinding.setTransportURI(transportURI);
}
if (style != null)
{
soapBinding.setStyle(style);
}
if (requiredStr != null)
{
soapBinding.setRequired(new Boolean(requiredStr));
}
return soapBinding;
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/soap12/SOAP12OperationSerializer.java 0000644 0001750 0001750 00000007366 12111773372 025570 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package com.ibm.wsdl.extensions.soap12;
import java.io.*;
import org.w3c.dom.*;
import javax.wsdl.*;
import javax.wsdl.extensions.*;
import javax.wsdl.extensions.soap12.*;
import javax.xml.namespace.*;
import com.ibm.wsdl.*;
import com.ibm.wsdl.util.xml.*;
/**
* Based on com.ibm.wsdl.extensions.soap.SOAPOperationSerializer
*/
public class SOAP12OperationSerializer implements ExtensionSerializer,
ExtensionDeserializer,
Serializable
{
public static final long serialVersionUID = 1;
public void marshall(Class parentType,
QName elementType,
ExtensibilityElement extension,
PrintWriter pw,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
SOAP12Operation soapOperation = (SOAP12Operation)extension;
if (soapOperation != null)
{
String tagName =
DOMUtils.getQualifiedValue(SOAP12Constants.NS_URI_SOAP12,
"operation",
def);
pw.print(" <" + tagName);
Boolean soapActionRequired = soapOperation.getSoapActionRequired();
String soapActionRequiredString =
soapActionRequired == null ? null : soapActionRequired.toString();
DOMUtils.printAttribute(SOAP12Constants.ATTR_SOAP_ACTION,
soapOperation.getSoapActionURI(),
pw);
DOMUtils.printAttribute(SOAP12Constants.ATTR_SOAP_ACTION_REQUIRED,
soapActionRequiredString,
pw);
DOMUtils.printAttribute(SOAP12Constants.ATTR_STYLE,
soapOperation.getStyle(),
pw);
Boolean required = soapOperation.getRequired();
if (required != null)
{
DOMUtils.printQualifiedAttribute(Constants.Q_ATTR_REQUIRED,
required.toString(),
def,
pw);
}
pw.println("/>");
}
}
public ExtensibilityElement unmarshall(Class parentType,
QName elementType,
Element el,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
SOAP12Operation soapOperation =
(SOAP12Operation)extReg.createExtension(parentType, elementType);
String soapActionURI = DOMUtils.getAttribute(el,
SOAP12Constants.ATTR_SOAP_ACTION);
String soapActionRequiredString = DOMUtils.getAttribute(el,
SOAP12Constants.ATTR_SOAP_ACTION_REQUIRED);
String style = DOMUtils.getAttribute(el, SOAP12Constants.ATTR_STYLE);
String requiredStr = DOMUtils.getAttributeNS(el,
Constants.NS_URI_WSDL,
Constants.ATTR_REQUIRED);
if (soapActionURI != null)
{
soapOperation.setSoapActionURI(soapActionURI);
}
if(soapActionRequiredString != null)
{
Boolean soapActionRequired = new Boolean(soapActionRequiredString);
soapOperation.setSoapActionRequired(soapActionRequired);
}
if (style != null)
{
soapOperation.setStyle(style);
}
if (requiredStr != null)
{
soapOperation.setRequired(new Boolean(requiredStr));
}
return soapOperation;
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/soap12/SOAP12HeaderFaultImpl.java 0000644 0001750 0001750 00000007015 12111773372 024573 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package com.ibm.wsdl.extensions.soap12;
import javax.wsdl.extensions.soap12.*;
import javax.xml.namespace.*;
/**
* Based on com.ibm.wsdl.extensions.soap.SOAPHeaderFaultImpl
*/
public class SOAP12HeaderFaultImpl implements SOAP12HeaderFault
{
protected QName elementType = SOAP12Constants.Q_ELEM_SOAP_HEADER_FAULT;
protected Boolean required = null;
protected QName message = null;
protected String part = null;
protected String use = null;
protected String encodingStyle = null;
protected String namespaceURI = null;
public static final long serialVersionUID = 1;
/**
* Set the type of this extensibility element.
*
* @param elementType the type
*/
public void setElementType(QName elementType)
{
this.elementType = elementType;
}
/**
* Get the type of this extensibility element.
*
* @return the extensibility element's type
*/
public QName getElementType()
{
return elementType;
}
/**
* Set whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public void setRequired(Boolean required)
{
this.required = required;
}
/**
* Get whether or not the semantics of this extension
* are required. Relates to the wsdl:required attribute.
*/
public Boolean getRequired()
{
return required;
}
/**
* Set the message for this SOAP header fault.
*
* @param message the desired message
*/
public void setMessage(QName message)
{
this.message = message;
}
/**
* Get the message for this SOAP header fault.
*/
public QName getMessage()
{
return message;
}
/**
* Set the part for this SOAP header fault.
*
* @param part the desired part
*/
public void setPart(String part)
{
this.part = part;
}
/**
* Get the part for this SOAP header fault.
*/
public String getPart()
{
return part;
}
/**
* Set the use for this SOAP header fault.
*
* @param use the desired use
*/
public void setUse(String use)
{
this.use = use;
}
/**
* Get the use for this SOAP header fault.
*/
public String getUse()
{
return use;
}
/**
* Set the encodingStyle for this SOAP header fault.
*
* @param encodingStyle the desired encodingStyle
*/
public void setEncodingStyle(String encodingStyle)
{
this.encodingStyle = encodingStyle;
}
/**
* Get the encodingStyle for this SOAP header fault.
*/
public String getEncodingStyle()
{
return encodingStyle;
}
/**
* Set the namespace URI for this SOAP header fault.
*
* @param namespaceURI the desired namespace URI
*/
public void setNamespaceURI(String namespaceURI)
{
this.namespaceURI = namespaceURI;
}
/**
* Get the namespace URI for this SOAP header fault.
*/
public String getNamespaceURI()
{
return namespaceURI;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("SOAPHeaderFault (" + elementType + "):");
strBuf.append("\nrequired=" + required);
if (message != null)
{
strBuf.append("\nmessage=" + message);
}
if (part != null)
{
strBuf.append("\npart=" + part);
}
if (use != null)
{
strBuf.append("\nuse=" + use);
}
if (encodingStyle != null)
{
strBuf.append("\nencodingStyles=" + encodingStyle);
}
if (namespaceURI != null)
{
strBuf.append("\nnamespaceURI=" + namespaceURI);
}
return strBuf.toString();
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/soap12/SOAP12AddressSerializer.java 0000644 0001750 0001750 00000005323 12111773372 025204 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package com.ibm.wsdl.extensions.soap12;
import java.io.*;
import org.w3c.dom.*;
import javax.wsdl.*;
import javax.wsdl.extensions.*;
import javax.wsdl.extensions.soap12.*;
import javax.xml.namespace.*;
import com.ibm.wsdl.*;
import com.ibm.wsdl.util.xml.*;
/**
* Copied from com.ibm.wsdl.extensions.soap.SOAPAddressSerializer
*/
public class SOAP12AddressSerializer implements ExtensionSerializer,
ExtensionDeserializer,
Serializable
{
public static final long serialVersionUID = 1;
public void marshall(Class parentType,
QName elementType,
ExtensibilityElement extension,
PrintWriter pw,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
SOAP12Address soapAddress = (SOAP12Address)extension;
if (soapAddress != null)
{
String tagName =
DOMUtils.getQualifiedValue(SOAP12Constants.NS_URI_SOAP12,
"address",
def);
pw.print(" <" + tagName);
DOMUtils.printAttribute(Constants.ATTR_LOCATION,
soapAddress.getLocationURI(),
pw);
Boolean required = soapAddress.getRequired();
if (required != null)
{
DOMUtils.printQualifiedAttribute(Constants.Q_ATTR_REQUIRED,
required.toString(),
def,
pw);
}
pw.println("/>");
}
}
public ExtensibilityElement unmarshall(Class parentType,
QName elementType,
Element el,
Definition def,
ExtensionRegistry extReg)
throws WSDLException
{
SOAP12Address soapAddress = (SOAP12Address)extReg.createExtension(parentType,
elementType);
String locationURI = DOMUtils.getAttribute(el, Constants.ATTR_LOCATION);
String requiredStr = DOMUtils.getAttributeNS(el,
Constants.NS_URI_WSDL,
Constants.ATTR_REQUIRED);
if (locationURI != null)
{
soapAddress.setLocationURI(locationURI);
}
if (requiredStr != null)
{
soapAddress.setRequired(new Boolean(requiredStr));
}
return soapAddress;
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/extensions/soap12/SOAP12BodySerializer.java 0000644 0001750 0001750 00000007620 12111773372 024516 0 ustar tony tony /*
* (c) Copyright IBM Corp 2006
*/
package com.ibm.wsdl.extensions.soap12;
import java.io.*;
import org.w3c.dom.*;
import javax.wsdl.*;
import javax.wsdl.extensions.*;
// MIMEPart.class is needed so <schema>
elements into
* Schema instances.
*
* @see SchemaImpl
* @see SchemaSerializer
*
* @author Jeremy Hughes <schema>
element.
*
* @see SchemaSerializer
* @see SchemaDeserializer
*
* @author Jeremy Hughes DOM Level 2
APIs.
* The main difference between this class and DOMWriter is that this class
* generates and prints out namespace declarations.
*
* @author Matthew J. Duftler (duftler@us.ibm.com)
* @author Joseph Kesselman
*/
public class DOM2Writer
{
/**
* The namespaceURI represented by the prefix xmlns
.
*/
private static String NS_URI_XMLNS = "http://www.w3.org/2000/xmlns/";
/**
* The namespaceURI represented by the prefix xml
.
*/
private static String NS_URI_XML = "http://www.w3.org/XML/1998/namespace";
private static Map xmlEncodingMap = new HashMap();
static
{
xmlEncodingMap.put(null, Constants.XML_DECL_DEFAULT);
xmlEncodingMap.put(System.getProperty("file.encoding"),
Constants.XML_DECL_DEFAULT);
xmlEncodingMap.put("UTF8", "UTF-8");
xmlEncodingMap.put("UTF-16", "UTF-16");
xmlEncodingMap.put("UnicodeBig", "UTF-16");
xmlEncodingMap.put("UnicodeLittle", "UTF-16");
xmlEncodingMap.put("ASCII", "US-ASCII");
xmlEncodingMap.put("ISO8859_1", "ISO-8859-1");
xmlEncodingMap.put("ISO8859_2", "ISO-8859-2");
xmlEncodingMap.put("ISO8859_3", "ISO-8859-3");
xmlEncodingMap.put("ISO8859_4", "ISO-8859-4");
xmlEncodingMap.put("ISO8859_5", "ISO-8859-5");
xmlEncodingMap.put("ISO8859_6", "ISO-8859-6");
xmlEncodingMap.put("ISO8859_7", "ISO-8859-7");
xmlEncodingMap.put("ISO8859_8", "ISO-8859-8");
xmlEncodingMap.put("ISO8859_9", "ISO-8859-9");
xmlEncodingMap.put("ISO8859_13", "ISO-8859-13");
xmlEncodingMap.put("ISO8859_15_FDIS", "ISO-8859-15");
xmlEncodingMap.put("GBK", "GBK");
xmlEncodingMap.put("Big5", "Big5");
}
/**
* Return a string containing this node serialized as XML.
*/
public static String nodeToString(Node node)
{
return nodeToString(node, new HashMap());
}
/**
* Return a string containing this node serialized as XML.
* The specified Map associates prefixes with namespace URLs.
*/
public static String nodeToString(Node node, Map namespaces)
{
StringWriter sw = new StringWriter();
serializeAsXML(node, namespaces, sw);
return sw.toString();
}
/**
* Print an XML declaration before serializing the element.
*/
public static void serializeElementAsDocument(Element el, Writer writer)
{
serializeElementAsDocument(el, new HashMap(), writer);
}
/**
* Print an XML declaration before serializing the element.
* The specified Map associates prefixes with namespace URLs.
*/
public static void serializeElementAsDocument(Element el, Map namespaces, Writer writer)
{
PrintWriter pw = new PrintWriter(writer);
String javaEncoding = (writer instanceof OutputStreamWriter)
? ((OutputStreamWriter) writer).getEncoding()
: null;
String xmlEncoding = java2XMLEncoding(javaEncoding);
if (xmlEncoding != null)
{
pw.println(Constants.XML_DECL_START +
xmlEncoding +
Constants.XML_DECL_END);
}
else
{
pw.println("");
}
serializeAsXML(el, namespaces, writer);
}
/**
* Serialize this node into the writer as XML.
*/
public static void serializeAsXML(Node node, Writer writer)
{
serializeAsXML(node, new HashMap(), writer);
}
/**
* Serialize this node into the writer as XML.
* The specified Map associates prefixes with namespace URLs.
*/
public static void serializeAsXML(Node node, Map namespaces, Writer writer)
{
ObjectRegistry namespaceStack = new ObjectRegistry(namespaces);
namespaceStack.register("xml", NS_URI_XML);
PrintWriter pw = new PrintWriter(writer);
String javaEncoding = (writer instanceof OutputStreamWriter)
? ((OutputStreamWriter) writer).getEncoding()
: null;
print(node, namespaceStack, pw, java2XMLEncoding(javaEncoding));
}
private static void print(Node node, ObjectRegistry namespaceStack,
PrintWriter out, String xmlEncoding)
{
if (node == null)
{
return;
}
boolean hasChildren = false;
int type = node.getNodeType();
switch (type)
{
case Node.DOCUMENT_NODE :
{
if (xmlEncoding != null)
{
out.println(Constants.XML_DECL_START +
xmlEncoding +
Constants.XML_DECL_END);
}
else
{
out.println("");
}
Node child = node.getFirstChild();
while (child != null)
{
print(child,namespaceStack, out, xmlEncoding);
child = child.getNextSibling();
}
break;
}
case Node.ELEMENT_NODE :
{
namespaceStack = new ObjectRegistry(namespaceStack);
out.print('<' + node.getNodeName());
String elPrefix = node.getPrefix();
String elNamespaceURI = node.getNamespaceURI();
if (elPrefix != null && elNamespaceURI != null)
{
boolean prefixIsDeclared = false;
try
{
String namespaceURI = (String)namespaceStack.lookup(elPrefix);
if (elNamespaceURI.equals(namespaceURI))
{
prefixIsDeclared = true;
}
}
catch (IllegalArgumentException e)
{
// ignore this and carry on
}
if (!prefixIsDeclared)
{
printNamespaceDecl(node, namespaceStack, out);
}
}
NamedNodeMap attrs = node.getAttributes();
int len = (attrs != null) ? attrs.getLength() : 0;
for (int i = 0; i < len; i++)
{
Attr attr = (Attr)attrs.item(i);
out.print(' ' + attr.getNodeName() +"=\"" +
normalize(attr.getValue()) + '\"');
String attrPrefix = attr.getPrefix();
String attrNamespaceURI = attr.getNamespaceURI();
if (attrPrefix != null && attrNamespaceURI != null)
{
boolean prefixIsDeclared = false;
try
{
String namespaceURI = (String)namespaceStack.lookup(attrPrefix);
if (attrNamespaceURI.equals(namespaceURI))
{
prefixIsDeclared = true;
}
}
catch (IllegalArgumentException e)
{
// ignore this and carry on
}
if (!prefixIsDeclared)
{
printNamespaceDecl(attr, namespaceStack, out);
}
}
}
Node child = node.getFirstChild();
if (child != null)
{
hasChildren = true;
out.print('>');
while (child != null)
{
print(child, namespaceStack, out, xmlEncoding);
child = child.getNextSibling();
}
}
else
{
hasChildren = false;
out.print("/>");
}
break;
}
case Node.ENTITY_REFERENCE_NODE :
{
out.print('&');
out.print(node.getNodeName());
out.print(';');
break;
}
case Node.CDATA_SECTION_NODE :
{
out.print("");
break;
}
case Node.TEXT_NODE :
{
out.print(normalize(node.getNodeValue()));
break;
}
case Node.COMMENT_NODE :
{
out.print("");
break;
}
case Node.PROCESSING_INSTRUCTION_NODE :
{
out.print("");
out.print(node.getNodeName());
String data = node.getNodeValue();
if (data != null && data.length() > 0)
{
out.print(' ');
out.print(data);
}
out.println("?>");
break;
}
}
if (type == Node.ELEMENT_NODE && hasChildren == true)
{
out.print("");
out.print(node.getNodeName());
out.print('>');
hasChildren = false;
}
}
public static String java2XMLEncoding(String javaEnc)
{
return (String)xmlEncodingMap.get(javaEnc);
}
private static void printNamespaceDecl(Node node,
ObjectRegistry namespaceStack,
PrintWriter out)
{
switch (node.getNodeType())
{
case Node.ATTRIBUTE_NODE :
{
printNamespaceDecl(((Attr)node).getOwnerElement(), node,
namespaceStack, out);
break;
}
case Node.ELEMENT_NODE :
{
printNamespaceDecl((Element)node, node, namespaceStack, out);
break;
}
}
}
private static void printNamespaceDecl(Element owner, Node node,
ObjectRegistry namespaceStack,
PrintWriter out)
{
String namespaceURI = node.getNamespaceURI();
String prefix = node.getPrefix();
if (!(namespaceURI.equals(NS_URI_XMLNS) && prefix.equals("xmlns")))
{
if (DOMUtils.getAttributeNS(owner, NS_URI_XMLNS, prefix) == null)
{
out.print(" xmlns:" + prefix + "=\"" + namespaceURI + '\"');
}
}
else
{
prefix = node.getLocalName();
namespaceURI = node.getNodeValue();
}
namespaceStack.register(prefix, namespaceURI);
}
private static String normalize(String s)
{
StringBuffer str = new StringBuffer();
int len = (s != null) ? s.length() : 0;
for (int i = 0; i < len; i++)
{
char ch = s.charAt(i);
switch (ch)
{
case '<' :
{
str.append("<");
break;
}
case '>' :
{
str.append(">");
break;
}
case '&' :
{
str.append("&");
break;
}
case '"' :
{
str.append(""");
break;
}
case '\n' :
{
if (i > 0)
{
char lastChar = str.charAt(str.length() - 1);
if (lastChar != '\r')
{
str.append(StringUtils.lineSeparator);
}
else
{
str.append('\n');
}
}
else
{
str.append(StringUtils.lineSeparator);
}
break;
}
default :
{
str.append(ch);
}
}
}
return (str.toString());
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/util/xml/DOMUtils.java 0000644 0001750 0001750 00000044565 12111773372 020663 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl.util.xml;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.List;
import java.util.Vector;
import javax.wsdl.Definition;
import javax.wsdl.WSDLException;
import javax.xml.namespace.QName;
import org.w3c.dom.Attr;
import org.w3c.dom.CharacterData;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
public class DOMUtils {
/**
* The namespaceURI represented by the prefix xmlns
.
*/
private static String NS_URI_XMLNS = "http://www.w3.org/2000/xmlns/";
private static final String ATTR_XMLNS = "xmlns";
/**
* Returns a list of attributes of an element. Returns an
* empty list if the element has no attributes. Does not
* include namespace declarations.
*
* @param el Element whose attributes are returned
* @return the List of Attr
*/
static public List getAttributes (Element el) {
String nodename, prefix = null;
List attrs = new Vector();
NamedNodeMap attrMap = el.getAttributes();
for(int i = 0; i < attrMap.getLength(); i++)
{
nodename = attrMap.item(i).getNodeName();
prefix = attrMap.item(i).getPrefix();
if (ATTR_XMLNS.equals(nodename) || ATTR_XMLNS.equals(prefix))
{
//ignore namespace declarations
continue;
}
else
{
attrs.add(attrMap.item(i));
}
}
return attrs;
}
/**
* Returns the value of an attribute of an element. Returns null
* if the attribute is not found (whereas Element.getAttribute
* returns "" if an attrib is not found). This method should be
* used for elements that support extension attributes because it
* does not track unexpected attributes.
*
* @param el Element whose attrib is looked for
* @param attrName name of attribute to look for
* @return the attribute value
*/
static public String getAttribute (Element el, String attrName) {
String sRet = null;
Attr attr = el.getAttributeNode(attrName);
if (attr != null) {
sRet = attr.getValue();
}
return sRet;
}
/**
* Returns the value of an attribute of an element. Returns null
* if the attribute is not found (whereas Element.getAttribute
* returns "" if an attrib is not found). This method should be
* used for elements that do not support extension attributes
* because it tracks the element's remaining attributes so that
* eventually any unexpected attributes can be identified.
*
* @param el Element whose attrib is looked for
* @param attrName name of attribute to look for
* @param remainingAttrs List of remaining attributes
* @return the attribute value
*/
static public String getAttribute (Element el, String attrName, List remainingAttrs) {
String sRet = null;
Attr attr = el.getAttributeNode(attrName);
if (attr != null) {
sRet = attr.getValue();
remainingAttrs.remove(attr);
}
return sRet;
}
/**
* Returns the value of an attribute of an element. Returns null
* if the attribute is not found (whereas Element.getAttributeNS
* returns "" if an attrib is not found).
*
* @param el Element whose attrib is looked for
* @param namespaceURI namespace URI of attribute to look for
* @param localPart local part of attribute to look for
* @return the attribute value
*/
static public String getAttributeNS (Element el,
String namespaceURI,
String localPart) {
String sRet = null;
Attr attr = el.getAttributeNodeNS (namespaceURI, localPart);
if (attr != null) {
sRet = attr.getValue ();
}
return sRet;
}
/**
* Concat all the text and cdata node children of this elem and return
* the resulting text.
*
* @param parentEl the element whose cdata/text node values are to
* be combined.
* @return the concatanated string.
*/
static public String getChildCharacterData (Element parentEl) {
if (parentEl == null) {
return null;
}
Node tempNode = parentEl.getFirstChild();
StringBuffer strBuf = new StringBuffer();
CharacterData charData;
while (tempNode != null) {
switch (tempNode.getNodeType()) {
case Node.TEXT_NODE :
case Node.CDATA_SECTION_NODE : charData = (CharacterData)tempNode;
strBuf.append(charData.getData());
break;
}
tempNode = tempNode.getNextSibling();
}
return strBuf.toString();
}
/**
* Return the first child element of the given element. Null if no
* children are found.
*
* @param elem Element whose child is to be returned
* @return the first child element.
*/
public static Element getFirstChildElement (Element elem) {
for (Node n = elem.getFirstChild (); n != null; n = n.getNextSibling ()) {
if (n.getNodeType () == Node.ELEMENT_NODE) {
return (Element) n;
}
}
return null;
}
/**
* Return the next sibling element of the given element. Null if no
* more sibling elements are found.
*
* @param elem Element whose sibling element is to be returned
* @return the next sibling element.
*/
public static Element getNextSiblingElement (Element elem) {
for (Node n = elem.getNextSibling (); n != null; n = n.getNextSibling ()) {
if (n.getNodeType () == Node.ELEMENT_NODE) {
return (Element) n;
}
}
return null;
}
/**
* Return the first child element of the given element which has the
* given attribute with the given value.
*
* @param elem the element whose children are to be searched
* @param attrName the attrib that must be present
* @param attrValue the desired value of the attribute
*
* @return the first matching child element.
*/
public static Element findChildElementWithAttribute (Element elem,
String attrName,
String attrValue) {
for (Node n = elem.getFirstChild (); n != null; n = n.getNextSibling ()) {
if (n.getNodeType () == Node.ELEMENT_NODE) {
if (attrValue.equals (DOMUtils.getAttribute ((Element) n, attrName))) {
return (Element) n;
}
}
}
return null;
}
/**
* Count number of children of a certain type of the given element.
*
* @param elem the element whose kids are to be counted
*
* @return the number of matching kids.
*/
public static int countKids (Element elem, short nodeType) {
int nkids = 0;
for (Node n = elem.getFirstChild (); n != null; n = n.getNextSibling ()) {
if (n.getNodeType () == nodeType) {
nkids++;
}
}
return nkids;
}
/**
* Given a prefix and a node, return the namespace URI that the prefix
* has been associated with. This method is useful in resolving the
* namespace URI of attribute values which are being interpreted as
* QNames. If prefix is null, this method will return the default
* namespace.
*
* @param context the starting node (looks up recursively from here)
* @param prefix the prefix to find an xmlns:prefix=uri for
*
* @return the namespace URI or null if not found
*/
public static String getNamespaceURIFromPrefix (Node context,
String prefix) {
short nodeType = context.getNodeType ();
Node tempNode = null;
switch (nodeType)
{
case Node.ATTRIBUTE_NODE :
{
tempNode = ((Attr) context).getOwnerElement ();
break;
}
case Node.ELEMENT_NODE :
{
tempNode = context;
break;
}
default :
{
tempNode = context.getParentNode ();
break;
}
}
while (tempNode != null && tempNode.getNodeType () == Node.ELEMENT_NODE)
{
Element tempEl = (Element) tempNode;
String namespaceURI = (prefix == null)
? getAttribute (tempEl, "xmlns")
: getAttributeNS (tempEl, NS_URI_XMLNS, prefix);
if (namespaceURI != null)
{
return namespaceURI;
}
else
{
tempNode = tempEl.getParentNode ();
}
}
return null;
}
public static QName getQName(String prefixedValue,
Element contextEl,
Definition def)
throws WSDLException
{
int index = prefixedValue.indexOf(':');
String prefix = (index != -1)
? prefixedValue.substring(0, index)
: null;
String localPart = prefixedValue.substring(index + 1);
String namespaceURI = getNamespaceURIFromPrefix(contextEl, prefix);
if (namespaceURI != null)
{
registerUniquePrefix(prefix, namespaceURI, def);
return new QName(namespaceURI, localPart);
}
else
{
String faultCode = (prefix == null)
? WSDLException.NO_PREFIX_SPECIFIED
: WSDLException.UNBOUND_PREFIX;
WSDLException wsdlExc = new WSDLException(faultCode,
"Unable to determine " +
"namespace of '" +
prefixedValue + "'.");
wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(contextEl));
throw wsdlExc;
}
}
public static void registerUniquePrefix(String prefix,
String namespaceURI,
Definition def)
{
String tempNSUri = def.getNamespace(prefix);
//Check if the prefix and namespace are already registered.
if (tempNSUri != null && tempNSUri.equals(namespaceURI))
{
return;
}
/* Check if the namespace is already registered with some other prefix,
* in which case do not register it again with this prefix. The existing
* prefix/namespace association will suffice (i.e. semantically equivalent).
*/
Collection nSpaces = def.getNamespaces().values();
if(nSpaces.contains(namespaceURI))
{
return;
}
while (tempNSUri != null && !tempNSUri.equals(namespaceURI))
{
prefix = (prefix != null ? prefix + "_" : "_");
tempNSUri = def.getNamespace(prefix);
}
def.addNamespace(prefix, namespaceURI);
}
/**
* This method should be used for elements that support extension attributes
* because it does not track the remaining attributes to test for unexpected
* attributes.
*/
public static QName getQualifiedAttributeValue(Element el,
String attrName,
String elDesc,
boolean isRequired,
Definition def)
throws WSDLException
{
String attrValue = DOMUtils.getAttribute(el, attrName);
if (attrValue != null)
{
return getQName(attrValue, el, def);
}
else if (isRequired)
{
WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL,
"The '" + attrName +
"' attribute must be " +
"specified for every " +
elDesc + " element.");
wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el));
throw wsdlExc;
}
else
{
return null;
}
}
/**
* This method should be used for elements that do not support extension attributes
* because it tracks the remaining attributes so that eventually any
* unexpected attributes can be identified.
*/
public static QName getQualifiedAttributeValue(Element el,
String attrName,
String elDesc,
boolean isRequired,
Definition def,
List remainingAttrs)
throws WSDLException
{
String attrValue = null;
attrValue = DOMUtils.getAttribute(el, attrName, remainingAttrs);
if (attrValue != null)
{
return getQName(attrValue, el, def);
}
else if (isRequired)
{
WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL,
"The '" + attrName +
"' attribute must be " +
"specified for every " +
elDesc + " element.");
wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el));
throw wsdlExc;
}
else
{
return null;
}
}
public static void throwWSDLException(Element location) throws WSDLException
{
String elName = QNameUtils.newQName(location).toString();
WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL,
"Encountered unexpected element '" +
elName + "'.");
wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(location));
throw wsdlExc;
}
public static void printAttribute(String name,
String value,
PrintWriter pw)
{
if (value != null)
{
pw.print(' ' + name + "=\"" + cleanString(value) + '\"');
}
}
/**
* Prints attributes with qualified names.
*/
public static void printQualifiedAttribute(QName name,
String value,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (name != null)
{
printAttribute(getQualifiedValue(name.getNamespaceURI(),
name.getLocalPart(),
def),
value,
pw);
}
}
public static void printQualifiedAttribute(QName name,
QName value,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (value != null)
{
printAttribute(getQualifiedValue(name.getNamespaceURI(),
name.getLocalPart(),
def),
getQualifiedValue(value.getNamespaceURI(),
value.getLocalPart(),
def),
pw);
}
}
public static void printQualifiedAttribute(String name,
QName value,
Definition def,
PrintWriter pw)
throws WSDLException
{
if (value != null)
{
printAttribute(name,
getQualifiedValue(value.getNamespaceURI(),
value.getLocalPart(),
def),
pw);
}
}
public static String getQualifiedValue(String namespaceURI,
String localPart,
Definition def)
throws WSDLException
{
String prefix = null;
if (namespaceURI != null && !namespaceURI.equals(""))
{
prefix = getPrefix(namespaceURI, def);
}
return ((prefix != null && !prefix.equals(""))
? prefix + ":"
: "") + localPart;
}
public static String getPrefix(String namespaceURI,
Definition def)
throws WSDLException
{
String prefix = def.getPrefix(namespaceURI);
if (prefix == null)
{
throw new WSDLException(WSDLException.OTHER_ERROR,
"Can't find prefix for '" + namespaceURI +
"'. Namespace prefixes must be set on the" +
" Definition object using the " +
"addNamespace(...) method.");
}
return prefix;
}
public static String cleanString(String orig)
{
if (orig == null)
{
return "";
}
StringBuffer strBuf = new StringBuffer();
char[] chars = orig.toCharArray();
boolean inCDATA = false;
for (int i = 0; i < chars.length; i++)
{
if (!inCDATA)
{
switch (chars[i])
{
case '&' : strBuf.append("&");
break;
case '\"' : strBuf.append(""");
break;
case '\'' : strBuf.append("'");
break;
case '<' :
{
if (chars.length >= i + 9)
{
String tempStr = new String(chars, i, 9);
if (tempStr.equals("' : strBuf.append(">");
break;
default : strBuf.append(chars[i]);
break;
}
}
else
{
strBuf.append(chars[i]);
if (chars[i] == '>'
&& chars[i - 1] == ']'
&& chars[i - 2] == ']')
{
inCDATA = false;
}
}
}
return strBuf.toString();
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/util/xml/QNameUtils.java 0000644 0001750 0001750 00000000754 12111773372 021235 0 ustar tony tony /*
* (c) Copyright IBM Corp 2002, 2005
*/
package com.ibm.wsdl.util.xml;
import javax.xml.namespace.*;
import org.w3c.dom.*;
public class QNameUtils
{
public static boolean matches(QName qname, Node node)
{
return (node != null && qname.equals(newQName(node)));
}
public static QName newQName(Node node)
{
if (node != null)
{
return new QName(node.getNamespaceURI(), node.getLocalName());
}
else
{
return new QName(null, null);
}
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/util/xml/XPathUtils.java 0000644 0001750 0001750 00000011053 12111773372 021252 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2005
*/
package com.ibm.wsdl.util.xml;
import java.util.Vector;
import org.w3c.dom.*;
/**
* A XPathUtils
...
*
* @author Matthew J. Duftler (duftler@us.ibm.com)
* @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
*/
public class XPathUtils
{
private static Node getPreviousTypedNode(Node node, short nodeType)
{
node = node.getPreviousSibling();
while (node != null && node.getNodeType() != nodeType)
{
node = node.getPreviousSibling();
}
return node;
}
private static Node getNextTypedNode(Node node, short nodeType)
{
node = node.getNextSibling();
while (node != null && node.getNodeType() != nodeType)
{
node = node.getNextSibling();
}
return node;
}
private static String getValue(Node node, short nodeType)
{
switch (nodeType)
{
case Node.ELEMENT_NODE :
return ((Element)node).getTagName();
case Node.TEXT_NODE :
return ((Text)node).getData();
case Node.PROCESSING_INSTRUCTION_NODE :
return ((ProcessingInstruction)node).getData();
default :
return "";
}
}
private static short getNodeType(Node node)
{
return (node != null ? node.getNodeType() : -1);
}
private static String getXPathFromVector(Vector path)
{
StringBuffer strBuf = new StringBuffer();
int length = path.size();
for (int i = 0; i < length; i++)
{
Node tempNode = (Node)path.elementAt(i);
short nodeType = getNodeType(tempNode);
String targetValue = getValue(tempNode, nodeType);
int position = 1;
tempNode = getPreviousTypedNode(tempNode, nodeType);
while (tempNode != null)
{
if (nodeType == Node.ELEMENT_NODE)
{
if (getValue(tempNode, nodeType).equals(targetValue))
{
position++;
}
}
else
{
position++;
}
tempNode = getPreviousTypedNode(tempNode, nodeType);
}
boolean hasMatchingSiblings = (position > 1);
if (!hasMatchingSiblings)
{
tempNode = (Node)path.elementAt(i);
tempNode = getNextTypedNode(tempNode, nodeType);
while (!hasMatchingSiblings && tempNode != null)
{
if (nodeType == Node.ELEMENT_NODE)
{
if (getValue(tempNode, nodeType).equals(targetValue))
{
hasMatchingSiblings = true;
}
else
{
tempNode = getNextTypedNode(tempNode, nodeType);
}
}
else
{
hasMatchingSiblings = true;
}
}
}
String step;
switch (nodeType)
{
case Node.TEXT_NODE :
step = "text()";
break;
case Node.PROCESSING_INSTRUCTION_NODE :
step = "processing-instruction()";
break;
default :
step = targetValue;
break;
}
if (step != null && step.length() > 0)
{
strBuf.append('/' + step);
}
if (hasMatchingSiblings)
{
strBuf.append("[" + position + "]");
}
}
return strBuf.toString();
}
private static Vector getVectorPathFromNode(Node node)
{
Vector path = new Vector();
while (node != null)
{
path.insertElementAt(node, 0);
node = node.getParentNode();
}
return path;
}
/**
* Generates an XPath expression that will return only the given node as its
* result. This method only works for element, text, document and PI nodes.
*
* @param node the node to generate an XPath expression for. This node must
* be an element node, a text node, a document node, or a processing
* instruction node.
* @return an XPath expression that will return only the given node as its
* result.
* @exception IllegalArgumentException if the given node is not an element,
* text, document or PI node.
*/
public static String getXPathExprFromNode(Node node)
throws IllegalArgumentException
{
short nodeType = getNodeType(node);
switch (nodeType)
{
case Node.ELEMENT_NODE :
case Node.TEXT_NODE :
case Node.PROCESSING_INSTRUCTION_NODE :
return getXPathFromVector(getVectorPathFromNode(node));
case Node.DOCUMENT_NODE :
return "/";
default :
throw new IllegalArgumentException("Only works for element, text, " +
"document, and PI nodes.");
}
}
} wsdl4j-1.6.3/src/com/ibm/wsdl/OperationImpl.java 0000644 0001750 0001750 00000011760 12111773372 020217 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl;
import java.util.*;
import javax.wsdl.*;
/**
* This class represents a WSDL operation.
* It includes information on input, output and fault
* messages associated with usage of the operation.
*
* @author Paul Fremantle (pzf@us.ibm.com)
* @author Nirmal Mukhi (nmukhi@us.ibm.com)
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class OperationImpl extends AbstractWSDLElement implements Operation
{
protected String name = null;
protected Input input = null;
protected Output output = null;
protected Map faults = new HashMap();
protected OperationType style = null;
protected List parameterOrder = null;
protected List nativeAttributeNames =
Arrays.asList(Constants.OPERATION_ATTR_NAMES);
protected boolean isUndefined = true;
public static final long serialVersionUID = 1;
/**
* Set the name of this operation.
*
* @param name the desired name
*/
public void setName(String name)
{
this.name = name;
}
/**
* Get the name of this operation.
*
* @return the operation name
*/
public String getName()
{
return name;
}
/**
* Set the input message specification for this operation.
*
* @param input the new input message
*/
public void setInput(Input input)
{
this.input = input;
}
/**
* Get the input message specification for this operation.
*
* @return the input message
*/
public Input getInput()
{
return input;
}
/**
* Set the output message specification for this operation.
*
* @param output the new output message
*/
public void setOutput(Output output)
{
this.output = output;
}
/**
* Get the output message specification for this operation.
*
* @return the output message specification for the operation
*/
public Output getOutput()
{
return output;
}
/**
* Add a fault message that must be associated with this
* operation.
*
* @param fault the new fault message
*/
public void addFault(Fault fault)
{
faults.put(fault.getName(), fault);
}
/**
* Get the specified fault message.
*
* @param name the name of the desired fault message.
* @return the corresponding fault message, or null if there wasn't
* any matching message
*/
public Fault getFault(String name)
{
return (Fault)faults.get(name);
}
/**
* Remove the specified fault message.
*
* @param name the name of the fault message to be removed
* @return the fault message which was removed.
*/
public Fault removeFault(String name)
{
return (Fault)faults.remove(name);
}
/**
* Get all the fault messages associated with this operation.
*
* @return names of fault messages
*/
public Map getFaults()
{
return faults;
}
/**
* Set the style for this operation (request-response,
* one way, solicit-response or notification).
*
* @param style the new operation style
*/
public void setStyle(OperationType style)
{
this.style = style;
}
/**
* Get the operation type.
*
* @return the operation type
*/
public OperationType getStyle()
{
return style;
}
/**
* Set the parameter ordering for a request-response,
* or solicit-response operation.
*
* @param parameterOrder a list of named parameters
* containing the part names to reflect the desired
* order of parameters for RPC-style operations
*/
public void setParameterOrdering(List parameterOrder)
{
this.parameterOrder = parameterOrder;
}
/**
* Get the parameter ordering for this operation.
*
* @return the parameter ordering, a list consisting
* of message part names
*/
public List getParameterOrdering()
{
return parameterOrder;
}
public void setUndefined(boolean isUndefined)
{
this.isUndefined = isUndefined;
}
public boolean isUndefined()
{
return isUndefined;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("Operation: name=" + name);
if (parameterOrder != null)
{
strBuf.append("\nparameterOrder=" + parameterOrder);
}
if (style != null)
{
strBuf.append("\nstyle=" + style);
}
if (input != null)
{
strBuf.append("\n" + input);
}
if (output != null)
{
strBuf.append("\n" + output);
}
if (faults != null)
{
Iterator faultIterator = faults.values().iterator();
while (faultIterator.hasNext())
{
strBuf.append("\n" + faultIterator.next());
}
}
String superString = super.toString();
if(!superString.equals(""))
{
strBuf.append("\n");
strBuf.append(superString);
}
return strBuf.toString();
}
/**
* Get the list of local attribute names defined for this element in
* the WSDL specification.
*
* @return a List of Strings, one for each local attribute name
*/
public List getNativeAttributeNames()
{
return nativeAttributeNames;
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/OutputImpl.java 0000644 0001750 0001750 00000003136 12111773372 017555 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl;
import java.util.*;
import javax.wsdl.*;
/**
* This class represents an output message, and contains the name
* of the output and the message itself.
*
* @author Matthew J. Duftler
*/
public class OutputImpl extends AbstractWSDLElement implements Output
{
protected String name = null;
protected Message message = null;
protected List nativeAttributeNames =
Arrays.asList(Constants.OUTPUT_ATTR_NAMES);
public static final long serialVersionUID = 1;
/**
* Set the name of this output message.
*
* @param name the desired name
*/
public void setName(String name)
{
this.name = name;
}
/**
* Get the name of this output message.
*
* @return the output message name
*/
public String getName()
{
return name;
}
public void setMessage(Message message)
{
this.message = message;
}
public Message getMessage()
{
return message;
}
/**
* Get the list of local attribute names defined for this element in
* the WSDL specification.
*
* @return a List of Strings, one for each local attribute name
*/
public List getNativeAttributeNames()
{
return nativeAttributeNames;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("Output: name=" + name);
if (message != null)
{
strBuf.append("\n" + message);
}
String superString = super.toString();
if(!superString.equals(""))
{
strBuf.append("\n");
strBuf.append(superString);
}
return strBuf.toString();
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/BindingFaultImpl.java 0000644 0001750 0001750 00000002771 12111773372 020627 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl;
import java.util.*;
import javax.wsdl.*;
/**
* This class represents a fault binding. That is, it contains
* the information that would be specified in an fault element
* contained within an operation element contained within a
* binding element.
*
* @author Matthew J. Duftler
*/
public class BindingFaultImpl extends AbstractWSDLElement implements BindingFault
{
protected String name = null;
protected List nativeAttributeNames =
Arrays.asList(Constants.BINDING_FAULT_ATTR_NAMES);
public static final long serialVersionUID = 1;
/**
* Set the name of this fault binding.
*
* @param name the desired name
*/
public void setName(String name)
{
this.name = name;
}
/**
* Get the name of this fault binding.
*
* @return the fault binding name
*/
public String getName()
{
return name;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("BindingFault: name=");
strBuf.append(name);
String superString = super.toString();
if(!superString.equals(""))
{
strBuf.append("\n");
strBuf.append(superString);
}
return strBuf.toString();
}
/**
* Get the list of local attribute names defined for this element in
* the WSDL specification.
*
* @return a List of Strings, one for each local attribute name
*/
public List getNativeAttributeNames()
{
return nativeAttributeNames;
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/BindingOutputImpl.java 0000644 0001750 0001750 00000002753 12111773372 021054 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl;
import java.util.*;
import javax.wsdl.*;
/**
* This class represents an output binding. That is, it contains
* the information that would be specified in an output element
* contained within an operation element contained within a
* binding element.
*
* @author Matthew J. Duftler
*/
public class BindingOutputImpl extends AbstractWSDLElement implements BindingOutput
{
protected String name = null;
protected List nativeAttributeNames =
Arrays.asList(Constants.BINDING_OUTPUT_ATTR_NAMES);
public static final long serialVersionUID = 1;
/**
* Set the name of this output binding.
*
* @param name the desired name
*/
public void setName(String name)
{
this.name = name;
}
/**
* Get the name of this output binding.
*
* @return the output binding name
*/
public String getName()
{
return name;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("BindingOutput: name=" + name);
String superString = super.toString();
if(!superString.equals(""))
{
strBuf.append("\n");
strBuf.append(superString);
}
return strBuf.toString();
}
/**
* Get the list of local attribute names defined for this element in
* the WSDL specification.
*
* @return a List of Strings, one for each local attribute name
*/
public List getNativeAttributeNames()
{
return nativeAttributeNames;
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/xml/ 0000755 0001750 0001750 00000000000 12111773372 015365 5 ustar tony tony wsdl4j-1.6.3/src/com/ibm/wsdl/xml/WSDLReaderImpl.java 0000644 0001750 0001750 00000222202 12111773372 020746 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl.xml;
import java.io.*;
import java.net.*;
import java.util.*;
import javax.xml.namespace.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import javax.wsdl.*;
import javax.wsdl.extensions.*;
import javax.wsdl.factory.*;
import javax.wsdl.xml.*;
import com.ibm.wsdl.*;
import com.ibm.wsdl.util.*;
import com.ibm.wsdl.util.xml.*;
import javax.wsdl.extensions.schema.Schema;
import javax.wsdl.extensions.schema.SchemaReference;
import com.ibm.wsdl.extensions.schema.SchemaConstants;
/**
* This class describes a collection of methods
* that enable conversion of a WSDL document (in XML,
* following the WSDL schema described in the WSDL
* specification) into a WSDL model.
*
* @author Matthew J. Duftler
* @author Nirmal Mukhi
*/
public class WSDLReaderImpl implements WSDLReader
{
// Used for determining the style of operations.
private static final List STYLE_ONE_WAY =
Arrays.asList(new String[]{Constants.ELEM_INPUT});
private static final List STYLE_REQUEST_RESPONSE =
Arrays.asList(new String[]{Constants.ELEM_INPUT, Constants.ELEM_OUTPUT});
private static final List STYLE_SOLICIT_RESPONSE =
Arrays.asList(new String[]{Constants.ELEM_OUTPUT, Constants.ELEM_INPUT});
private static final List STYLE_NOTIFICATION =
Arrays.asList(new String[]{Constants.ELEM_OUTPUT});
protected boolean verbose = true;
protected boolean importDocuments = true;
protected boolean parseSchema = true;
protected ExtensionRegistry extReg = null;
protected String factoryImplName = null;
protected WSDLLocator loc = null;
protected WSDLFactory factory = null;
//Contains all schemas used by this wsdl, either in-line or nested
//via wsdl imports or schema imports, includes or redefines
protected Map allSchemas = new Hashtable();
/**
* Sets the specified feature to the specified value.
*
*
*
*
* Name
* Description
* Default Value
*
*
*
* If set to true, status messages will be displayed.
*
*
*
*
* If set to true, imported WSDL documents will be
* retrieved and processed.
*
*
*
*
* If set to true, the schema documents inlined and import directly
* or indrectly will be retrieved as javax.wsdl.extensions.schema.Schema
* objects and referred to in the Definition. This is the default (only)
* behaviour from JWSDL 1.2. Which is why the default for this feature is true.
* However, prior to JWSDL 1.2 the only behaviour was not to parse the schema
* files. Setting this feature to false will prevent the schemas being parsed.
*
*
*
Usage:
* java com.ibm.wsdl.xml.WSDLWriterImpl filename|URL
* This test driver simply reads a WSDL document into a model
* (using a WSDLReader), and then serializes it back to
* standard out. In effect, it performs a round-trip test on
* the specified WSDL document.
*/
public static void main(String[] argv) throws WSDLException
{
if (argv.length == 1)
{
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
wsdlWriter.writeWSDL(wsdlReader.readWSDL(null, argv[0]), System.out);
}
else
{
System.err.println("Usage:");
System.err.println();
System.err.println(" java " + WSDLWriterImpl.class.getName() +
" filename|URL");
System.err.println();
System.err.println("This test driver simply reads a WSDL document " +
"into a model (using a WSDLReader), and then " +
"serializes it back to standard out. In effect, " +
"it performs a round-trip test on the specified " +
"WSDL document.");
}
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/PartImpl.java 0000644 0001750 0001750 00000003716 12111773372 017167 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl;
import java.util.*;
import javax.wsdl.*;
import javax.xml.namespace.*;
/**
* This class represents a message part and contains the part's
* name, elementName, typeName, and any extensibility attributes.
*
* @author Paul Fremantle
* @author Nirmal Mukhi
* @author Matthew J. Duftler
*/
public class PartImpl extends AbstractWSDLElement implements Part
{
protected String name = null;
protected QName elementName = null;
protected QName typeName = null;
protected List nativeAttributeNames =
Arrays.asList(Constants.PART_ATTR_NAMES);
public static final long serialVersionUID = 1;
/**
* Set the name of this part.
*
* @param name the desired name
*/
public void setName(String name)
{
this.name = name;
}
/**
* Get the name of this part.
*
* @return the part name
*/
public String getName()
{
return name;
}
public void setElementName(QName elementName)
{
this.elementName = elementName;
}
public QName getElementName()
{
return elementName;
}
public void setTypeName(QName typeName)
{
this.typeName = typeName;
}
public QName getTypeName()
{
return typeName;
}
/**
* Get the list of local attribute names defined for this element in
* the WSDL specification.
*
* @return a List of Strings, one for each local attribute name
*/
public List getNativeAttributeNames()
{
return nativeAttributeNames;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("Part: name=" + name);
if (elementName != null)
{
strBuf.append("\nelementName=" + elementName);
}
if (typeName != null)
{
strBuf.append("\ntypeName=" + typeName);
}
String superString = super.toString();
if(!superString.equals(""))
{
strBuf.append("\n");
strBuf.append(superString);
}
return strBuf.toString();
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/ImportImpl.java 0000644 0001750 0001750 00000005552 12111773372 017533 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl;
import java.util.*;
import javax.wsdl.*;
/**
* This class represents an import, and may contain a reference
* to the imported definition.
*
* @author Matthew J. Duftler (duftler@us.ibm.com)
*/
public class ImportImpl extends AbstractWSDLElement implements Import
{
protected String namespaceURI = null;
protected String locationURI = null;
/*
This would need to be made into a generic reference to handle other
types of referenced documents.
*/
protected Definition definition = null;
protected List nativeAttributeNames =
Arrays.asList(Constants.IMPORT_ATTR_NAMES);
public static final long serialVersionUID = 1;
public void setNamespaceURI(String namespaceURI)
{
this.namespaceURI = namespaceURI;
}
public String getNamespaceURI()
{
return namespaceURI;
}
public void setLocationURI(String locationURI)
{
this.locationURI = locationURI;
}
public String getLocationURI()
{
return locationURI;
}
/**
* This property can be used to hang a referenced Definition,
* and the top-level Definition (i.e. the one with the <import>)
* will use this Definition when resolving referenced WSDL parts.
* This would need to be made into a generic reference to handle
* other types of referenced documents.
*/
public void setDefinition(Definition definition)
{
this.definition = definition;
}
/**
* This property can be used to hang a referenced Definition,
* and the top-level Definition (i.e. the one with the <import>)
* will use this Definition when resolving referenced WSDL parts.
* This would need to be made into a generic reference to handle
* other types of referenced documents.
*/
public Definition getDefinition()
{
return definition;
}
/**
* Get the list of local attribute names defined for this element in
* the WSDL specification.
*
* @return a List of Strings, one for each local attribute name
*/
public List getNativeAttributeNames()
{
return nativeAttributeNames;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("Import:");
if (namespaceURI != null)
{
strBuf.append("\nnamespaceURI=" + namespaceURI);
}
if (locationURI != null)
{
strBuf.append("\nlocationURI=" + locationURI);
}
if (definition != null)
{
//only printing out the defintion URI and TNS to avoid infinite loop
//if there are circular imports
strBuf.append("\ndefinition=" + definition.getDocumentBaseURI());
strBuf.append("\ndefinition namespaceURI=" + definition.getTargetNamespace());
}
String superString = super.toString();
if(!superString.equals(""))
{
strBuf.append("\n");
strBuf.append(superString);
}
return strBuf.toString();
}
}
wsdl4j-1.6.3/src/com/ibm/wsdl/ServiceImpl.java 0000644 0001750 0001750 00000004567 12111773372 017666 0 ustar tony tony /*
* (c) Copyright IBM Corp 2001, 2006
*/
package com.ibm.wsdl;
import java.util.*;
import javax.wsdl.*;
import javax.xml.namespace.*;
/**
* This class represents a service, which groups related
* ports to provide some functionality.
*
* @author Paul Fremantle
* @author Nirmal Mukhi
* @author Matthew J. Duftler
*/
public class ServiceImpl extends AbstractWSDLElement implements Service
{
protected QName name = null;
protected Map ports = new HashMap();
protected List nativeAttributeNames =
Arrays.asList(Constants.SERVICE_ATTR_NAMES);
public static final long serialVersionUID = 1;
/**
* Set the name of this service.
*
* @param name the desired name
*/
public void setQName(QName name)
{
this.name = name;
}
/**
* Get the name of this service.
*
* @return the service name
*/
public QName getQName()
{
return name;
}
/**
* Add a port to this service.
*
* @param port the port to be added
*/
public void addPort(Port port)
{
ports.put(port.getName(), port);
}
/**
* Get the specified port.
*
* @param name the name of the desired port.
* @return the corresponding port, or null if there wasn't
* any matching port
*/
public Port getPort(String name)
{
return (Port)ports.get(name);
}
/**
* Remove the specified port.
*
* @param name the name of the port to be removed.
* @return the port which was removed
*/
public Port removePort(String name)
{
return (Port)ports.remove(name);
}
/**
* Get all the ports defined here.
*/
public Map getPorts()
{
return ports;
}
public String toString()
{
StringBuffer strBuf = new StringBuffer();
strBuf.append("Service: name=" + name);
if (ports != null)
{
Iterator portIterator = ports.values().iterator();
while (portIterator.hasNext())
{
strBuf.append("\n" + portIterator.next());
}
}
String superString = super.toString();
if(!superString.equals(""))
{
strBuf.append("\n");
strBuf.append(superString);
}
return strBuf.toString();
}
/**
* Get the list of local attribute names defined for this element in
* the WSDL specification.
*
* @return a List of Strings, one for each local attribute name
*/
public List getNativeAttributeNames()
{
return nativeAttributeNames;
}
}