13.01.2013 Views

Connecting to PaymentTrust's Secure Transaction Network - WorldPay

Connecting to PaymentTrust's Secure Transaction Network - WorldPay

Connecting to PaymentTrust's Secure Transaction Network - WorldPay

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Used^3~MerchantId^100000~UserName^Mariah~UserPassword^rr87uy~<strong>Transaction</strong>Type^RG~I<br />

sTest^1~TimeOut^60000~MOP^CC~AcctName^John<br />

Smith~AcctNumber^4459510002561039~ExpDate^092010~CurrencyId^840~Amount^56.78~Firs<br />

tName^John~LastName^Smith~Address1^2130 Gold~City^New<br />

York~CountryCode^US~PhoneNumber^6188565656~REMOTE_ADDR^205.188.146.23"));<br />

274<br />

// THE HTTP GET and POST methods are sent differently <strong>to</strong> the HTTP server.<br />

// There for we must build the final query string <strong>to</strong> the specifications of<br />

// each method.<br />

//<br />

// The query string for the GET method is part of the HTTP header. To separate<br />

// the query string from the URL location we use '?'. POST does not require<br />

// this since it is sent <strong>to</strong> the HTTP server after the HTTP headers.<br />

String getString = new String("?StringIn=" + transaction);<br />

String postString = new String("StringIn=" + transaction);<br />

try<br />

{<br />

// The URL class is used <strong>to</strong> connect <strong>to</strong> the HTTP server.<br />

URL url = null;<br />

// The URLConnection is an abstract class and provides more functionality then<br />

// the URL class.<br />

URLConnection urlConnection = null;<br />

// The Buffered writer and reader <strong>to</strong> send and receive data <strong>to</strong> the HTTP server.<br />

BufferedWriter out = null;<br />

BufferedReader in = null;<br />

// Proceed according <strong>to</strong> the HTTP method <strong>to</strong> be used.<br />

if(httpMethod.equals("GET"))<br />

{<br />

// Build the final URL <strong>to</strong> the HTTP server.<br />

url = new URL(urlLocation + getString);<br />

try<br />

{<br />

// Connect <strong>to</strong> the server.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!