org.ksoap2.transport
Class Transport

java.lang.Object
  extended by org.ksoap2.transport.Transport

public abstract class Transport
extends Object

Abstract class which holds common methods and members that are used by the transport layers. This class encapsulates the serialization and deserialization of the soap messages, leaving the basic communication routines to the subclasses.


Field Summary
 boolean debug
          Set to true if debugging
protected  Proxy proxy
          Added to enable web service interactions on the emulator to be debugged with Fiddler2 (Windows) but provides utility for other proxy requirements.
 String requestDump
          String dump of request for debugging.
 String responseDump
          String dump of response for debugging
protected  int timeout
           
protected  String url
           
 
Constructor Summary
Transport()
           
Transport(Proxy proxy, String url)
          Construct the transport object
Transport(String url)
           
Transport(String url, int timeout)
           
 
Method Summary
 void call(String targetNamespace, SoapEnvelope envelope)
          Perform a soap call with a given namespace and the given envelope.
abstract  List call(String targetNamespace, SoapEnvelope envelope, List headers)
          Perform a soap call with a given namespace and the given envelope providing any extra headers that the user requires such as cookies.
protected  byte[] createRequestData(SoapEnvelope envelope)
          Serializes the request.
abstract  String getHost()
          Return the name of the host that is specified as the web service target
abstract  String getPath()
          Return the path to the web service target
abstract  int getPort()
          Return the port number of the host that is specified as the web service target
protected  void parseResponse(SoapEnvelope envelope, InputStream is)
          Sets up the parsing to hand over to the envelope to deserialize.
 void reset()
          Attempts to reset the connection.
 void setUrl(String url)
          Set the target url.
 void setXmlVersionTag(String tag)
          Sets the version tag for the outgoing soap call.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

proxy

protected Proxy proxy
Added to enable web service interactions on the emulator to be debugged with Fiddler2 (Windows) but provides utility for other proxy requirements.


url

protected String url

timeout

protected int timeout

debug

public boolean debug
Set to true if debugging


requestDump

public String requestDump
String dump of request for debugging.


responseDump

public String responseDump
String dump of response for debugging

Constructor Detail

Transport

public Transport()

Transport

public Transport(String url)

Transport

public Transport(String url,
                 int timeout)

Transport

public Transport(Proxy proxy,
                 String url)
Construct the transport object

Parameters:
proxy - Specifies the proxy server to use for accessing the web service or null if a direct connection is available
url - Specifies the web service url
Method Detail

parseResponse

protected void parseResponse(SoapEnvelope envelope,
                             InputStream is)
                      throws org.xmlpull.v1.XmlPullParserException,
                             IOException
Sets up the parsing to hand over to the envelope to deserialize.

Throws:
org.xmlpull.v1.XmlPullParserException
IOException

createRequestData

protected byte[] createRequestData(SoapEnvelope envelope)
                            throws IOException
Serializes the request.

Throws:
IOException

setUrl

public void setUrl(String url)
Set the target url.

Parameters:
url - the target url.

setXmlVersionTag

public void setXmlVersionTag(String tag)
Sets the version tag for the outgoing soap call. Example

Parameters:
tag - the xml string to set at the top of the soap message.

reset

public void reset()
Attempts to reset the connection.


call

public abstract List call(String targetNamespace,
                          SoapEnvelope envelope,
                          List headers)
                   throws IOException,
                          org.xmlpull.v1.XmlPullParserException
Perform a soap call with a given namespace and the given envelope providing any extra headers that the user requires such as cookies. Headers that are returned by the web service will be returned to the caller in the form of a List of HeaderProperty instances.

Parameters:
targetNamespace - the namespace with which to perform the call in.
envelope - the envelope the contains the information for the call.
headers - List of HeaderProperty headers to send with the SOAP request.
Returns:
Headers returned by the web service as a List of HeaderProperty instances.
Throws:
IOException
org.xmlpull.v1.XmlPullParserException

call

public void call(String targetNamespace,
                 SoapEnvelope envelope)
          throws IOException,
                 org.xmlpull.v1.XmlPullParserException
Perform a soap call with a given namespace and the given envelope.

Parameters:
targetNamespace - the namespace with which to perform the call in.
envelope - the envelope the contains the information for the call.
Throws:
IOException
org.xmlpull.v1.XmlPullParserException

getHost

public abstract String getHost()
Return the name of the host that is specified as the web service target

Returns:
Host name

getPort

public abstract int getPort()
Return the port number of the host that is specified as the web service target

Returns:
Port number

getPath

public abstract String getPath()
Return the path to the web service target

Returns:
The URL's path


Copyright © 2002-2011. All Rights Reserved.