SpawnSession
- Method
SlimCD.Sessions.SpawnSession
Purpose
Spawn a new sessionid from an old one.
Description
sessionid
amountBusiness Rules
Argument List
Name Required Usage SpawnSessionRequest Required Object containing properties for the request timeout Optional Integer wait time, in seconds, before timeout response is generated callback* Optional Function to call upon completion of asynchronous request *for JavaScript only
SpawnSession Request Fields
Field Name Type Length Required Description SessionID string 40 require HEX string uniquely representing the session . Amount string 20 require Amount of the transaction. 1. Passwords are required except when the username is set to an API Access Credential, in which case it should be passed in as an empty string.
Reply Fields
reply outer tag for the reply data block response Success, FAIL, Error response code 0, 1, 2 (respective) matching the above reponseurl The Slimcd.com url which was called for this operation description If successful, this will contain the single word, OK. Otherwise it will contain a description of failure or error which occurred reponseurl The Slimcd.com url which was called for this operation datablock The confirmation text returned from the server. Reply Hierarchy
- reply
- response
- responsecode
- description
- responseurl
- datablock
Remarks
- General
- Names in name/value pairs are NOT case-sensitive
- Names inside XML tags ARE case-sensitive
- Function-Specific
- None
- reply
- Include
012<script src="https://trans.slimcd.com/soft/json/slimcd.js"></script>
Method
12345function SpawnSession(request,callback)function SpawnSession(request,timeout,callback)
Request
123456request= {"sessionid": "5A380D260C67BA229484AB557B41DF2CBBED3090","amount": ""}
Reply
1234567891011callback ( {"response": "Success","responsecode": "0","description": "OK","responseurl": "/soft/SpawnSession.asp","datablock": {"sessionid": "85F9FA841DDB173B10AD35E0B9EA097E9CC68321"}} );
Sample Code
1234567891011121314151617<script src="https://trans.slimcd.com/soft/json/slimcd.js"></script><script>// <![CDATA[SlimCD.Sessions.SpawnSession({"sessionid": "5A380D260C67BA229484AB557B41DF2CBBED3090","amount": ""},function (reply) {if (reply.response == "Success") {alert ('Batch Closed');} else {alert('There was a problem closing the batch:\r\n' + reply.description);}});// ]]></script>
Downloads
- Include
012include 'slimcd.php';
Method
123function Sessions_SpawnSessions(Sessions_SpawnSessionsRequest $request,$timeout=false)Request
123456789class Sessions_SpawnSessionsRequest{// property declarationpublic $SessionID = '';public $amount = '';}JSON Reply
123456789101112131415{"response": "Success","responsecode": "0","description": "OK","responseurl": "/soft/SpawnSession.asp","datablock": {"sessionid": "6C29A1C5FB450D6642AC8ECE85768149131BB32D"}}Sample Code
1234567891011121314include 'slimcd.php';// Create the Slim CD object$SlimCD = new SlimCD() ;// Create a SpawnSessions Request class$request = new Sessions_SpawnSessionsRequest() ;$request->SessionID = "6B9AC5C22EF62BB46EDBC2D2C49215D1157E3439";$request->amount = '';$result = $SlimCD->Sessions_SpawnSessions($request);Downloads Download full sample source.
- Include
123using SlimCD;
Method
123public SpawnSessionReply SpawnSession(SpawnSessionRequest request, int timeout);
Request
1234567public class SpawnSessionRequest{public string sessionid { get; set; }public string amount { get; set; }}
Reply
123456789101112public class SpawnSessionReply{public string response;public string responsecode;public string description;public string responseurl;public string sessionid;public string senddata;public string recvdata;}
Cross Reference: ClientSample Code
12345678910111213141516171819SlimCD.Sessions sessions = new SlimCD.Sessions();sessions.debug = true;sessions.transURL = TransURL;sessions.statsURL = StatsURL;SpawnSessionRequest request = new SpawnSessionRequest();SpawnSessionReply reply = new SpawnSessionReply();request.sessionid = "6B9AC5C22EF62BB46EDBC2D2C49215D1157E3439";request.amount = 10.00;reply = sessions.SpawnSession(request, 60);if (reply.response.ToUpper() == "SUCCESS"){MessageBox.Show("Success");}else{MessageBox.Show("There was a problem:\n(" + reply.response & ") " + reply.description);}Downloads
Download full sample source. - Include
123using SlimCD;
Method
012public async Task SpawnSession(SpawnSessionRequest request, int timeout);
Request
1234567public class SpawnSessionRequest{public string sessionid { get; set; }public string amount { get; set; }}
Reply
123456789101112public class SpawnSessionReply{public string response;public string responsecode;public string description;public string responseurl;public string sessionid;public string senddata;public string recvdata;}
Cross Reference: ClientSample Code
12345678910111213141516171819SlimCD.Sessions sessions = new SlimCD.Sessions();sessions.debug = true;sessions.transURL = TransURL;sessions.statsURL = StatsURL;SpawnSessionRequest request = new SpawnSessionRequest();SpawnSessionReply reply = new SpawnSessionReply();request.sessionid = "6B9AC5C22EF62BB46EDBC2D2C49215D1157E3439";request.amount = 10.00;reply = await sessions.SpawnSession(request, 60);if (reply.response.ToUpper() == "SUCCESS"){MessageBox.Show("Success");}else{MessageBox.Show("There was a problem:\n(" + reply.response & ") " + reply.description);}Downloads Download full sample source.
- Include
1#import "SlimCD.h"
Method
1234567typedef void (^SessionsSpawnSessionReplyBlock)(SessionsSpawnSessionReply *reply);- (void) sessionsSpawnSessionWithRequest:(SessionsSpawnSessionRequest*)request replyBlock:(SessionsSpawnSessionReplyBlock)replyBlock;- (void) sessionsSpawnSessionWithRequest:(SessionsSpawnSessionRequest*)request timeout:(NSTimeInterval)timeout replyBlock:(SessionsSpawnSessionReplyBlock)replyBlock;request
123456@interface SessionsSpawnSessionRequest : SlimCDRequest@property (strong) NSString *sessionID;@property (strong) NSNumber *amount;@endReply
12345@interface SessionsSpawnSessionReply : SlimCDReply@property (strong) NSString *sessionID;@endSample Code
1234567891011121314151617SlimCD *api = [[SlimCD alloc] init];SessionsSpawnSessionRequest *request = [[SessionsSpawnSessionRequest alloc] init];request.sessionID = @"12345";request.amount = @123.45;[api sessionsSpawnSessionWithRequest:request replyBlock:^(SessionsSpawnSessionReply *reply ){if ( reply.responseCode == RC_SUCCESS ){NSLog(@"Session spawned successfully.");}else{NSLog(@"Unable to spawn session.");}}]; - Method
1234567public void getSpawnSession(SpawnSessionRequestsessionSpawnRequest,int timeout , SpawnSessionCallback callback)public void getSpawnSession(SpawnSessionRequest sessionSpawnRequest,SpawnSessionCallback callback)
Request
1234567891011121314151617181920212223242526272829303132public class SpawnSessionRequest {// request parameter.private String sessionid;private String amount;public SpawnSessionRequest(){sessionid="";amount="";}// setter and getters.public String getSessionid() {return sessionid;}public void setSessionid(String sessionid) {this.sessionid = sessionid;}public String getAmount() {return amount;}public void setAmount(String amount) {this.amount = amount;}}Reply
12345678910111213141516public class SpawnSessionReply {// response.private String sessionid="";// setter and getter.public String getSessionid() {return sessionid;}public void setSessionid(String sessionid) {this.sessionid = sessionid;}}Sample Code
123456789101112131415161718192021222324// Set the request parameter.SpawnSessionRequest request=new SpawnSessionRequest();request.getAmount();request.setSessionid("5A380D260C67BA229484AB557B41DF2CBBED3090");new SessionSpawnSession().getSpawnSession(request,new SpawnSessionCallback() {@Overridepublic void getSpawnSessionReply(SpawnSessionReply reply) {if (reply.getResponse().equals("Success"))textBox.setText("Success");elsetextBox.setText("There was a problem:\n" + reply.getResponse() +"\n Descriptin "+ reply.getDescription());}});Downloads
Download full sample source. - URL
Protocols
- SOAP/XML
- HTTP POST
- HTTP GET
Request
Status Codes
Status Code Status Description Explanation 200 200 OK Approved or declined attempts will return a response with an XML reply block 500 500 Internal Server Error The response will not contain XML, as a server error has occurred. Reply Output is in XML format if a status code of 200 is returned.
1234<!--?xml version="1.0" encoding="utf-8" ?-->Output will be an HTML codeIf the block’s tag does not indicate “Success”, the tag will contain an error description which can be displayed to the end-user
Sample Code
Simple HTML form to show SpawnSession
Remarks
- Remarks Go here
- URL
123https://stats.slimcd.com/soft/json/jsonscript.asp?service=SpawnSession
Protocols- HTTP POST
- HTTP GET
This function accepts either name/value pairs or JSON
Request
Reply
1234567891011{"response": "Success","responsecode": "0","description": "OK","responseurl": "/soft/SpawnSession.asp","datablock": {"sessionid": "85F9FA841DDB173B10AD35E0B9EA097E9CC68321"}}Sample Code
Remarks
- None