com.eviware.soapui.impl.wsdl.panels.teststeps.amf
Class SoapUIAMFConnection

java.lang.Object
  extended by com.eviware.soapui.impl.wsdl.panels.teststeps.amf.SoapUIAMFConnection

public class SoapUIAMFConnection
extends java.lang.Object

AMFConnection derivate using HttpClient instead of UrlConnection

Author:
Ole

Constructor Summary
SoapUIAMFConnection()
          Creates a default AMF connection instance.
 
Method Summary
 void addAmfHeader(java.lang.String name, boolean mustUnderstand, java.lang.Object data)
          Adds an AMF packet-level header which is sent with every request for the life of this AMF connection.
 void addAmfHeader(java.lang.String name, java.lang.Object data)
          Add an AMF packet-level header with mustUnderstand=false, which is sent with every request for the life of this AMF connection.
 void addHttpRequestHeader(java.lang.String name, java.lang.String value)
          Adds a Http request header to the underlying connection.
 java.lang.Object call(PropertyExpansionContext context, java.lang.String command, java.lang.Object... arguments)
          Makes an AMF request to the server.
 void close()
          Closes the underlying URL connection, sets the url to null, and clears the cookies.
 void connect(java.lang.String url)
          Connects to the URL provided.
protected  flex.messaging.io.amf.client.exceptions.ServerStatusException.HttpResponseInfo generateHttpResponseInfo()
          Generates the HTTP response info for the server status exception.
 int getObjectEncoding()
           
protected  java.lang.String getResponseURI()
          Generates and returns the response URI.
 java.lang.String getUrl()
           
protected  void internalConnect()
          An internal method that sets up the underlying URL connection.
protected  java.lang.Object processAmfBody(java.util.ArrayList<flex.messaging.io.amf.MessageBody> messages)
          Processes the AMF body.
protected  void processAmfHeaders(java.util.ArrayList<flex.messaging.io.amf.MessageHeader> headers)
          Processes the AMF headers by dispatching them to an AMF header processor, if one exists.
protected  java.lang.Object processAmfPacket(flex.messaging.io.amf.ActionMessage packet)
          Processes the AMF packet.
protected  java.lang.Object processHttpResponse(java.io.InputStream inputStream)
          Processes the HTTP response headers and body.
protected  java.lang.Object processHttpResponseBody(java.io.InputStream inputStream)
          Processes the HTTP response body.
static void registerAlias(java.lang.String alias, java.lang.String className)
          Registers a custom alias for a class name bidirectionally.
 void removeAllAmfHeaders()
          Removes all AMF headers.
 void removeAllHttpRequestHeaders()
          Removes all Http request headers.
 boolean removeAmfHeader(java.lang.String name)
          Removes any AMF headers found with the name given.
 boolean removeHttpRequestHeader(java.lang.String name)
          Removes the Http header found with the name given.
protected  java.lang.Object send(java.io.ByteArrayOutputStream outBuffer)
          Writes the output buffer and processes the HTTP response.
protected  void setHttpRequestHeaders()
          Sets the Http request headers, including the cookie headers.
 void setObjectEncoding(int objectEncoding)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoapUIAMFConnection

public SoapUIAMFConnection()
Creates a default AMF connection instance.

Method Detail

getObjectEncoding

public int getObjectEncoding()

setObjectEncoding

public void setObjectEncoding(int objectEncoding)

getUrl

public java.lang.String getUrl()

addAmfHeader

public void addAmfHeader(java.lang.String name,
                         boolean mustUnderstand,
                         java.lang.Object data)
Adds an AMF packet-level header which is sent with every request for the life of this AMF connection.

Parameters:
name - The name of the header.
mustUnderstand - Whether the header must be processed or not.
data - The value of the header.

addAmfHeader

public void addAmfHeader(java.lang.String name,
                         java.lang.Object data)
Add an AMF packet-level header with mustUnderstand=false, which is sent with every request for the life of this AMF connection.

Parameters:
name - The name of the header.
data - The value of the header.

removeAmfHeader

public boolean removeAmfHeader(java.lang.String name)
Removes any AMF headers found with the name given.

Parameters:
name - The name of the header(s) to remove.
Returns:
true if a header existed with the given name.

removeAllAmfHeaders

public void removeAllAmfHeaders()
Removes all AMF headers.


addHttpRequestHeader

public void addHttpRequestHeader(java.lang.String name,
                                 java.lang.String value)
Adds a Http request header to the underlying connection.

Parameters:
name - The name of the Http header.
value - The value of the Http header.

removeHttpRequestHeader

public boolean removeHttpRequestHeader(java.lang.String name)
Removes the Http header found with the name given.

Parameters:
name - The name of the Http header.
Returns:
true if a header existed with the given name.

removeAllHttpRequestHeaders

public void removeAllHttpRequestHeaders()
Removes all Http request headers.


call

public java.lang.Object call(PropertyExpansionContext context,
                             java.lang.String command,
                             java.lang.Object... arguments)
                      throws flex.messaging.io.amf.client.exceptions.ClientStatusException,
                             flex.messaging.io.amf.client.exceptions.ServerStatusException
Makes an AMF request to the server. A connection must have been made prior to making a call.

Parameters:
command - The method to call on the server.
arguments - Arguments for the method.
Returns:
The result of the call.
Throws:
flex.messaging.io.amf.client.exceptions.ClientStatusException - If there is a client side exception.
flex.messaging.io.amf.client.exceptions.ServerStatusException - If there is a server side exception.

close

public void close()
Closes the underlying URL connection, sets the url to null, and clears the cookies.


connect

public void connect(java.lang.String url)
             throws flex.messaging.io.amf.client.exceptions.ClientStatusException
Connects to the URL provided. Any previous connections are closed.

Parameters:
url - The url to connect to.
Throws:
flex.messaging.io.amf.client.exceptions.ClientStatusException - If there is a client side exception.

generateHttpResponseInfo

protected flex.messaging.io.amf.client.exceptions.ServerStatusException.HttpResponseInfo generateHttpResponseInfo()
Generates the HTTP response info for the server status exception.

Returns:
The HTTP response info for the server status exception.

getResponseURI

protected java.lang.String getResponseURI()
Generates and returns the response URI.

Returns:
The response URI.

internalConnect

protected void internalConnect()
                        throws java.io.IOException
An internal method that sets up the underlying URL connection.

Throws:
java.io.IOException - If an exception is encountered during URL connection setup.

processHttpResponse

protected java.lang.Object processHttpResponse(java.io.InputStream inputStream)
                                        throws java.lang.ClassNotFoundException,
                                               java.io.IOException,
                                               flex.messaging.io.amf.client.exceptions.ClientStatusException,
                                               flex.messaging.io.amf.client.exceptions.ServerStatusException
Processes the HTTP response headers and body.

Throws:
java.lang.ClassNotFoundException
java.io.IOException
flex.messaging.io.amf.client.exceptions.ClientStatusException
flex.messaging.io.amf.client.exceptions.ServerStatusException

processHttpResponseBody

protected java.lang.Object processHttpResponseBody(java.io.InputStream inputStream)
                                            throws java.lang.ClassNotFoundException,
                                                   java.io.IOException,
                                                   flex.messaging.io.amf.client.exceptions.ClientStatusException,
                                                   flex.messaging.io.amf.client.exceptions.ServerStatusException
Processes the HTTP response body.

Throws:
java.lang.ClassNotFoundException
java.io.IOException
flex.messaging.io.amf.client.exceptions.ClientStatusException
flex.messaging.io.amf.client.exceptions.ServerStatusException

processAmfPacket

protected java.lang.Object processAmfPacket(flex.messaging.io.amf.ActionMessage packet)
                                     throws flex.messaging.io.amf.client.exceptions.ClientStatusException,
                                            flex.messaging.io.amf.client.exceptions.ServerStatusException
Processes the AMF packet.

Throws:
flex.messaging.io.amf.client.exceptions.ClientStatusException
flex.messaging.io.amf.client.exceptions.ServerStatusException

processAmfHeaders

protected void processAmfHeaders(java.util.ArrayList<flex.messaging.io.amf.MessageHeader> headers)
                          throws flex.messaging.io.amf.client.exceptions.ClientStatusException
Processes the AMF headers by dispatching them to an AMF header processor, if one exists.

Throws:
flex.messaging.io.amf.client.exceptions.ClientStatusException

processAmfBody

protected java.lang.Object processAmfBody(java.util.ArrayList<flex.messaging.io.amf.MessageBody> messages)
                                   throws flex.messaging.io.amf.client.exceptions.ServerStatusException
Processes the AMF body. Note that this method won't work if batching of AMF messages is supported at some point but for now we are guaranteed to have a single message.

Throws:
flex.messaging.io.amf.client.exceptions.ServerStatusException

send

protected java.lang.Object send(java.io.ByteArrayOutputStream outBuffer)
                         throws java.lang.ClassNotFoundException,
                                java.io.IOException,
                                flex.messaging.io.amf.client.exceptions.ClientStatusException,
                                flex.messaging.io.amf.client.exceptions.ServerStatusException
Writes the output buffer and processes the HTTP response.

Throws:
java.lang.ClassNotFoundException
java.io.IOException
flex.messaging.io.amf.client.exceptions.ClientStatusException
flex.messaging.io.amf.client.exceptions.ServerStatusException

setHttpRequestHeaders

protected void setHttpRequestHeaders()
Sets the Http request headers, including the cookie headers.


registerAlias

public static void registerAlias(java.lang.String alias,
                                 java.lang.String className)
Registers a custom alias for a class name bidirectionally.

Parameters:
alias - The alias for the class name.
className - The concrete class name.


Copyright © 2005-2010 eviware.com. All Rights Reserved.