ca.infoway.messagebuilder.transport.rest
Class RestTransportLayer

Package class diagram package RestTransportLayer
java.lang.Object
  extended by ca.infoway.messagebuilder.transport.rest.RestTransportLayer
All Implemented Interfaces:
TransportLayer

public class RestTransportLayer
extends Object
implements TransportLayer

Implementation of a transport layer for REST (Representational State Transfer). REST is one of two common interfaces for HL7 messages. HL7 messages are POSTed to an HTTP server.

Makes use of Apache Commons HttpClient for communication.

Author:
Intelliware Development

Constructor Summary
RestTransportLayer(Client client, String url)
          Constructs a REST transport layer for the given url.
RestTransportLayer(String url)
          Constructs a REST transport layer for the given url.
 
Method Summary
protected  org.apache.commons.httpclient.methods.PostMethod createPostMethod()
           
 String sendRequestAndGetResponse(CredentialsProvider credentialsProvider, RequestMessage requestMessage)
          Sends a request message synchronously and returns a response message as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestTransportLayer

public RestTransportLayer(String url)

Constructs a REST transport layer for the given url. Makes use of the default tranport mechanism (HttpClient)

Parameters:
url - the target url to send messages to

RestTransportLayer

public RestTransportLayer(Client client,
                          String url)

Constructs a REST transport layer for the given url. Makes use of provided client instead of the default HttpClient.

Parameters:
client - the transport client to use
url - the target url to send messages to
Method Detail

sendRequestAndGetResponse

public String sendRequestAndGetResponse(CredentialsProvider credentialsProvider,
                                        RequestMessage requestMessage)

Sends a request message synchronously and returns a response message as a string.

Specified by:
sendRequestAndGetResponse in interface TransportLayer
Parameters:
credentialsProvider - object to obtain Credentials from
requestMessage - the message to be sent
Returns:
the response message as a string

createPostMethod

protected org.apache.commons.httpclient.methods.PostMethod createPostMethod()


Copyright © 2013. All Rights Reserved.