Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.muse.ws.wsdl
Class WsdlUtils

    java.lang.Object
      org.apache.muse.ws.wsdl.WsdlUtils

public class WsdlUtils
extends java.lang.Object

WsdlUtils is a collection of utility methods related to WSDL 1.1.

Author:
  Dan Jemiolo (danj)

Field Summary
`static QName` | `ADDRESS_QNAME`
`static QName` | `BINDING_QNAME`
`static java.lang.String` | `DEFAULT_SERVICE_NAME`
`static QName` | `DEFINITIONS_QNAME`
`static QName` | `IMPORT_QNAME`
`static QName` | `INPUT_QNAME`
`static java.lang.String` | `LOCATION`
`static QName` | `MESSAGE_QNAME`
`static java.lang.String` | `NAME`
`static java.lang.String` | `NAMESPACE_URI` The WSDL 1.1 namespace URI.
`static QName` | `OPERATION_QNAME`
`static QName` | `OUTPUT_QNAME`
`static QName` | `PORT_QNAME`
`static QName` | `PORT_TYPE_QNAME`
`static java.lang.String` | `PREFIX`
`static QName` | `SERVICE_QNAME`
`static java.lang.String` | `SERVICES`
`static java.lang.String` | `SOAP_PREFIX`
`static java.lang.String` | `SOAP_URI` The "WSDL-SOAP" namespace used for SOAP bindings.
`static QName` | `TYPES_QNAME`
`static java.lang.String` | `WSDL4J_VERBOSE_FLAG`

Constructor Summary
`WsdlUtils()`

Method Summary
`static org.w3c.dom.Document` | `addSchemaImports(org.w3c.dom.Document wsdl, java.lang.String wsdlPath, Environment environment, java.util.Set namespaces)` This is a convenience method that resolves all of the schema imports referenced in a WSDL.
`static org.w3c.dom.Document` | `addSchemaIncludes(org.w3c.dom.Document wsdl, java.lang.String wsdlPath, Environment environment, java.util.Set namespaces)` This is a convenience method that resolves all of the schema includes referenced in a WSDL.
`static Definition` | `createDefinition(org.w3c.dom.Document wsdlDoc, java.io.File wsdlDir)`
`static org.w3c.dom.Document` | `createWSDL(Environment environment, java.lang.String wsdlPath, boolean resolveReferences)` Loads the WSDL at the given path, resolving any imports if desired.
`static java.lang.String` | `getAction(Operation op)`
`static org.w3c.dom.Element` | `getComplexTypeDeclaration(org.w3c.dom.Node wsdl, QName qname)` Searches a WSDL document's types section for a complex type defined with the given name.
`static org.w3c.dom.Element` | `getElementDeclaration(org.w3c.dom.Node wsdl, QName qname)` Searches a WSDL document's types section for a type defined with the given name.
`static org.w3c.dom.Element` | `getFirstPortType(org.w3c.dom.Node wsdl)` Returns the first portType (in document order) that's found in a given WSDL or null if the WSDL contains no portTypes.
`static QName` | `getInputPartName(Operation op)`
`static QName` | `getOutputPartName(Operation op, org.w3c.dom.Document wsdlDoc)` This method is somewhat painful because of the lack of restrictions that WSDL 1.1 has for how you can specify input and output names and types.
`static org.w3c.dom.Element` | `getPortType(org.w3c.dom.Node wsdl, QName qname)` Searches a WSDL document for a portType defined with the given name.
`static java.util.Set` | `getSchemaNamespaces(org.w3c.dom.Document wsdl)` Gathers the target namespaces for each schema in the WSDL's types section.
`static java.lang.String` | `getServiceName(org.w3c.dom.Element wsdlDefinition)` Given a WSDL document try to get the address and parse out the name of the service.
`static java.util.Collection` | `getWsdlImports(org.w3c.dom.Document wsdl, java.lang.String wsdlPath, Environment environment)` Creates the WSDLs that are imported in the given WSDL as independent Documents.
`static void` | `mergeWSDL(org.w3c.dom.Document from, org.w3c.dom.Document to, java.util.Set namespaces)` Determines which schema content the first WSDL has that the second one doesn't and adds that content to the second WSDL.
`static org.w3c.dom.Element` | `removeSchemaReferences(org.w3c.dom.Element wsdl)`
`static org.w3c.dom.Element` | `removeWsdlReferences(org.w3c.dom.Element wsdl)` Iterates over a WSDL document and removes all WSDL imports and XSD imports.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NAMESPACE_URI

    public static final java.lang.String NAMESPACE_URI

  The WSDL 1.1 namespace URI.

  See Also:
    Constant Field Values

