Please help ! does anyone has a working Java client for accessing NRE LDBWS?

236 views
Skip to first unread message

su...@matzgroup.in

unread,
May 14, 2016, 6:07:39 AM5/14/16
to A gathering place for the Open Rail Data community
Hi All,
I am looking for a working Java client for accessing NRE LDBWS. It would be great if anyone can share this instead of me writing it from scratch.

Thanks a ton!
Sunil

Peter Hicks

unread,
May 14, 2016, 6:09:41 AM5/14/16
to su...@matzgroup.in, A gathering place for the Open Rail Data community
Hi Sunil

It's quite straightforward to write your own client in Java.  The WSDL is available through a link at https://lite.realtime.nationalrail.co.uk/OpenLDBWS/, and you can use Apache CXF to perform much of the heavy lifting work for you.


Peter


--
You received this message because you are subscribed to the Google Groups "A gathering place for the Open Rail Data community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openraildata-t...@googlegroups.com.
To post to this group, send an email to openrail...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

su...@matzgroup.in

unread,
May 16, 2016, 8:10:39 AM5/16/16
to A gathering place for the Open Rail Data community, su...@matzgroup.in
This is the java code i have written:
private static final QName SERVICE_NAME = new QName("http://thalesgroup.com/RTTI/2015-11-27/ldb/", "ldb");
Ldb ss = new Ldb(Ldb.WSDL_LOCATION, SERVICE_NAME);
LDBServiceSoap port = ss.getLDBServiceSoap();

GetBoardRequestParams params = new GetBoardRequestParams();
params.setCrs("VIC");
params.setFilterType(FilterType.FROM);
StationBoardResponseType responseData = port.getDepartureBoard(params);
System.out.println("Response Data: " + responseData);

Please help! where to specify the accesstoken?

Regards,
Sunil

su...@matzgroup.in

unread,
May 16, 2016, 8:10:39 AM5/16/16
to A gathering place for the Open Rail Data community, su...@matzgroup.in
Hi Peter,
I have created the client using Apache CXF and when trying to get the data, it throws "Http status code 401: unauthorized". I am aware that we need to set the token key. But unable to know where. Can you please guide me where to pass the api key?

Thanks in advance.
Sunil

On Saturday, May 14, 2016 at 3:39:41 PM UTC+5:30, Peter Hicks wrote:

Peter Hicks

unread,
May 16, 2016, 8:16:12 AM5/16/16
to su...@matzgroup.in, A gathering place for the Open Rail Data community
Hi Sunil

On Mon, 16 May 2016 at 13:10 <su...@matzgroup.in> wrote:

This is the java code i have written:
private static final QName SERVICE_NAME = new QName("http://thalesgroup.com/RTTI/2015-11-27/ldb/", "ldb");
                        Ldb ss = new Ldb(Ldb.WSDL_LOCATION, SERVICE_NAME);
                        LDBServiceSoap port = ss.getLDBServiceSoap();

                        GetBoardRequestParams params = new GetBoardRequestParams();
                        params.setCrs("VIC");
                        params.setFilterType(FilterType.FROM);
                        StationBoardResponseType responseData = port.getDepartureBoard(params);
                        System.out.println("Response Data: " + responseData);

Please help! where to specify the accesstoken?

The access token needs to be specified in the SOAP header like this:

<SOAP-ENV:Header>
  <ns2:AccessToken>
    <ns2:TokenValue>*** specify token here</ns2:TokenValue>
  </ns2:AccessToken>
</SOAP-ENV:Header>

This is actually inside the SOAP payload itself, and beware - the namespace prefixes I've shown above may well differ from yours!

I'm not sure how you'd put this in a LDB request - but if you give me a few days, I'll have a play with Apache CXF when I have some free time and post an example client on to GitHub.


Peter

su...@matzgroup.in

unread,
May 16, 2016, 8:29:48 AM5/16/16
to A gathering place for the Open Rail Data community, su...@matzgroup.in
Thanks Peter,
I have seen this code below already what you have specified but struggling to add it to the LDB request. Doing trial and error. It would be of great help if you can give your valuable inputs or solution on this. Meanwhile I will play around further on this and will post solution if I get it.

Thank you again!

Sunil

su...@matzgroup.in

unread,
Jun 3, 2016, 12:38:06 AM6/3/16
to A gathering place for the Open Rail Data community, su...@matzgroup.in
Hi Peter,
Did you get a chance to look into the Java version of the code? Please help as we are still stuck with issues accessing Darwin from Java.

Sunil

Mike Flynn

unread,
Jun 28, 2016, 1:45:16 PM6/28/16
to A gathering place for the Open Rail Data community, su...@matzgroup.in

I am looking for a working Java client for accessing NRE LDBWS. It would be great if anyone can share this instead of me writing it from scratch.

Thanks a ton!
Sunil


Hi Sunil,

Did you find a solution?  I found one after following through examples from this clear and concise guide at mkyong.com.

Regards,
Mike
Reply all
Reply to author
Forward
0 new messages