com.google.api.ads.common.lib.soap
Interface SoapClientHandlerInterface<T>

Type Parameters:
T - the SOAP client type
All Known Implementing Classes:
SoapClientHandler

public interface SoapClientHandlerInterface<T>

Interface for SOAP client handlers. Instances of SoapServiceClient use this handlers implementing these methods to interact with SOAP clients from different frameworks. There is separate handler for each framework that implements this interface.

Author:
Adam Rogal

Method Summary
 void clearHeaders(T soapClient)
          Clears the headers of the SOAP client.
 T createSoapClient(SoapServiceDescriptor soapServiceDescriptor)
          Creates a SOAP client using the soapServiceDescriptor.
 javax.xml.soap.SOAPHeaderElement createSoapHeaderElement(QName qName)
          Creates a SOAP header element object specific to the framework that this handler works with.
 String getEndpointAddress(T soapClient)
          Gets the endpoint address on the SOAP client.
 Object getHeader(T soapClient, String headerName)
          Gets the value of a header given the SOAP client and the header name.
 Method getSoapClientMethod(T soapClient, Method method)
          Gets the method from the SOAP client that matches the supplied method.
 SoapCallReturn invokeSoapCall(SoapCall<T> soapCall)
          Executes the SoapCall, which has a reference to a SoapClientHandlerInterface.
 void putAllHttpHeaders(T soapClient, Map<String,String> headersMap)
          Puts all headers into the existing HTTP headers of the SOAP client, overwriting any existing header keys.
 void setCompression(T soapClient, boolean compress)
          Sets if the SOAP client should use compression.
 void setEndpointAddress(T soapClient, String endpointAddress)
          Sets the endpoint address on the SOAP client.
 void setHeader(T soapClient, String namespace, String headerName, Object headerValue)
          Sets a header on the SOAP client.
 

Method Detail

createSoapClient

T createSoapClient(SoapServiceDescriptor soapServiceDescriptor)
                   throws ServiceException
Creates a SOAP client using the soapServiceDescriptor.

Parameters:
soapServiceDescriptor - the service descriptor describing the service that the SOAP client will be stubbed against
Returns:
an instantiated SOAP client in the framework on this handler
Throws:
ServiceException - if there as a problem creating the SOAP client

invokeSoapCall

SoapCallReturn invokeSoapCall(SoapCall<T> soapCall)
Executes the SoapCall, which has a reference to a SoapClientHandlerInterface.

Parameters:
soapCall - the SoapCall to execute
Returns:
the result from the call to the SOAP client

setEndpointAddress

void setEndpointAddress(T soapClient,
                        String endpointAddress)
Sets the endpoint address on the SOAP client.


getEndpointAddress

String getEndpointAddress(T soapClient)
Gets the endpoint address on the SOAP client.

Returns:
the endpoint address

clearHeaders

void clearHeaders(T soapClient)
Clears the headers of the SOAP client.


createSoapHeaderElement

javax.xml.soap.SOAPHeaderElement createSoapHeaderElement(QName qName)
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

setHeader

void setHeader(T soapClient,
               String namespace,
               String headerName,
               Object headerValue)
               throws ServiceException
Sets a header on the SOAP client.

Parameters:
soapClient - the SOAP client to set the header of
namespace - the namespace of the header
headerName - the name of the header
headerValue - the value of the header
Throws:
ServiceException - if there was a problem setting the header

putAllHttpHeaders

void putAllHttpHeaders(T soapClient,
                       Map<String,String> headersMap)
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

getHeader

Object getHeader(T soapClient,
                 String headerName)
Gets the value of a header given the SOAP client and the header name.


setCompression

void setCompression(T soapClient,
                    boolean compress)
Sets if the SOAP client should use compression. This method should fail gracefully in the event that the SOAP framework does not support compression.


getSoapClientMethod

Method getSoapClientMethod(T soapClient,
                           Method method)
                           throws NoSuchMethodException
Gets the method from the SOAP client that matches the supplied method.

In the default implementation, only the method name and return type will be matched.

Parameters:
soapClient - the SOAP client within which to search for the method
method - the method to match
Returns:
the SOAP client's matching method
Throws:
NoSuchMethodException - thrown if the SOAP client does not contain the requested method.


Copyright © 2012. All Rights Reserved.