org.ws4d.java.wsdl
Class WSDL

java.lang.Object
  extended by org.ws4d.java.wsdl.WSDL
All Implemented Interfaces:
Resource

public class WSDL
extends java.lang.Object
implements Resource


Constructor Summary
WSDL()
          Creates an empty WSDL.
WSDL(java.lang.String targetNamespace)
          Creates an empty WSDL with the given target namespace.
WSDL(java.lang.String targetNamespace, java.lang.String name)
           
 
Method Summary
 void addBinding(WSDLBinding binding)
           
 void addImport(java.lang.String targetNamespace, java.lang.String location)
          Adds an import information to this WSDL.
 void addLinkedWsdl(WSDL wsdl)
           
 void addMessage(WSDLMessage message)
           
 void addPortType(WSDLPortType portType)
           
 void addService(WSDLService service)
           
 void addTypes(Schema schema)
           
static CustomAttributeParser getAttributeParserForNamespace(java.lang.String namespace)
          Returns the custom attribute parser instance previously registered for the given namespace.
 WSDLBinding getBinding(QName name)
           
 WSDLBinding getBinding(java.lang.String name)
           
 Iterator getBindings()
          Returns an iterator over all bindings defined within this WSDL instance.
 Iterator getBindings(QName portType)
          Returns an iterator over all bindings for the port type with the given fully qualified name.
 InternetMediaType getContentType()
          Returns the content type of this resource.
 HashMap getDefaultNamespaces()
           
 HashMap getHeaderFields()
          Returns additional header fields for this resource.
 HashMap getImports()
           
 long getLastModifiedDate()
          Returns the last time where this resource was modified as UNIX timestamp.
 WSDL getLinkedWsdl(java.lang.String namespace)
           
 WSDL getLinkedWsdlRecursive(java.lang.String namespace)
           
 Iterator getLinkedWsdls()
          Returns an iterator over all WSDL instances imported by this WSDL instance.
 WSDLMessage getMessage(QName name)
           
 WSDLMessage getMessage(java.lang.String name)
           
 Iterator getMessages()
          Returns an iterator over all messages defined within this WSDL instance.
 java.lang.String getName()
           
 WSDLPortType getPortType(QName name)
           
 WSDLPortType getPortType(java.lang.String name)
           
 Iterator getPortTypes()
          Returns an iterator over all port types defined within this WSDL instance.
 Element getSchemaElement(QName name)
           
 Element getSchemaElement(java.lang.String name)
           
 Type getSchemaType(QName name)
           
 Type getSchemaType(java.lang.String name)
           
 WSDLService getService(QName name)
           
 WSDLService getService(java.lang.String name)
           
 Iterator getServices()
          Returns an iterator over all services defined within this WSDL instance.
 DataStructure getSupportedOperations()
          Returns a data structure of WSDLOperation instances, which belong to port types within this WSDL with an appropriate (i.e. supported) binding specified.
 DataStructure getSupportedPortTypes()
          Returns a data structure WSDLPortType instances within this WSDL with an appropriate (i.e. supported) binding specified.
 java.lang.String getTargetNamespace()
           
 Iterator getTypes()
          Returns an iterator over all Schema instances (i.e.
 Schema getTypes(java.lang.String namespace)
           
static WSDL parse(java.io.InputStream in)
           
static WSDL parse(java.io.InputStream in, boolean loadReferencedFiles)
           
static WSDL parse(java.io.InputStream in, URI fromUri, boolean loadReferencedFiles)
           
static WSDL parse(URI fromUri)
           
static WSDL parse(URI fromUri, boolean loadReferencedFiles)
           
static WSDL parse(org.xmlpull.v1.XmlPullParser parser)
           
static WSDL parse(org.xmlpull.v1.XmlPullParser parser, boolean loadReferencedFiles)
           
static void registerAttributeParserForNamespace(java.lang.String namespace, CustomAttributeParser parser)
           
 void serialize(java.io.OutputStream out)
           
 void serialize(URI request, RequestHeader requestHeader, java.io.InputStream requestBody, java.io.OutputStream out)
          Serializes this resource to the given output stream out.
 void setName(java.lang.String name)
           
 void setTargetNamespace(java.lang.String targetNamespace)
           
 java.lang.String shortDescription()
          A short string representation of this resource.
 long size()
          The size of the resource.
 void storeDefaultNamespace(java.lang.String prefix, java.lang.String nsUri)
           
 void storeDefaultNamespaces(org.xmlpull.v1.XmlPullParser parser)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WSDL

public WSDL()
Creates an empty WSDL.


WSDL

public WSDL(java.lang.String targetNamespace)
Creates an empty WSDL with the given target namespace.

Parameters:
targetNamespace - the target namespace of the WSDL

WSDL

public WSDL(java.lang.String targetNamespace,
            java.lang.String name)
Parameters:
targetNamespace - the namespace this WSDL defines
name - the name of the WSDL
Method Detail

registerAttributeParserForNamespace

public static void registerAttributeParserForNamespace(java.lang.String namespace,
                                                       CustomAttributeParser parser)

getAttributeParserForNamespace

public static CustomAttributeParser getAttributeParserForNamespace(java.lang.String namespace)
Returns the custom attribute parser instance previously registered for the given namespace. If there no parser was registered, a default one is returned, namely StringAttributeParser.INSTANCE).

