mymobilesite.communication
Class WspRequest
java.lang.Object
org.ksoap2.SoapEnvelope
mymobilesite.communication.LibertyMessage
mymobilesite.communication.WspRequest
public class WspRequest
- extends LibertyMessage
This class is responsible for constructing and sending the requests for the Web Service
Provider chosen by the user. Furthermore it processes the response from the WSP and creates
a list of Services based on the response.
- Author:
- Gunn Olaussen & Kirsti N. Torgersen
Fields inherited from class org.ksoap2.SoapEnvelope |
bodyIn, bodyOut, enc, ENC, ENC2001, encodingStyle, env, ENV, ENV2001, headerIn, headerOut, VER10, VER11, VER12, version, xsd, XSD, XSD1999, xsi, XSI, XSI1999 |
Constructor Summary |
WspRequest(ResourceOffering offering)
The constructor creates a WspRequest object based on the ResourceOffering. |
Method Summary |
private void |
createBody()
Creates the request to be sent to the Web Service Provider. |
HttpTransport |
createTransport()
This method creates the transport that will be used in the communication with the Web
Service Provider. |
protected void |
processResponse(Element current)
This method processes the current element and stores the Services so that they can be
returned to the LibertyProtocol |
Service[] |
sendRequest()
This method constructs the request, sends it and processes the response. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
session
private HttpTransport session
services
private Service[] services
WspRequest
public WspRequest(ResourceOffering offering)
- The constructor creates a WspRequest object based on the ResourceOffering.
- Parameters:
offering
- ResourceOffering The ResouceOffering containing the url and token for
the Web Service Provider.
createTransport
public HttpTransport createTransport()
- This method creates the transport that will be used in the communication with the Web
Service Provider.
- Returns:
- HttpTransport The transport that will be used by this class to send the query
and receive the response.
sendRequest
public Service[] sendRequest()
throws MessageException
- This method constructs the request, sends it and processes the response.
- Returns:
- Service[] A list of the Services returned from the WSP, containing service
names, labels and values.
- Throws:
MessageException
- If something wrong happens, an exception with the appropriate
error code is thrown.
createBody
private void createBody()
- Creates the request to be sent to the Web Service Provider.
processResponse
protected void processResponse(Element current)
throws MessageException
- This method processes the current element and stores the Services so that they can be
returned to the LibertyProtocol
- Specified by:
processResponse
in class LibertyMessage
- Parameters:
current
- Element The element that is to be processed.
- Throws:
MessageException
- If there are no results or the message is invalid.