Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protocol version >1.21: refreshJourneys/Reconstruction fails #164

Closed
derhuerst opened this issue Mar 9, 2020 · 5 comments
Closed

protocol version >1.21: refreshJourneys/Reconstruction fails #164

derhuerst opened this issue Mar 9, 2020 · 5 comments

Comments

@derhuerst
Copy link
Member

I'm trying to send a Reconstruction request with recent HAFAS protocol version, but it fails.

In the following example, I set the value of ctxRecon to an invalid value ("foo") to demonstrate the difference between the versions.

With 1.21, as expected it complains about the value of ctxRecon being invalid:

Error: HCI Service: context invalid
		at Object.request (/Users/j/web/hafas-client/lib/request.js:81:14)
		at Object.refreshJourney (/Users/j/web/hafas-client/index.js:254:18)
		at Object.<anonymous> (/Users/j/web/hafas-client/p/db/example.js:11:8)
		at Module._compile (internal/modules/cjs/loader.js:1158:30)
		at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
		at Module.load (internal/modules/cjs/loader.js:1002:32)
		at Function.Module._load (internal/modules/cjs/loader.js:901:14)
		at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
		at internal/main/run_main_module.js:18:47 {
	isHafasError: true,
	request: '{"lang":"en","svcReqL":[{"meth":"Reconstruction","req":{"ctxRecon":"foo","getIST":true,"getPasslist":false,"getPolyline":false},"cfg":{"rtMode":"HYBRID"}}],"client":{"id":"DB","v":"16040000","type":"IPH","name":"DB Navigator"},"ext":"DB.R19.04.a","ver":"1.21","auth":{"type":"AID","aid":"n91dB8Z77MLdoR0K"}}',
	url: 'https://reiseauskunft.bahn.de/bin/mgate.exe?checksum=3077106a925e707354fd724e24af5c07',
	statusCode: 200,
	code: 'CONTEXT',
	message: 'HCI Service: context invalid',
	responseId: 'wi24brt8gascxkw8'
}

With 1.22, I think it says ctxRecon is syntactically not expected here:

Error: Parser error: root.svcReqL.svcReqL.req(ctxRecon)
		at Object.request (/Users/j/web/hafas-client/lib/request.js:81:14)
		at Object.refreshJourney (/Users/j/web/hafas-client/index.js:254:18)
		at Object.<anonymous> (/Users/j/web/hafas-client/p/db/example.js:11:8)
		at Module._compile (internal/modules/cjs/loader.js:1158:30)
		at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
		at Module.load (internal/modules/cjs/loader.js:1002:32)
		at Function.Module._load (internal/modules/cjs/loader.js:901:14)
		at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
		at internal/main/run_main_module.js:18:47 {
	isHafasError: true,
	request: '{"lang":"en","svcReqL":[{"meth":"Reconstruction","req":{"ctxRecon":"foo","getIST":true,"getPasslist":false,"getPolyline":false},"cfg":{"rtMode":"HYBRID"}}],"client":{"id":"DB","v":"16040000","type":"IPH","name":"DB Navigator"},"ext":"DB.R19.04.a","ver":"1.22","auth":{"type":"AID","aid":"n91dB8Z77MLdoR0K"}}',
	url: 'https://reiseauskunft.bahn.de/bin/mgate.exe?checksum=57e6c9e0cfddf91c72e6968e0633de18',
	statusCode: 200,
	code: 'PARSE',
	message: 'Parser error: root.svcReqL.svcReqL.req(ctxRecon)',
	responseId: null
}
@derhuerst
Copy link
Member Author

@alexander-albers @schildbach @marudor Do you know how to change the request structure to make it work with >1.21?

@schildbach
Copy link

I'm afraid not. For such reasons, I limited API version to the version used on the respective official web page/app.

@derhuerst
Copy link
Member Author

Yeah I can see why. But other endpoints & apps already use versions >=1.21, and it enables new features, e.g. output of sub-stations.

derhuerst referenced this issue in schildbach/public-transport-enabler Mar 9, 2020
It seems to be unnecessary and has been removed from later API versions anyway.
@marudor
Copy link

marudor commented Mar 10, 2020

So far 1.20 is the max I've used. Currently mainly using 1.18.

@derhuerst
Copy link
Member Author

Some endpoints use ctxRecon: '…', some use outReconL: [{ctx: '…'}]. d017e62 introduced a profile flag for switching between them.

derhuerst added a commit that referenced this issue Jan 19, 2021
derhuerst added a commit that referenced this issue Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants