com.wingfoot.soap
Class Envelope

java.lang.Object
  |
  +--com.wingfoot.soap.SOAPElement
        |
        +--com.wingfoot.soap.Envelope

public class Envelope
extends SOAPElement

Encapsulates the SOAP Envelope element.

Since:
0.90

Constructor Summary
Envelope()
          Constructor for the SOAP Envelope.
 
Method Summary
 void addHeader(HeaderEntry headerEntry)
          Adds a SOAP HeaderEntry
 void deserialize(byte[] response, TypeMappingRegistry registry)
          Takes the response from the service as a byte[] and converts it into Java representation
 java.lang.String getBody()
          Returns the SOAP Body.
 java.lang.String getEncoding()
          Utility method to retrieve the encoding (example UTF-8) specified using useEncoding method.
 java.lang.String getEncodingStyle()
          Convenience method to get the encodingStyle SOAP attribute.
 Fault getFault()
          Returns the fault generated by the service encapsulated as Fault
 java.util.Vector getHeader()
          Returns the SOAP Headers
 java.lang.Object getParameter(int index)
          Returns the parameter at the given index.
 int getParameterCount()
          Returns the number of parameters in the the SOAP Body.
 java.lang.String getParameterName(int index)
          Returns the parameter name at the given index.
 java.lang.String getReturnNamespace()
          Returns the namespace associated with the return operation.
 java.lang.String getReturnOperationName()
          For RPC style response, the parameter is wrapped with an element.
 java.lang.String getSchema()
          Convenience method to get the Schema
 java.lang.String getSchemaInstance()
          Convenience method to get the Schema Instance
 boolean isDocumentStyle()
          Determines if the envelope contains Document style or RPC style parameters.
 boolean isFaultGenerated()
          Determines if a fault element was present in the response from a service.
 byte[] serialize(TypeMappingRegistry registry, java.lang.String methodName, java.lang.String targetURI)
          Takes the Envelope (along with the header and body) and converts it to XML that is SOAP message compliant.
 void setBody(java.lang.String body)
          Sets the SOAP body with arbitary XML payload.
 void setBody(java.lang.String parameterName, java.lang.Object value)
          Sets the SOAP body with parameters.
 void setEncodingStyle(java.lang.String encodingStyle)
          Helper method for setting the encodingStyle SOAP attribute.
 void setSchema(java.lang.String schema)
          Helper method for setting the schema attribute
 void setSchemaInstance(java.lang.String schemaInstance)
          Helper method for setting the schemaInstance attribute
 void useEncoding(java.lang.String enc)
          Method to specify the encoding to use while sending and parsing the SOAP payload (example UTF-8).
 
Methods inherited from class com.wingfoot.soap.SOAPElement
addAttribute, deserialize, getAttribute, getAttributes, removeAttribute, serialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Envelope

public Envelope()
Constructor for the SOAP Envelope.
This sets the Users desiring to do something different need to do envelope.removeAttribute () followed by envelope.setSchema/SchemaInstance/EncodingStyle() .
Method Detail

addHeader

public void addHeader(HeaderEntry headerEntry)
Adds a SOAP HeaderEntry
Parameters:
headerEntry - Instance of HeaderEntry which encapsulates an instance of a header.
Since:
0.90

setBody

public void setBody(java.lang.String parameterName,
                    java.lang.Object value)
             throws SOAPException
Sets the SOAP body with parameters.
Parameters:
parameterName - String with the name of the parameter.
value - Object encapsulating the value assigned to the parameter. In Bubbles, all primitive data types are represented as their corresponding wrapper class
Throws:
SOAPException - if a Document Style parameter was previously added.
Since:
0.90

setBody

public void setBody(java.lang.String body)
             throws SOAPException
Sets the SOAP body with arbitary XML payload.
Parameters:
body - String representing the XML as soap payload
Throws:
SOAPException - if a RPC style parameter was already specified in this envelope
Since:
0.90

setSchemaInstance

public void setSchemaInstance(java.lang.String schemaInstance)
Helper method for setting the schemaInstance attribute
Parameters:
schemaInstance - URI of Schema Instance
Since:
0.90

setSchema

public void setSchema(java.lang.String schema)
Helper method for setting the schema attribute
Parameters:
schema - URI of Schema
Since:
0.90

