Adding to the http header / authorization how to question

59 views
Skip to first unread message

Angela

unread,
Feb 10, 2022, 4:06:22 PMFeb 10
to
I have http basic authorization enabled and need to format the user/pwd as follows:

var user = "emp$<myid>"
var pwd = "<mypassword>"

Then I build do the following

myAuth = "Basic " + system.base64Encode(String(user + ":" + pwd).getBytes());

thisConnector.connector.setParam("http.Authorization", myAuth);

which seems to work fine. BUT I need to also add more lines.
For example:

Proxy-Connection: keep-alive
Epic-Client-ID: 0000-0000-0000-0000-0000

How do I do that?

Franzw

unread,
Feb 13, 2022, 11:30:34 AMFeb 13
to
I assume you want to add the 2 HTTP headers. That is quite simple - but as you have not posted HOW and WHERE you do it may vary
Here is how I would do it in a script call/reply :

//Configure the call
httpcall = system.newEntry();
httpcall.setAttribute("http.Proxy-Connection","keep-alive");
httpcall.setAttribute("http.Epic-Client-ID","0000-0000-0000-0000-0000");

httpReply = myHttpConn.queryReply(httpcall);

HTTP headers are just attributes prefixed in the connector entry with "http." - so you can do it like this or add them in a hook or in the output map of the connector...

HTH
Regards
Franz Wolfhagen

Angela

unread,
Feb 23, 2022, 4:55:55 PMFeb 23
to
******
Thanks Franz

I am trying to create this/these call(s). I have used http.client connector and various other soap connectors and having NO luck. The below is the content of a successful request made from ReadyAPI. Now I just need to recreate this in SDI.


POST https://hostedService.Epic.Security.GeneratedServices/PersonnelManagement.svc/basic_2014 HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "urn:Epic-com:Security.2014.Services.PersonnelManagement.ViewUser"
Epic-User-IDType: External
Epic-Client-ID: 00000000-0000-00000000-000000000000
Epic-User-ID: 999999
Content-Length: 1361
Host: hostedService.epichosted.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.2 (Java/16.0.1)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Epic-com:Security.2014.Services.PersonnelManagement">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-6124D7CDC1AB39EA0116452180168813">
<wsse:Username>emp:myUserID</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">mypassword</wsse:Password>
<wsu:Created>2022-02-18T21:00:16.881Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<urn:ViewUser>
<!--Optional:-->
<urn:UserID>acook19</urn:UserID>
<!--Optional:-->
<urn:UserIDType>SystemLogin</urn:UserIDType>
<!--Optional:-->
<urn:ContactDate xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<!--Optional:-->
<urn:AuditUserID>myUserID</urn:AuditUserID>
<!--Optional:-->
<urn:AuditUserIDType>External</urn:AuditUserIDType>
<!--Optional:-->
<urn:AuditUserPassword>mypassword</urn:AuditUserPassword>
</urn:ViewUser>
</soapenv:Body>
</soapenv:Envelope>

Franzw

unread,
Feb 24, 2022, 2:53:32 AMFeb 24
to
Is it the header section or the soap message (or both) that is your problem ?

I can see that you have to include wsse security settings into a soap message which may be a challenge - I have been working with a customer where actually build the Soap envelope and than have a service (coded in Java running on a J2EE server) to do the wsse stuff which was somewhat too complex for SDI to handle as there is no real wsse support in SDI....

The headers should be fairly straight forward - to build a soap envelope I normally use the DOM notation (the SDI FCs seams to have problems and framework compatibility problems depending whether the soap service is AXIS or JAX-WS based or as in my case the the wsse sample we had to use was build on the Spring framework..) This is documented here : https://www.ibm.com/docs/en/sdi/7.1.1?topic=values-working-hierarchical-entry-objects

I do not have the time right now to build a sample but I hope this should give the needed information to continue your effort :-)

Regards
Franz Wolfhagen
Reply all
Reply to author
Forward
0 new messages