Cannot consume staff WSDL

790 views
Skip to first unread message

an...@manicmandrill.co.uk

unread,
Feb 15, 2017, 8:15:41 AM2/15/17
to A gathering place for the Open Rail Data community
Hello there,

I'm trying to set up SoapClient in PHP by using "https://lite.realtime.nationalrail.co.uk/OpenLDBSVWS/wsdl.aspx?ver=2016-02-16" as the WSDL url as per documentation.

I keep getting this error...
SOAP-ERROR: Parsing WSDL: <message> 'AccessTokenMessage' already defined

If I use the "non-staff" version of the WSDL it works fine.

Anyone has encountered this before?

Cheers,
Angel

Peter Hicks (Poggs)

unread,
Feb 15, 2017, 8:24:14 AM2/15/17
to an...@manicmandrill.co.uk, A gathering place for the Open Rail Data community
Hi Angel
It’s better to post your question once rather than follow it up with a completely new thread the next day on the same issue. Remember that the people here have other things to do!

I am not an expert in PHP, but can you tell us which version of SoapClient you’re using, and how to reproduce the issue? It will help others who are more experienced with PHP to help you.


Peter

an...@manicmandrill.co.uk

unread,
Feb 15, 2017, 10:24:07 AM2/15/17
to A gathering place for the Open Rail Data community, an...@manicmandrill.co.uk
Hi Peter,

Thank you for taking time from your other things to tell me off.
In my defence, the reason why I removed the previous post was the exact same reason - that I didn't want to waste people's time...

Anyhow, I do understand that question is a bit vague so here are some extra facts...

I'm using PHP 7.1 and I have been using the non-staff WSDL (with the right AccessToken) through this neat class found at https://github.com/railalefan/phpOpenLDBWS/blob/master/OpenLDBWS.php .


Now if I use the staff WSDL with the right token (and namespace)

$soapClient = new SoapClient("https://lite.realtime.nationalrail.co.uk/OpenLDBSVWS/wsdl.aspx?ver=2016-02-16", $soapOptions);

I'm getting the...

SOAP-ERROR: Parsing WSDL: <message> 'AccessTokenMessage' already defined

From what I gathered there's something is confusing the PHP client.
If I use Wizdler (Chrome Extension) or SOAPUI - then the WSDL is being 'resolved' fine.

I have ran the PHP SoapClient with the
"cache_wsdl" => WSDL_CACHE_NONE,
flag and all sorts of different combinations (SOAP1.1/1.2, different compression, etc).

Many thanks,
Angel

an...@manicmandrill.co.uk

unread,
Feb 15, 2017, 10:45:08 AM2/15/17
to A gathering place for the Open Rail Data community, an...@manicmandrill.co.uk
I think this is the most relevant article I could find...

http://stackoverflow.com/questions/2342419/php-soapclient-problems-with-distributed-wsdl-file

Rail Ale Fan

unread,
Feb 16, 2017, 6:32:44 AM2/16/17
to A gathering place for the Open Rail Data community, an...@manicmandrill.co.uk
Hello Angel,

PHP's SOAP library doesn't support namespace inheritance from a top level .wdsl into imported .wsdl files.  The .wsdl for OpenLDBSVWS imports the .wsdl for both the core and reference services, and since they in turn both reference the same AccessToken namespace, parsing is aborted.

This is why I don't want tot publish a staff version of the phpOpenLDBWS wrapper as to make it work you need to use a local, modified version of the top level .wsdl file however it is straight forward to do.

Start with:

https://lite.realtime.nationalrail.co.uk/OpenLDBSVWS/wsdl.aspx

...and save in the same directory as your script as something appropriate e.g. OpenLDBSVWS.wsdl

Next you need to edit the file and remove all references to the "reference" service - the import of <version>_ldbsv_ref.wsdl and the LDBSVRefServiceSoap / LDBSVRefServiceSoap12 bindings.

You can then pass the local OpenLDBSVWS.wsdl to the SoapClient(...) for access to the core service functions only.  Of course you can do the same for access to the reference service if required...

Hope this helps!

an...@manicmandrill.co.uk

