Comments (1)
In the short term, it appears this can be fixed with the following changes to BaseServiceItem.cs
and ServiceDetailsService.cs
:
--- a/Huxley2/Connected Services/OpenLDBWS/BaseServiceItem.cs
+++ b/Huxley2/Connected Services/OpenLDBWS/BaseServiceItem.cs
@@ -11,9 +11,9 @@ namespace OpenLDBWS
{
public partial class BaseServiceItem
{
public string ServiceIdPercentEncoded => WebUtility.UrlEncode(serviceIDField);
- public Guid ServiceIdGuid => new Guid(Convert.FromBase64String(serviceIDField));
+ // public Guid ServiceIdGuid => new Guid(serviceIDField);
[SuppressMessage("Design", "CA1056:Uri properties should not be strings", Justification = "Not a URL")]
- public string ServiceIdUrlSafe => WebEncoders.Base64UrlEncode(Convert.FromBase64String(serviceIDField));
+ public string ServiceIdUrlSafe => serviceIDField; // underscores are URL safe
}
}
--- a/Huxley2/Services/ServiceDetailsService.cs
+++ b/Huxley2/Services/ServiceDetailsService.cs
@@ -55,17 +55,27 @@ namespace Huxley2.Services
// If ID looks like a RID (15 decimal digit long base 10 integer) then use the staff API if configured
// This appears to be the date and the UID (with the first character in decimal representation)
- if (request.ServiceId.Length == 15 && long.TryParse(request.ServiceId, out _)
- && _accessTokenService.TryMakeStaffAccessToken(out var staffToken))
- {
- _logger.LogInformation($"Calling staff service details SOAP endpoint for {request.ServiceId}");
- var staffService = await _staffSoapClient.GetServiceDetailsByRIDAsync(
- new GetServiceDetailsByRIDRequest
+ if (request.ServiceId.Length == 15) {
+ if (long.TryParse(request.ServiceId, out _)
+ && _accessTokenService.TryMakeStaffAccessToken(out var staffToken)) {
+ _logger.LogInformation($"Calling staff service details SOAP endpoint for {request.ServiceId}");
+ var staffService = await _staffSoapClient.GetServiceDetailsByRIDAsync(
+ new GetServiceDetailsByRIDRequest
+ {
+ AccessToken = staffToken,
+ rid = request.ServiceId,
+ });
+ return staffService.GetServiceDetailsResult;
+ } else if (request.ServiceId.EndsWith("_")) {
+ _logger.LogInformation($"Calling service details SOAP endpoint for {request.ServiceId}");
+ var s = await _soapClient.GetServiceDetailsAsync(new GetServiceDetailsRequest
{
- AccessToken = staffToken,
- rid = request.ServiceId,
+ AccessToken = _accessTokenService.MakeAccessToken(request),
+ serviceID = request.ServiceId,
});
- return staffService.GetServiceDetailsResult;
+ return s.GetServiceDetailsResult;
+
+ }
}
However, this will break GUID support and percent encoding, so a more elegant overall solution is likely needed
from huxley2.
Related Issues (13)
- Station Details like Facilities HOT 1
- Departure board expand option shows previous calling points as null HOT 1
- Huxley and Huxley 2 seems to be throwing an Error 500 for any departure/arrival query HOT 1
- Getting service details consistently fails HOT 8
- Station list CSV down HOT 3
- Error when getting any departure board HOT 7
- Service /service/{Service ID} returns error 500 HOT 3
- Issue when getting departures data from a local setup HOT 1
- .NET 8 LTS upgrade
- Implement ETag-based caching HOT 6
- Bus and Ferry services are not shown for Staff Departures HOT 1
- Memory leak HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from huxley2.