loopbackio / loopbackio/strong-soap

Strong-Soap appears to modify the time portion of a date in UTC format

Open
#325 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
410
Forks
162
Avg merge
4h 36m
Merged PRs (30d)
7

Description

I am hoping I can ask this question without needing a sandbox because I cannot set one up.

The SOAP endpoints are proprietary and used by my company.

Here is part of the response I get back when I send a soap request from Postman:

```

2021-07-21T00:00:00
2021-07-23T00:00:00

```

Notice the time portion (after the 'T') are all 0's.

If I run the same request using Strong Soap and listen for the client Event 'response' (see code below), it gives me the same results as above (all '0's after the 'T').

```
client.on("response",(response:any)=>{
console.log(response);

// Prints
//
//
// 2021-07-21T00:00:00
// 2021-07-23T00:00:00
//
});
```

However, when I use the client to call the same method as in the above two cases (see below code)

```
this.soapClient.method(methodRequestBody,
(err: string, result: MyResult, envelope: any, soapHeader: string) => {
console.log(result); // Print the contents (see below) after calling the SOAP method
}, undefined, headers);
```

Here is the JSON I get back in 'result':
```
"TimeSpan": {
"StartDate": "2021-07-21T07:00:00.000Z",
"EndDate": "2021-07-23T07:00:00.000Z"
},
```

Notice that now after the 'T', instead of all '0's, the time starts at '07'.

As a result of this discrepancy, our tests are breaking and we don't just want to hard code the correct time.

I read over the strong soap documentation and do not see any configurations to setup a time zone. Other than what I have listed above, we are doing nothing to make the time portion change.

Any thoughts why strong soap seems to be changing the time when converting from XML to JSON?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the client response event and the method callback that produces the parsed result, comparing the raw XML timestamps with the JSON conversion. Investigate the date-handling path and add a focused regression test using the reported StartDate and EndDate values; done means the conversion behavior is explained and the expected timezone semantics are covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.