unread,
Feb 16, 2017, 6:50:48 AM2/16/17
to A gathering place for the Open Rail Data community, an...@manicmandrill.co.uk
Hey Rail Ale Fan,

You're a gentleman and a scholar!

Through a lot of pain I actually got to the same conclusion and cracked it last night.
Unfortunately I went to the pub for some real ale so didn't get the chance to update this thread. :)

I'm currently producing a sort of skeleton class for the staff api based on my findings and guidance. Should be publishing to github soon, subject to work load, and will update this thread.

Cheers,
Angel

Ben Barker

unread,
Apr 27, 2017, 8:24:02 AM4/27/17
to A gathering place for the Open Rail Data community, an...@manicmandrill.co.uk
Thanks RailAleFan - I've just encounted the same issue as discussed here, but my attempts to modify the wdsl file have not yet succeeded - my local file is now:

<wsdl:definitions targetNamespace="http://thalesgroup.com/RTTI/2016-02-16/ldbsv/">
        <wsdl:import namespace="http://thalesgroup.com/RTTI/2016-02-16/ldbsv/" location="rtti_2016-02-16_ldbsv.wsdl"/>

        <wsdl:service name="ldbsv">
                <wsdl:port name="LDBSVServiceSoap" binding="sv:LDBSVServiceSoap">
                        <soap:address location="https://realtime.nationalrail.co.uk/LDBSVWS/ldbsv10.asmx"/>
                </wsdl:port>
                <wsdl:port name="LDBSVServiceSoap12" binding="sv:LDBSVServiceSoap12">
                        <soap12:address location="https://realtime.nationalrail.co.uk/LDBSVWS/ldbsv10.asmx"/>
                </wsdl:port>
        </wsdl:service>
</wsdl:definitions>

But this gives me

SOAP-ERROR: Parsing WSDL: Couldn't find <definitions>

So I must have something wrong with my namespaces, but I'm unsure what....any ideas?

Ben Barker

unread,
Apr 27, 2017, 8:27:47 AM4/27/17
to A gathering place for the Open Rail Data community, an...@manicmandrill.co.uk
Scrub that - my WSDL file was missing the top few lines, which should have been obvious from the error!

I'm now using:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:sv="http://thalesgroup.com/$

<wsdl:import namespace="http://thalesgroup.com/RTTI/2016-02-16/ldbsv/" location="rtti_2016-02-16_ldbsv.wsdl" />
<wsdl:service name="ldbsv">
        <wsdl:port name="LDBSVServiceSoap" binding="sv:LDBSVServiceSoap">
                <soap:address location="https://lite.realtime.nationalrail.co.uk/OpenLDBSVWS/ldbsv10.asmx" />

        </wsdl:port>
        <wsdl:port name="LDBSVServiceSoap12" binding="sv:LDBSVServiceSoap12">
                <soap12:address location="https://lite.realtime.nationalrail.co.uk/OpenLDBSVWS/ldbsv10.asmx" />

        </wsdl:port>
</wsdl:service>
</wsdl:definitions>

With more success. I'm now getting "No <binding> element with name 'LDBSVServiceSoap'" which confises me a little, but I'll get there!

Rail Ale Fan

unread,
Apr 27, 2017, 9:27:25 AM4/27/17
to A gathering place for the Open Rail Data community, an...@manicmandrill.co.uk
Hello Ben,

This is most likely just a copy/paste issue into the forum as the WSDL file should have failed to parse otherwise but as posted the opening <wsdl:definitions ... > tag appears to be incomplete; check that you have in full;

Ben Barker

unread,
Apr 27, 2017, 9:40:03 AM4/27/17
to A gathering place for the Open Rail Data community, an...@manicmandrill.co.uk
Ah yes, you are right - it was a copy and paste error into the webpage. Second time lucky...
I'm pretty sure that line is as you suggest - but still running into problems...

PHP Test file:
===========
define("WSDL","OpenLDBSVWS.wsdl");
define("NS","http://schemas.xmlsoap.org/soap/envelope/");
define("TOKEN","xxxxxxxxxxxxxxxxxxxx");