### PREFIX

    public static final java.lang.String PREFIX

See Also:
  Constant Field Values

### SOAP_URI

    public static final java.lang.String SOAP_URI

  The "WSDL-SOAP" namespace used for SOAP bindings.

  See Also:
    Constant Field Values

### SOAP_PREFIX

    public static final java.lang.String SOAP_PREFIX

See Also:
  Constant Field Values

### ADDRESS_QNAME

    public static final QName ADDRESS_QNAME

### BINDING_QNAME

    public static final QName BINDING_QNAME

### DEFINITIONS_QNAME

    public static final QName DEFINITIONS_QNAME

### IMPORT_QNAME

    public static final QName IMPORT_QNAME

### INPUT_QNAME

    public static final QName INPUT_QNAME

### LOCATION

    public static final java.lang.String LOCATION

See Also:
  Constant Field Values

### MESSAGE_QNAME

    public static final QName MESSAGE_QNAME

### NAME

    public static final java.lang.String NAME

See Also:
  Constant Field Values

### OPERATION_QNAME

    public static final QName OPERATION_QNAME

### OUTPUT_QNAME

    public static final QName OUTPUT_QNAME

### PORT_QNAME

    public static final QName PORT_QNAME

### PORT_TYPE_QNAME

    public static final QName PORT_TYPE_QNAME

### SERVICE_QNAME

    public static final QName SERVICE_QNAME

### TYPES_QNAME

    public static final QName TYPES_QNAME

### WSDL4J_VERBOSE_FLAG

    public static final java.lang.String WSDL4J_VERBOSE_FLAG

See Also:
  Constant Field Values

### DEFAULT_SERVICE_NAME

    public static final java.lang.String DEFAULT_SERVICE_NAME

See Also:
  Constant Field Values

### SERVICES

    public static final java.lang.String SERVICES

See Also:
  Constant Field Values

Constructor Detail

### WsdlUtils

    public WsdlUtils()

Method Detail

### addSchemaImports

    public static org.w3c.dom.Document addSchemaImports(org.w3c.dom.Document wsdl,
                                                        java.lang.String wsdlPath,
                                                        Environment environment,
                                                        java.util.Set namespaces)

  This is a convenience method that resolves all of the schema imports referenced in a WSDL. It iterates over every schema in the WSDL's types section and processes it via XsdUtils.addImports().

  Returns:
    The given WSDL, now with the imported schemas added to its types section.

### addSchemaIncludes

    public static org.w3c.dom.Document addSchemaIncludes(org.w3c.dom.Document wsdl,
                                                         java.lang.String wsdlPath,
                                                         Environment environment,
                                                         java.util.Set namespaces)

  This is a convenience method that resolves all of the schema includes referenced in a WSDL. It iterates over every schema in the WSDL's types section and processes it via XsdUtils.addIncludes().

  Returns:
    The given WSDL, now with the included schemas added to its types section.

### createDefinition

    public static Definition createDefinition(org.w3c.dom.Document wsdlDoc,
                                              java.io.File wsdlDir)

### createWSDL

    public static org.w3c.dom.Document createWSDL(Environment environment,
                                                  java.lang.String wsdlPath,
                                                  boolean resolveReferences)

  Loads the WSDL at the given path, resolving any imports if desired.

  Parameters:
    `environment` - The Muse environment is used to load the WSDL file.
    `wsdlPath` - The relative path of the WSDL file.
    `resolveReferences` - True if you want the method to process and WSDL and XSD imports that are in the WSDL document. The resulting Document may be much larger depending on how many imports are discovered while the method recurses through the other WSDLs/XSDs.
  Returns:
    A Document with the WSDL content. If the last parameter was 'true', the Document will have the contents of other WSDLs and XSDs merged into it.

### getAction

    public static java.lang.String getAction(Operation op)

### getComplexTypeDeclaration

    public static org.w3c.dom.Element getComplexTypeDeclaration(org.w3c.dom.Node wsdl,
                                                                QName qname)

  Searches a WSDL document's types section for a complex type defined with the given name.

  Parameters:
    `wsdl` - The WDSL document to search.
    `qname` - The name of the type definition to find.
  Returns:
    The schema definition of the given type. The method returns null if the type is not found.

### getElementDeclaration

    public static org.w3c.dom.Element getElementDeclaration(org.w3c.dom.Node wsdl,
                                                            QName qname)

  Searches a WSDL document's types section for a type defined with the given name.

  Parameters:
    `wsdl` - The WDSL document to search.
    `qname` - The name of the type definition to find.
  Returns:
    The schema definition of the given type. The method returns null if the type is not found.

### getFirstPortType

    public static org.w3c.dom.Element getFirstPortType(org.w3c.dom.Node wsdl)

  Returns the first portType (in document order) that's found in a given WSDL or null if the WSDL contains no portTypes.

  Parameters:
    `wsdl` - The WSDL document to search
  Returns:
    The first portType encountered or null if the document contains no portTypes

### getInputPartName

    public static QName getInputPartName(Operation op)

### getOutputPartName

    public static QName getOutputPartName(Operation op,
                                          org.w3c.dom.Document wsdlDoc)

  This method is somewhat painful because of the lack of restrictions that WSDL 1.1 has for how you can specify input and output names and types. Similar to the problem of generating proxies that have the proper return type/name, determining how to package response messages is hard because there are multiple ways to say the same thing (void, xsd:any, etc.) and almost everything is optional. This method is way too long, but I don't think breaking up the input and output message processing would help clarify things. The output message processing is most problematic, because each step of the way is optional. This is going to be ugly no matter what.

### getPortType

    public static org.w3c.dom.Element getPortType(org.w3c.dom.Node wsdl,
                                                  QName qname)

  Searches a WSDL document for a portType defined with the given name.

  Parameters:
    `wsdl` - The WDSL document to search.
    `qname` - The name of the portType definition to find.
  Returns:
    The definition of the given portType. The method returns null if the portType is not found.

### getSchemaNamespaces

    public static java.util.Set getSchemaNamespaces(org.w3c.dom.Document wsdl)

  Gathers the target namespaces for each schema in the WSDL's types section.

  Parameters:
    `wsdl` -
  Returns:
    The set of schema namespaces declared in the types section.

### getServiceName

    public static java.lang.String getServiceName(org.w3c.dom.Element wsdlDefinition)

  Given a WSDL document try to get the address and parse out the name of the service. If we can't find anything useful just return a default: the value of DEFAULT_SERVICE_NAME.

  Parameters:
    `wsdlDefinition` - The WSDL definition we're trying to parse
  Returns:
    The name of the service in the address element or the value of DEFAULT_SERVICE_NAME
  See Also:
    `DEFAULT_SERVICE_NAME`

### getWsdlImports

    public static java.util.Collection getWsdlImports(org.w3c.dom.Document wsdl,
                                                      java.lang.String wsdlPath,
                                                      Environment environment)

  Creates the WSDLs that are imported in the given WSDL as independent Documents. For each WSDL import, the Document is created via createWSDL(), and then its imports are resolved. The resulting set of Documents may have content overlap and should be merged into the original WSDL with mergeWSDL().

  Parameters:
    `wsdl` - The original WSDL whose imports must be resolved.
    `wsdlPath` - The relative path of the given WSDL. This is used to resolve the paths of the imported WSDLs.
    `environment` - The Muse environment is used to load the WSDL files.
  Returns:
    A Collection of Documents - one for each WSDL imported by the given WSDL. The Collection may include WSDLs that were imported by those WSDLs (the method is recursive).

### mergeWSDL

    public static void mergeWSDL(org.w3c.dom.Document from,
                                 org.w3c.dom.Document to,
                                 java.util.Set namespaces)

  Determines which schema content the first WSDL has that the second one doesn't and adds that content to the second WSDL.
  The method addresses the issue of duplicate schema namespaces by using size: if both WSDLs have a schema for a given namespace, whichever schema is the largest will be put in the final (second) WSDL. This is the best heuristic to get all of the required schema content without analyzing every node in the schema content.

  Parameters:
    `from` - The WSDL that may have unique schema content.
    `to` - The WSDL that will receive the first WSDL's unique schema content.
    `namespaces` - The schema namespaces that have been processed by the second WSDL.

### removeSchemaReferences

    public static org.w3c.dom.Element removeSchemaReferences(org.w3c.dom.Element wsdl)

### removeWsdlReferences

    public static org.w3c.dom.Element removeWsdlReferences(org.w3c.dom.Element wsdl)

  Iterates over a WSDL document and removes all WSDL imports and XSD imports. This is useful if you are trying to load a remote WSDL into an API such as WSDL4J, which tries to resolve imports. WSDL4J allows you to shut off WSDL imports, but not XSD imports, so removing these before parsing is important.

  Parameters:
    `wsdl` - The WSDL Document whose import elements will be removed.
  Returns:
    The given WSDL Document.

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD