com.google.api.ads.common.lib.soap.testing
Class TestHandler

java.lang.Object
  extended by com.google.api.ads.common.lib.soap.SoapClientHandler<Object>
      extended by com.google.api.ads.common.lib.soap.testing.TestHandler
All Implemented Interfaces:
SoapClientHandlerInterface<Object>

public class TestHandler
extends SoapClientHandler<Object>

Test SOAP Client Handler implementation.

Author:
Joseph DiLallo

Constructor Summary
TestHandler()
           
 
Method Summary
 void clearHeaders(Object soapClient)
          Clears all of the SOAP headers from the given SOAP client.
 Object createSoapClient(SoapServiceDescriptor soapServiceDescriptor)
          Creates a SOAP client using a SOAP service descriptor.
 javax.xml.soap.SOAPHeaderElement createSoapHeaderElement(QName qName)
          Creates a SOAP header element object specific to the framework that this handler works with.
 String getEndpointAddress(Object soapClient)
          Gets the endpoint address on the SOAP client.
 Object getHeader(Object soapClient, String headerName)
          Returns a SOAP header from the given SOAP client, if it exists.
 SoapCallReturn invokeSoapCall(SoapCall<Object> soapCall)
          Invoke a SOAP call.
 void putAllHttpHeaders(Object soapClient, Map<String,String> headersMap)
          Puts all headers into the existing HTTP headers of the SOAP client, overwriting any existing header keys.
 void setCompression(Object soapClient, boolean compress)
          Set whether SOAP requests should use compression.
 void setEndpointAddress(Object soapClient, String endpointAddress)
          Sets the endpoint address of the given SOAP client.
 void setHeader(Object soapClient, String namespace, String headerName, Object headerValue)
          Sets a SOAP header for the given SOAP client.
 
Methods inherited from class com.google.api.ads.common.lib.soap.SoapClientHandler
getSoapClientMethod, invoke, processSoapArguments
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestHandler

public TestHandler()
Method Detail

setEndpointAddress

public void setEndpointAddress(Object soapClient,
                               String endpointAddress)
Sets the endpoint address of the given SOAP client.

Parameters:
soapClient - the SOAP client to set the endpoint address for
endpointAddress - the target endpoint address

getHeader

public Object getHeader(Object soapClient,
                        String headerName)
Returns a SOAP header from the given SOAP client, if it exists.

Parameters:
soapClient - the SOAP client to check for the given header
headerName - the name of the header being looked for
Returns:
the header element, if it exists

clearHeaders

public void clearHeaders(Object soapClient)
Clears all of the SOAP headers from the given SOAP client.

Parameters:
soapClient - the client to remove the headers from

setHeader

public void setHeader(Object soapClient,
                      String namespace,
                      String headerName,
                      Object headerValue)
Sets a SOAP header for the given SOAP client.

Parameters:
soapClient - the client to receive the given header
namespace - the namespace the header belongs to
headerName - the name of the header to set
headerValue - the value that the header should have
Throws:
ServiceException - thrown if the headers could not be set

setCompression

public void setCompression(Object soapClient,
                           boolean compress)
Set whether SOAP requests should use compression.

Parameters:
soapClient - the client to set compression settings for
compress - whether or not to use compression

createSoapClient

public Object createSoapClient(SoapServiceDescriptor soapServiceDescriptor)
                        throws ServiceException
Creates a SOAP client using a SOAP service descriptor.

Parameters:
soapServiceDescriptor - the descriptor to use for creating a client
Returns:
the SOAP client for this descriptor
Throws:
ServiceException - thrown if the SOAP client cannot be created

invokeSoapCall

public SoapCallReturn invokeSoapCall(SoapCall<Object> soapCall)
Invoke a SOAP call.

Parameters:
soapCall - the call to make to a SOAP web service
Returns:
information about the SOAP response

createSoapHeaderElement

public javax.xml.soap.SOAPHeaderElement createSoapHeaderElement(QName qName)
Description copied from interface: SoapClientHandlerInterface
Creates a SOAP header element object specific to the framework that this handler works with.

Parameters:
qName - qualified name of the header element
Returns:
a new SOAP header element object
See Also:
createSoapHeaderElement(javax.xml.namespace.QName)

getEndpointAddress

public String getEndpointAddress(Object soapClient)
Description copied from interface: SoapClientHandlerInterface
Gets the endpoint address on the SOAP client.

Returns:
the endpoint address
See Also:
getEndpointAddress(java.lang.Object)

putAllHttpHeaders

public void putAllHttpHeaders(Object soapClient,
                              Map<String,String> headersMap)
Description copied from interface: SoapClientHandlerInterface
Puts all headers into the existing HTTP headers of the SOAP client, overwriting any existing header keys.

Parameters:
soapClient - the SOAP client to set the headers on
headersMap - the map of headers in the form of header name to value
See Also:
putAllHttpHeaders(java.lang.Object, java.util.Map)


Copyright © 2012. All Rights Reserved.