Parameters:
namespace - the namespace to return a custom attribute parser for
Returns:
the custom attribute parser for the specified namespace

parse

public static WSDL parse(URI fromUri)
                  throws org.xmlpull.v1.XmlPullParserException,
                         java.io.IOException
Throws:
org.xmlpull.v1.XmlPullParserException
java.io.IOException

parse

public static WSDL parse(URI fromUri,
                         boolean loadReferencedFiles)
                  throws org.xmlpull.v1.XmlPullParserException,
                         java.io.IOException
Throws:
org.xmlpull.v1.XmlPullParserException
java.io.IOException

parse

public static WSDL parse(java.io.InputStream in)
                  throws org.xmlpull.v1.XmlPullParserException,
                         java.io.IOException
Throws:
org.xmlpull.v1.XmlPullParserException
java.io.IOException

parse

public static WSDL parse(java.io.InputStream in,
                         boolean loadReferencedFiles)
                  throws org.xmlpull.v1.XmlPullParserException,
                         java.io.IOException
Throws:
org.xmlpull.v1.XmlPullParserException
java.io.IOException

parse

public static WSDL parse(java.io.InputStream in,
                         URI fromUri,
                         boolean loadReferencedFiles)
                  throws org.xmlpull.v1.XmlPullParserException,
                         java.io.IOException
Throws:
org.xmlpull.v1.XmlPullParserException
java.io.IOException

parse

public static WSDL parse(org.xmlpull.v1.XmlPullParser parser)
                  throws org.xmlpull.v1.XmlPullParserException,
                         java.io.IOException
Throws:
org.xmlpull.v1.XmlPullParserException
java.io.IOException

parse

public static WSDL parse(org.xmlpull.v1.XmlPullParser parser,
                         boolean loadReferencedFiles)
                  throws org.xmlpull.v1.XmlPullParserException,
                         java.io.IOException
Throws:
org.xmlpull.v1.XmlPullParserException
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

serialize

public void serialize(URI request,
                      RequestHeader requestHeader,
                      java.io.InputStream requestBody,
                      java.io.OutputStream out)
               throws java.io.IOException
Description copied from interface: Resource
Serializes this resource to the given output stream out.

Specified by:
serialize in interface Resource
Parameters:
request - the request URI
requestHeader - the header of the request
requestBody - makes the content of the request body available
out - the outputs stream to serialize this resource over
Throws:
java.io.IOException - if an IO failure occurs during serialization

getContentType

public InternetMediaType getContentType()
Description copied from interface: Resource
Returns the content type of this resource.

If it is not possible to determinate the content type of the resource, the Resource.getContentType() method should return at least the application/octet-stream content type.

Specified by:
getContentType in interface Resource
Returns:
the content type of this resource.

getHeaderFields

public HashMap getHeaderFields()
Description copied from interface: Resource
Returns additional header fields for this resource.

The additional header fields allow to add header fields to the response which will be created to send this resource.

NOTICE: The map must contain a String, String mapping.

Specified by:
getHeaderFields in interface Resource
Returns:
a map which contains the header=>value mapping.

size

public long size()
Description copied from interface: Resource
The size of the resource.

If it is not possible to determinate the size of the resource. The implementation should return -1. This will allow to send the resource as chunked content.

Specified by:
size in interface Resource
Returns:
the size of the resource.

getSupportedOperations

public DataStructure getSupportedOperations()
Returns a data structure of WSDLOperation instances, which belong to port types within this WSDL with an appropriate (i.e. supported) binding specified.

Returns:
a data structure of all supported operations

getSupportedPortTypes

public DataStructure getSupportedPortTypes()
Returns a data structure WSDLPortType instances within this WSDL with an appropriate (i.e. supported) binding specified.

Returns:
a data structure of all supported port types

getName

public java.lang.String getName()
Returns:
the name

setName

public void setName(java.lang.String name)
Parameters:
name - the name to set

getTargetNamespace

public java.lang.String getTargetNamespace()
Returns:
the targetNamespace

setTargetNamespace

public void setTargetNamespace(java.lang.String targetNamespace)
Parameters:
targetNamespace - the targetNamespace to set

getImports

public HashMap getImports()
Returns:
a copy of the imports declared on this WSDL instance

getPortType

public WSDLPortType getPortType(java.lang.String name)
Parameters:
name - the local name of the port type to return; a namespace equal to this WSDL's target namespace is assumed
Returns:
the named port type or null

getPortType

public WSDLPortType getPortType(QName name)
Parameters:
name - the qualified name of the port type to return
Returns:
the named port type or null

getPortTypes

public Iterator getPortTypes()
Returns an iterator over all port types defined within this WSDL instance.

Returns:
an iterator over all defined port types

