( operation: string, args: Record<string, unknown>, username: string, password: string )
| 282 | } |
| 283 | |
| 284 | function buildEnvelope( |
| 285 | operation: string, |
| 286 | args: Record<string, unknown>, |
| 287 | username: string, |
| 288 | password: string |
| 289 | ): string { |
| 290 | let body = '' |
| 291 | for (const [k, v] of Object.entries(args)) { |
| 292 | body += marshal(k, v) |
| 293 | } |
| 294 | |
| 295 | const wsseNs = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' |
| 296 | const wssePwdType = |
| 297 | 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText' |
| 298 | |
| 299 | return ( |
| 300 | `<?xml version="1.0" encoding="UTF-8"?>` + |
| 301 | `<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wd="urn:com.workday/bsvc">` + |
| 302 | `<env:Header>` + |
| 303 | `<wsse:Security xmlns:wsse="${wsseNs}" env:mustUnderstand="1">` + |
| 304 | `<wsse:UsernameToken>` + |
| 305 | `<wsse:Username>${escapeXml(username)}</wsse:Username>` + |
| 306 | `<wsse:Password Type="${wssePwdType}">${escapeXml(password)}</wsse:Password>` + |
| 307 | `</wsse:UsernameToken>` + |
| 308 | `</wsse:Security>` + |
| 309 | `</env:Header>` + |
| 310 | `<env:Body>` + |
| 311 | `<wd:${operation}_Request>` + |
| 312 | body + |
| 313 | `</wd:${operation}_Request>` + |
| 314 | `</env:Body>` + |
| 315 | `</env:Envelope>` |
| 316 | ) |
| 317 | } |
| 318 | |
| 319 | interface XmlNode { |
| 320 | name: string |
no test coverage detected