setEncodingStyle

public void setEncodingStyle(java.lang.String encodingStyle)
Helper method for setting the encodingStyle SOAP attribute. An null encodingStyle indicates that the payload is a literal (as opposed to encoded).
Parameters:
schema - URI of encodingStyle
Since:
0.90

getHeader

public java.util.Vector getHeader()
Returns the SOAP Headers
Returns:
Vector of HeaderEntry

isDocumentStyle

public boolean isDocumentStyle()
Determines if the envelope contains Document style or RPC style parameters.

getBody

public java.lang.String getBody()
Returns the SOAP Body. Use this method to retrieve the Body in a Document style.
Returns:
String representing SOAP Body.

getParameterCount

public int getParameterCount()
Returns the number of parameters in the the SOAP Body.
Returns:
int the number of parameters; 0 if no parameter is present

getParameterName

public java.lang.String getParameterName(int index)
Returns the parameter name at the given index.
Parameters:
index - the parameter number. return String with the parameter name.

getParameter

public java.lang.Object getParameter(int index)
Returns the parameter at the given index.
Parameters:
index - the parameter number.
Returns:
Object ecnapsulating the parameter.

isFaultGenerated

public boolean isFaultGenerated()
Determines if a fault element was present in the response from a service.
Returns:
true if a fault element was present in the response, false if a fault element was not present.
Since:
0.90

getFault

public Fault getFault()
Returns the fault generated by the service encapsulated as Fault
Returns:
fault generated encapsulated in Fault null if no fault was generated by the service

getSchemaInstance

public java.lang.String getSchemaInstance()
Convenience method to get the Schema Instance
Returns:
String with the schema instance.

getSchema

public java.lang.String getSchema()
Convenience method to get the Schema
Returns:
String with the schema.

getEncodingStyle

public java.lang.String getEncodingStyle()
Convenience method to get the encodingStyle SOAP attribute.
Returns:
String with the encoding style.

useEncoding

public void useEncoding(java.lang.String enc)
Method to specify the encoding to use while sending and parsing the SOAP payload (example UTF-8). If null or if not specified, the default encoding is used. Users are encouraged to ensure that the encoding is supported by the device before specifying one here.
Parameters:
enc - the encoding to use.
Since:
1.9

getEncoding

public java.lang.String getEncoding()
Utility method to retrieve the encoding (example UTF-8) specified using useEncoding method.
Returns:
String the encoding.
Since:
1.0

serialize

public byte[] serialize(TypeMappingRegistry registry,
                        java.lang.String methodName,
                        java.lang.String targetURI)
                 throws java.lang.Exception
Takes the Envelope (along with the header and body) and converts it to XML that is SOAP message compliant.
Parameters:
registry - instance of TypeMappingRegistry mapping each custom class to serialize/deserialize to a namespace and the serializer and deserializer class.
methodName - the name of the method to invoke on the on the service
targetURI - URI of the service to invoke
Returns:
an array of bytes representing the soap message
Throws:
java.lang.Exception - if problems during serialization
Since:
0.90

deserialize

public void deserialize(byte[] response,
                        TypeMappingRegistry registry)
                 throws java.io.IOException,
                        SOAPException,
                        java.lang.Exception
Takes the response from the service as a byte[] and converts it into Java representation
Parameters:
response - the response from the service
registry - instance of TypeMappingRegistry mapping each custom class to serialize/deserialize to a namespace and the serializer and deserializer class.
Throws:
java.io.IOException - if any error occurs in parsing the payload returned.
SOAPException - if any error occurs during deserialization
java.lang.Exception - any other unusual exceptions.
Since:
0.90

getReturnOperationName

public java.lang.String getReturnOperationName()
For RPC style response, the parameter is wrapped with an element. This can be viewed as an operation name. The method returns the operation name.
Returns:
String the element name that is wrapped around the parameters; null if none was specified.

getReturnNamespace

public java.lang.String getReturnNamespace()
Returns the namespace associated with the return operation.
Returns:
String the namespace associated with the return operation name; null if none is specified.


Copyright(c) Wingfoot Software (www.wingfoot.com). All Rights Reserved.

KXML is a XML parser by Lutris Technologies