getMessage

public WSDLMessage getMessage(java.lang.String name)
Parameters:
name - the local name of the message to return; a namespace equal to this WSDL's target namespace is assumed
Returns:
the named message or null

getMessage

public WSDLMessage getMessage(QName name)
Parameters:
name - the qualified name of the message to return
Returns:
the named message or null

getMessages

public Iterator getMessages()
Returns an iterator over all messages defined within this WSDL instance.

Returns:
an iterator over all defined messages

getBinding

public WSDLBinding getBinding(java.lang.String name)
Parameters:
name - the local name of the binding to return; a namespace equal to this WSDL's target namespace is assumed
Returns:
the named binding or null

getBinding

public WSDLBinding getBinding(QName name)
Parameters:
name - the qualified name of the binding to return
Returns:
the named binding or null

getBindings

public Iterator getBindings()
Returns an iterator over all bindings defined within this WSDL instance.

Returns:
an iterator over all defined bindings

getBindings

public Iterator getBindings(QName portType)
Returns an iterator over all bindings for the port type with the given fully qualified name.

Parameters:
portType - the fully qualified name of the port type for which to find corresponding bindings
Returns:
an iterator over all bindings for the given port type

getService

public WSDLService getService(java.lang.String name)
Parameters:
name - the local name of the service to return; a namespace equal to this WSDL's target namespace is assumed
Returns:
the named service or null

getService

public WSDLService getService(QName name)
Parameters:
name - the qualified name of the service to return
Returns:
the named service or null

getServices

public Iterator getServices()
Returns an iterator over all services defined within this WSDL instance.

Returns:
an iterator over all defined services

getTypes

public Schema getTypes(java.lang.String namespace)
Parameters:
namespace - the target namespace of the Schema instance to return
Returns:
the Schema instance with the given target namespace or null

getTypes

public Iterator getTypes()
Returns an iterator over all Schema instances (i.e. XML schema definitions) referenced by this WSDL instance.

Returns:
an iterator over all known Schema instances

getSchemaType

public Type getSchemaType(java.lang.String name)
Parameters:
name - the local name of the schema type to return; a namespace equal to this WSDL's target namespace is assumed
Returns:
the named schema type or null

getSchemaType

public Type getSchemaType(QName name)
Parameters:
name - the qualified name of the schema type to return
Returns:
the named schema type or null

getSchemaElement

public Element getSchemaElement(java.lang.String name)
Parameters:
name - the local name of the schema element to return; a namespace equal to this WSDL's target namespace is assumed
Returns:
the named schema element or null

getSchemaElement

public Element getSchemaElement(QName name)
Parameters:
name - the qualified name of the schema element to return
Returns:
the named schema element or null

addImport

public void addImport(java.lang.String targetNamespace,
                      java.lang.String location)
Adds an import information to this WSDL.

Parameters:
targetNamespace - the target namespace of the imported WSDL
location - the location

getLinkedWsdlRecursive

public WSDL getLinkedWsdlRecursive(java.lang.String namespace)
Parameters:
namespace - the target namespace of the imported WSDL instance to return
Returns:
the WSDL instance with the given target namespace as imported by this WSDL or any of its recursively imported WSDLs or null

getLinkedWsdl

public WSDL getLinkedWsdl(java.lang.String namespace)
Parameters:
namespace - the target namespace of the imported WSDL instance to return
Returns:
the WSDL instance with the given target namespace as imported by this WSDL or null

getLinkedWsdls

public Iterator getLinkedWsdls()
Returns an iterator over all WSDL instances imported by this WSDL instance.

Returns:
an iterator over all imported WSDL instances

addLinkedWsdl

public void addLinkedWsdl(WSDL wsdl)

addTypes

public void addTypes(Schema schema)

addMessage

public void addMessage(WSDLMessage message)

addPortType

public void addPortType(WSDLPortType portType)

addBinding

public void addBinding(WSDLBinding binding)

addService

public void addService(WSDLService service)
                throws UnsupportedBindingException
Throws:
UnsupportedBindingException

serialize

public void serialize(java.io.OutputStream out)
               throws java.io.IOException
Throws:
java.io.IOException

getDefaultNamespaces

public HashMap getDefaultNamespaces()
Returns:

storeDefaultNamespaces

public void storeDefaultNamespaces(org.xmlpull.v1.XmlPullParser parser)
                            throws org.xmlpull.v1.XmlPullParserException
Throws:
org.xmlpull.v1.XmlPullParserException

storeDefaultNamespace

public void storeDefaultNamespace(java.lang.String prefix,
                                  java.lang.String nsUri)

shortDescription

public java.lang.String shortDescription()
Description copied from interface: Resource
A short string representation of this resource.

Specified by:
shortDescription in interface Resource
Returns:
a short string representation.

getLastModifiedDate

public long getLastModifiedDate()
Description copied from interface: Resource
Returns the last time where this resource was modified as UNIX timestamp.

Specified by:
getLastModifiedDate in interface Resource
Returns:
last time where this resource was modified.