com.quadrique.jbuildingblocks.core.io.webServices.client.wsdl
Class JbbWsdlDocument

java.lang.Object
  extended by com.quadrique.jbuildingblocks.core.io.webServices.client.wsdl.JbbWsdlDocument

public class JbbWsdlDocument
extends Object

This class provides convenience methods to manipulate a WSDL docuemnt

Author:
Hervé Rivere

Constructor Summary
JbbWsdlDocument(String wsdlUrl)
          constructor
 
Method Summary
 void getAllMessages()
           
 ArrayList getAllOperations()
           
 void getAllServices()
           
 ArrayList<JbbWsdlSoapOperation> getAllSoapOperations()
           
 ArrayList<JbbWsdlSoapOperation> getAllSoapOperations(JbbWsdlSoapPort soapPort)
           
 ArrayList<JbbWsdlSoapPort> getAllSoapPorts()
           
 String getDefinitionsNameSpace(String zKey)
           
 Map getDefinitionsNameSpaces()
           
 ArrayList getInputMessageParameters(javax.wsdl.Operation zOp)
           
 ArrayList getOutputMessageParameters(javax.wsdl.Operation zOp)
           
 Element getSchema()
          If the WSDL file has an embedded xml schema to describe a complex input/output type, it is declared in the <definitions> and <types> tags as follows: <definitions ...
 javax.wsdl.Service getService(String serviceName)
           
 JbbWsdlSoapOperation getSoapOperation(String operationName)
           
 JbbWsdlSoapOperation getSoapOperation(String operationName, JbbWsdlSoapPort soapPort)
           
 JbbWsdlSoapOperation getSoapOperation(String operationName, String portName)
           
 JbbWsdlSoapPort getSoapPort(String portName)
           
 String getTargetNameSpace()
           
 List getTypes()
          Return the list of all the elements under the tag (if present, the tag is one level under the type)
 String getWsdlUrl()
           
 void processInputMessagePart(ArrayList methodParams, javax.wsdl.Part part)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JbbWsdlDocument

public JbbWsdlDocument(String wsdlUrl)
                throws Exception
constructor

Parameters:
zWsdlUrl - the URL of the .wsdl file
Throws:
Exception - if an error occurs
Method Detail

getDefinitionsNameSpaces

public Map getDefinitionsNameSpaces()
                             throws Exception
Returns:
All the namespaces that are part of the "definitions" tag

For instance, if the WSDL document starts with:
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="http://webservices.imacination.com/distance/Distance.jws"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://webservices.imacination.com/distance/Distance.jws"
xmlns:intf="http://webservices.imacination.com/distance/Distance.jws"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types />
<wsdl:message name="getStateRequest">
...
the method would return a map that contains the following hey/value pairs:
  • key: "" value:"http://schemas.xmlsoap.org/wsdl/"
  • key: "wsdl" value:"http://schemas.xmlsoap.org/wsdl/"
  • key: "xsd" value:"http://www.w3.org/2001/XMLSchema"
  • key: "soapenc" value:"http://schemas.xmlsoap.org/soap/encoding/"
  • key: "wsdlsoap" value:"http://schemas.xmlsoap.org/wsdl/soap/"
  • key: "intf" value:"http://webservices.imacination.com/distance/Distance.jws"
  • key: "impl" value:"http://webservices.imacination.com/distance/Distance.jws"
  • key: "apachesoap" value:"http://xml.apache.org/xml-soap"

getDefinitionsNameSpace

public String getDefinitionsNameSpace(String zKey)
                               throws Exception
Returns:
the namespace (from the "definitions" tag) for the given key

For instance, if the WSDL document starts with:
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="http://webservices.imacination.com/distance/Distance.jws"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://webservices.imacination.com/distance/Distance.jws"
xmlns:intf="http://webservices.imacination.com/distance/Distance.jws"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types />
<wsdl:message name="getStateRequest">
...
The call "getDefinitionsNameSpace("")" would return "http://schemas.xmlsoap.org/wsdl/"
The call "getDefinitionsNameSpace("apachesoap")" would return "http://xml.apache.org/xml-soap"
The call "getDefinitionsNameSpace("soapenc")" would return "http://schemas.xmlsoap.org/soap/encoding/"
The call "getDefinitionsNameSpace("notThere")" would return null"
...
Throws:
Exception - if an error occurs

getAllServices

public void getAllServices()
                    throws Exception
Throws:
Exception - if an error occurs

getService

public javax.wsdl.Service getService(String serviceName)
                              throws Exception
Throws:
Exception - if an error occurs

getAllSoapPorts

public ArrayList<JbbWsdlSoapPort> getAllSoapPorts()
                                           throws Exception
Parameters:
zSoapPorts - an ArrayList instance (has to be created by the caller) that will be populated with WsdlSoapPort instance(s) by this method
Returns:
the SOAP service name (a service is considered a SOAP service if at least one of its port has a soap:address extension) of null if none
Throws:
Exception - if an error occurs

getSoapPort

public JbbWsdlSoapPort getSoapPort(String portName)
                            throws Exception
Parameters:
portName - populated with WsdlSoapPort instance(s) by this method
Returns:
the SOAP service name (a service is considered a SOAP service if at least one of its port has a soap:address extension) of null if none
Throws:
Exception - if an error occurs

getAllSoapOperations

public ArrayList<JbbWsdlSoapOperation> getAllSoapOperations()
                                                     throws Exception
Throws:
Exception

getAllSoapOperations

public ArrayList<JbbWsdlSoapOperation> getAllSoapOperations(JbbWsdlSoapPort soapPort)
                                                     throws Exception
Parameters:
soapPort - a list of WsdlSoapPort instance
Returns:
a list of WsdlSoapOperation instances if any
Throws:
Exception - in an error cocurs

getAllOperations

public ArrayList getAllOperations()
                           throws Exception
Returns:
an ArrayList of Operation
Throws:
Exception - if an error occurs

getSoapOperation

public JbbWsdlSoapOperation getSoapOperation(String operationName)
                                      throws Exception
Throws:
Exception

getSoapOperation

public JbbWsdlSoapOperation getSoapOperation(String operationName,
                                             String portName)
                                      throws Exception
Throws:
Exception

getSoapOperation

public JbbWsdlSoapOperation getSoapOperation(String operationName,
                                             JbbWsdlSoapPort soapPort)
                                      throws Exception
Returns:
Operation soapOperation
Throws:
Exception - if an error occurs

getInputMessageParameters

public ArrayList getInputMessageParameters(javax.wsdl.Operation zOp)
                                    throws Exception
Parameters:
zOp - the operation
Returns:
an ArrayList of Part instances
Throws:
Exception - if an error occurs

getOutputMessageParameters

public ArrayList getOutputMessageParameters(javax.wsdl.Operation zOp)
                                     throws Exception
Parameters:
zOp - the operation
Returns:
an ArrayList of Part instance(s)
Throws:
Exception - if an error occurs

processInputMessagePart

public void processInputMessagePart(ArrayList methodParams,
                                    javax.wsdl.Part part)
                             throws Exception
Throws:
Exception

getAllMessages

public void getAllMessages()
                    throws Exception
Throws:
Exception - if an error occurs

getTypes

public List getTypes()
Return the list of all the elements under the tag (if present, the tag is one level under the type)

Returns:
an ArayList of UnknownExtensibilityElement instance(s). The list is empty if there is none.

getSchema

public Element getSchema()
If the WSDL file has an embedded xml schema to describe a complex input/output type, it is declared in the <definitions> and <types> tags as follows:

Returns:
the org.w3c.dom.Element instance that corresponds to the <s:schema ...> tag where 's' is defined as "http://www.w3.org/2001/XMLSchema"

getTargetNameSpace

public String getTargetNameSpace()

getWsdlUrl

public String getWsdlUrl()


Copyright © 2001-2008 Quadrique Corporation. All Rights Reserved.