Sun Nov 17, 2019 10:55 am
Login Register Lost Password? Contact Us


ESP Soap to generate Transaction ID

Questions around writing code and queries

Wed Oct 09, 2019 4:39 am Change Time Zone

Hi,
can you please help to understand how can to make call to ESP via Thor/Roxie to fetch data as ESP user will user name password associated ,Couldn't find soap call with such example where it takes this as params.

URL :- http://10.224.105.125:7280/WsUtility/Ge ... oductCode={0}&NumberToGenerate={1}
EspUserName:- XXXXX
EspPassword:- XXXXX
How to can i fetch TransactionID same in soap call respective
<GetTransactionIdentifierResponse><TransactionIDs><TransactionID>XXXPPPAAAYV</TransactionID></TransactionIDs></GetTransactionIdentifierResponse>
harshdesai
 
Posts: 15
Joined: Fri Feb 23, 2018 8:30 am

Wed Oct 09, 2019 1:54 pm Change Time Zone

There are two ways you can pass credentials through SOAPCALL.

1. Insert the credentials into the URL string. Gather the credentials from wherever they are stored and add them to the url in the following format:

https://username:password@address:port/whatever

2. Add the HTTP authentication header yourself:

MY_USERNAME := TRIM(username, ALL);
MY_USER_PW := TRIM(userPW, LEFT, RIGHT);

ENCODED_BASIC_CREDENTIALS := IF (
MY_USERNAME != '',
'Basic ' + Std.Str.EncodeBase64((DATA)(MY_USERNAME + ':' + MY_USER_PW)),
''
);

soapResponse := SOAPCALL(ds, ip, svc, inRecord, t(LEFT),DATASET(outRecord), ONFAIL(SKIP), HTTPHEADER('Authorization',ENCODED_BASIC_CREDENTIALS));
anthony.fishbeck
 
Posts: 57
Joined: Wed Jan 30, 2013 10:18 pm

Sat Nov 02, 2019 8:01 am Change Time Zone

Thanks it worked in generating 1 ESP transaction ID.
Currently i am trying to fetch in bulk so can update accordingly against each record.

// #WORKUNIT('name','GetTransactionID_BasicAuth');
EXPORT GetTransactionID_BasicAuth() := FUNCTION
rRequest := RECORD
STRING DummyField := '';
END;

rTransactionId := RECORD
STRING TransactionID {xpath('TransactionID')};
END;


rReponse := RECORD
Dataset(rTransactionId) TransactionIDs {xpath('TransactionIDs')};

END;

STRING IP := '10.224.XX.XXX';
STRING Port := '72XX';
STRING URL := 'http://' + IP + ':' + Port + '/WsUtility/GetTransactionIdentifier/?ver_=1.81';

//Input Credentials
STRING Username_Val := 'XXXXX';
STRING Password_Val := 'XXXX';

STRING1 _encodeSep := ':';

//Base64 encoding
credentialData := (DATA)(Username_Val + _encodeSep + Password_Val);
base64BasicAccessAuth := Base64.encode_data(credentialData);
STRING HTTPHEADER_VAL := 'Basic ' + (STRING) base64BasicAccessAuth;

lResponse := soapcall(URL,
'GetTransactionIdentifier',
rRequest,
rReponse,
XPATH('GetTransactionIdentifierResponse'),
HTTPHEADER('Authorization', HTTPHEADER_VAL)
);

RETURN lResponse.TransactionIDs;




copy_Record :=
record
string50 product_transaction_id;
string policy_sequence_id;
string25 application_number;
string25 policy_number;
string plan_type;
string policy_term;
string current_sum_assured;
string date_added;
string60 user_added;
end;

copy_Dataset :=
dataset([
{'', '1', 'OS00205370 ', '18491348 ', 'EN', '15', '140000.00', '2019-10-30 05:58:22', 'esprili_batch_prod '},
{'', '1', 'LL41908432 ', '15448125 ', 'EN', '10', '115000.00', '2019-10-30 05:58:14', 'esprili_batch_prod '},
], copy_Record);
copy_Dataset;