$headerBody = "<AccessToken><TokenValue>".TOKEN."</TokenValue></AccessToken>";
$soapVar=new SoapVar($headerBody, XSD_ANYXML, "http://www.w3.org/2001/XMLSchema-instance");
$header=new SOAPHeader(NS,'AccessToken',$soapVar);
$client = new SoapClient(WSDL);

PHP Error:
=========
PHP Fatal error:  SOAP-ERROR: Parsing WSDL: <service> 'ldbsv' already defined

OpenLDBSVWS.wsdl:
==================
<wsdl:import namespace="http://thalesgroup.com/RTTI/2016-02-16/ldbsv/" location="rtti_2016-02-16_ldbsv.wsdl" />
<wsdl:service name="ldbsv">
        <wsdl:port name="LDBSVServiceSoap" binding="sv:LDBSVServiceSoap">
                <soap:address location="https://lite.realtime.nationalrail.co.uk/OpenLDBSVWS/ldbsv10.asmx" />
        </wsdl:port>
        <wsdl:port name="LDBSVServiceSoap12" binding="sv:LDBSVServiceSoap12">
                <soap12:address location="https://lite.realtime.nationalrail.co.uk/OpenLDBSVWS/ldbsv10.asmx" />
        </wsdl:port>
</wsdl:service>
</wsdl:definitions>




Rail Ale Fan

unread,
Apr 27, 2017, 11:11:07 AM4/27/17
to A gathering place for the Open Rail Data community
Hello Ben,

I spotted something I should have mentioned in my original post regarding creation of the local .wsdl file for compatibility with PHP's SOAP library - with the file being requested locally, the location attribute of the <wsdl:import ... /> tag needs to be  made fully qualified, so where you have

   location="rtti_2016-02-16_ldbsv.wsdl" />

...REPLACE with:

  location="https://lite.realtime.nationalrail.co.uk/OpenLDBSVWS/rtti_2016-02-16_ldbsv.wsdl" />

Cheers!

Ben Barker

unread,
Apr 28, 2017, 3:25:48 AM4/28/17
to A gathering place for the Open Rail Data community
Fantastic - thanks that works!

Cheers,

Ben

Michael Flynn

unread,
Feb 15, 2018, 6:59:00 AM2/15/18
to A gathering place for the Open Rail Data community
I remember using this thread a year or so ago and was able to successfully access LDBWSSV.  But I didn't actually need to use the service at the time, it was as much a test of access as anything else.  Now I'm ready to use the service but I'm once again unable to gain access.  This time the error is;

( ! ) Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: No <binding> element with name 'LDBSVServiceSoap' in (my.php) on line 143
( ! ) SoapFault: SOAP-ERROR: Parsing WSDL: No <binding> element with name 'LDBSVServiceSoap' in (my.php) on line 143

Here's my local copy of wdsl;

<wsdl:service name="ldbsv">
<wsdl:port name="LDBSVServiceSoap" binding="sv:LDBSVServiceSoap">
</wsdl:port>
<wsdl:port name="LDBSVServiceSoap12" binding="sv:LDBSVServiceSoap12">
</wsdl:port>
<!-- wsdl:port name="LDBSVRefServiceSoap" binding="ref:LDBSVRefServiceSoap">
</wsdl:port -->
<!-- wsdl:port name="LDBSVRefServiceSoap12" binding="ref:LDBSVRefServiceSoap12">
</wsdl:port -->
</wsdl:service>
</wsdl:definitions>

So, a couple of questions;

1/ Can anyone tell me what I'm doing wrong?

and 2/, maybe more importantly, can anyone suggest a more permanent solution rather than this workaround?  Saving a local copy of the wdsl and making changes is cumbersome and would need to be done whenever there are updates to wdsl, etc.  And there's the lost functionality of the reference code, or the need to apply a further workaround to include,.  I was wondering if anyone has any coding examples in language other than php that correctly handles namespace inheritance.  I'm  someone might have done this in Java.  Or maybe  there's a newer way to access SOAP in php.  (BTW, I would want to avoid using any kind of third party wrappers though.)  Or is  there now simply an easier way to access that I'm missing?




Reply all
Reply to author
Forward
0 new messages