DS_transaction_log_request_policy := project(copy_Dataset,transform(copy_Record,
self.product_transaction_id := GetTransactionID_BasicAuth() ;
self.policy_sequence_id := Left.policy_sequence_id;
self.application_number := Left.application_number;
self.policy_number := Left.policy_number;
self.policy_term := Left.policy_term;
self.current_sum_assured := Left.current_sum_assured;
self.user_added := Left.user_added;
self.plan_type := Left.plan_type;
self.date_added := Left.date_added;
));
DS_transaction_log_request_policy;

When i try to call in the below transform i get only one esp id .. Ideally since its in transform it should make 10 soap calls,but not able to fetch all 10 ,Even in Graph it says only one SOAP is made which is correct as its fetching in Bulk but i am not able to read the same .
Even tried using (http://10.224.XX.XXX:XXXX/WsUtility/Get ... Generate=5) this generates 5 transaction id at once but how can i fetch in dataset or accept this values .

EG :- Below is when URL is directly called from browser.
http://10.224.XX.XXX:XXXX/WsUtility/Get ... oGenerate={1}

<GetTransactionIdentifierResponse>
<TransactionIDs>
<TransactionID>Ec4vHrw7LF6h7Ry5MmB2SL</TransactionID>
</TransactionIDs>
</GetTransactionIdentifierResponse>

http://10.224.XX.XXX:XXXX/WsUtility/Get ... Generate=5

<GetTransactionIdentifierResponse>
<TransactionIDs>
<TransactionID>Ec5rkFZ83H3x8T6GEg66qe</TransactionID>
<TransactionID>Ec5rkFaBZyjjW2aY7p7Yaz</TransactionID>
<TransactionID>Ec5rkFbYM5GpAMgpFS1t8U</TransactionID>
<TransactionID>Ec5rkFcpazkzYK5zkQHccx</TransactionID>
<TransactionID>Ec5rkFc6Ah5hks3xsJQt7n</TransactionID>
</TransactionIDs>
</GetTransactionIdentifierResponse>

How can i use this .

Regards
Harsh
Last edited by harshdesai on Mon Nov 04, 2019 4:01 am, edited 1 time in total.
harshdesai
 
Posts: 15
Joined: Fri Feb 23, 2018 8:30 am

Sun Nov 03, 2019 10:04 pm Change Time Zone

I think because of the way to specify the resulting dataset

Code: Select all
rReponse := RECORD
Dataset(rTransactionId) TransactionIDs {xpath('TransactionIDs')};
END;

it is looking for:

Code: Select all
<GetTransactionIdentifierResponse>
<TransactionIDs>
  <TransactionID>Ec5rkFZ83H3x8T6GEg66qe</TransactionID>
</TransactionIDs>
<TransactionIDs>
  <TransactionID>Ec5rkFaBZyjjW2aY7p7Yaz</TransactionID>
</TransactionIDs>
<TransactionIDs>
  <TransactionID>Ec5rkFbYM5GpAMgpFS1t8U</TransactionID>
</TransactionIDs>
<TransactionIDs>
  <TransactionID>Ec5rkFcpazkzYK5zkQHccx</TransactionID>
</TransactionIDs>
<TransactionIDs>
  <TransactionID>Ec5rkFc6Ah5hks3xsJQt7n</TransactionID>
</TransactionIDs>
</GetTransactionIdentifierResponse>


The easiest thing would probably be for you to use a set of strings:
Code: Select all
rReponse := RECORD
SET OF STRING TransactionIDs {xpath('TransactionIDs/TransactionID')};
END;
anthony.fishbeck
 
Posts: 57
Joined: Wed Jan 30, 2013 10:18 pm

Mon Nov 04, 2019 4:09 am Change Time Zone

EXPORT GetTransactionID_BasicAuth() := FUNCTION
rRequest := RECORD
STRING DummyField := '';
END;


rReponse := RECORD
SET OF STRING TransactionIDs {xpath('TransactionIDs/TransactionID')};
END;


STRING URL := 'http://10.224.105.XX:XXXX/WsUtility/GetTransactionIdentifier/?ver_=1.81&NumberToGenerate=5';

//Input Credentials
STRING Username_Val := 'iXXXX_dev';
STRING Password_Val := '1XXsDev';

STRING1 _encodeSep := ':';

//Base64 encoding
credentialData := (DATA)(Username_Val + _encodeSep + Password_Val);
base64BasicAccessAuth := Base64.encode_data(credentialData);
STRING HTTPHEADER_VAL := 'Basic ' + (STRING) base64BasicAccessAuth;

lResponse := soapcall(URL,
'GetTransactionIdentifier',
rRequest,
rReponse,
XPATH('GetTransactionIdentifierResponse'),
HTTPHEADER('Authorization', HTTPHEADER_VAL)
);

RETURN lResponse;

END;
GetTransactionID_BasicAuth();


Tried as suggested didn't work still give me only one values in output
harshdesai
 
Posts: 15
Joined: Fri Feb 23, 2018 8:30 am

Mon Nov 04, 2019 11:00 pm Change Time Zone

Harsh,

You seem to be mixing SOAP and URL parameters. We may support this some places, but it's not usually the best way.

Try passing NumberToGenerate as a soap parameter instead:

rRequest := RECORD
INTEGER1 NumberToGenerate {xpath('NumberToGenerate')} := 5;
END;

Note that the xpath is important to make sure we preserve case in the variable name ECL is itself case insensitive.

Let me know if it works:

regards,
Tony
anthony.fishbeck
 
Posts: 57
Joined: Wed Jan 30, 2013 10:18 pm

Fri Nov 08, 2019 11:16 am Change Time Zone

Tried using httpcall and its working and generating at once to be used
IMPORT STD, india_ecl_common.ut.Base64;


// #WORKUNIT('name','GetTransactionID_BasicAuth');
EXPORT GetTransactionID_BasicAuth() := FUNCTION
rRequest := RECORD
STRING DummyField := '';
END;

rTransactionId := RECORD
STRING TransactionID {xpath('TransactionID')};
END;


rReponse := RECORD
SET OF STRING TransactionIDs {xpath('TransactionIDs/TransactionID')};
END;

/* rGetTransactionIdentifierResponse := RECORD
rReponse GetTransactionIdentifierResponse {xpath('GetTransactionIdentifierResponse')};
END;
*/

STRING IP := '10.224.105.125';
STRING Port := '7280';
STRING URL := 'http://' + IP + ':' + Port + '/WsUtility/GetTransactionIdentifier/?ver_=1.81&NumberToGenerate=5';
// STRING URL := 'http://' + IP + ':' + Port + '/WsUtility/GetTransactionIdentifier/?ver_=1.81';

//Input Credentials
STRING Username_Val := 'ind_ins_dev';
STRING Password_Val := '1nd1nsDev';

STRING1 _encodeSep := ':';

//Base64 encoding
credentialData := (DATA)(Username_Val + _encodeSep + Password_Val);
base64BasicAccessAuth := Base64.encode_data(credentialData);
STRING HTTPHEADER_VAL := 'Basic ' + (STRING) base64BasicAccessAuth;

/* lResponse := soapcall(URL,
'GetTransactionIdentifier',
rRequest,
rReponse,
XPATH('GetTransactionIdentifierResponse'),
HTTPHEADER('Authorization', HTTPHEADER_VAL)
);
*/
lResponse := httpcall(URL,
'GET',
'text',
rReponse,
//XPATH('GetTransactionIdentifierResponse'),
HTTPHEADER('Authorization', HTTPHEADER_VAL)
);

RETURN lResponse.TransactionIDs;

END;
DS := GetTransactionID_BasicAuth();
DS;
harshdesai
 
Posts: 15
Joined: Fri Feb 23, 2018 8:30 am


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron