tags:

views:

857

answers:

2

Hi all,

I'm trying to implement a client for National Rail Enquiries' SOAP Service (http://www.livedepartureboards.co.uk/ldbws/).

I stick the WSDL (http://realtime.nationalrail.co.uk/ldbws/wsdl.aspx) into http://soapclient.com/soaptest.html, but I get back the error message "Unable to handle request without a valid action parameter. Please supply a valid soap action."; what on earth should the action be?

Thanks, Stewart

edit:

I just used soapclient.com as a quick example. In my software, I send the following XML; I still get that I'm missing an action.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://thalesgroup.com/RTTI/2008-02-20/ldb/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:ldbt2="http://thalesgroup.com/RTTI/2008-02-20/ldb/types" xmlns:ldbt="http://thalesgroup.com/RTTI/2007-10-10/ldb/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ct="http://thalesgroup.com/RTTI/2007-10-10/ldb/commontypes" >
 <SOAP-ENV:Body>
  <ldbt2:GetDepartureBoardRequest xmlns:ldbt2="http://thalesgroup.com/RTTI/2008-02-20/ldb/" >
   <ldbt2:numRows>5</ldbt2:numRows>
   <ldbt2:crs>WAT</ldbt2:crs>
   <ldbt2:filterCrs>GLD</ldbt2:filterCrs>
   <ldbt2:filterType>to</ldbt2:filterType>
   <ldbt2:timeOffset>0</ldbt2:timeOffset>
  </ldbt2:GetDepartureBoardRequest>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
+2  A: 

If its a SOAP 1.1 service then you will also need to include a SOAPAction HTTP header field:

http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383528

mythz
I get that much... but I can't for the life of me work out what should be in the SOAPAction field.
Stewart
It would be the same as what's in your SOAP body, i.e.GetDepartureBoardRequest or the fully qualified: http://thalesgroup.com/RTTI/2008-02-20/ldb/GetDepartureBoardRequest
mythz
I've tried that, but I get "Server did not recognize the value of HTTP Header SOAPAction: GetDepartureBoardRequest"
Stewart
have you tried using the fully qualified name including your namespace?
mythz
A: 

I have come across exactly the same problem when trying to write a client for the National Rail SOAP service with Perl.

The problem was caused because the Perl module that I'm using 'SOAP::Lite' inserts a '#' in the SOAPAction header ...

SOAPAction: "http://thalesgroup.com/RTTI/2008-02-20/ldb/#GetDepartureBoard"

This is not interpreted correctly by .NET servers. I found this our from Example 3-19 on the following page: http://oreilly.com/catalog/progwebsoap/chapter/ch03.html . The solution was given below in section 3-20, namely you need to explicitly specify the format of the header with the 'on_action' method.

print SOAP::Lite
  -> uri('urn:Example1')
  -> on_action(sub{sprintf '%s/%s', @_ })
  -> proxy('http://localhost:8080/helloworld/example1.asmx')
  -> sayHello($name)
  -> result . "\n\n";

My guess is that soapclient.com is using SOAP::Lite behind the scenes and so are hitting the same problem when talking to National Rail.

The solution is to write your own client so that you have control over the format of the SOAPAction header ... but you've probably done that already.

Richard

rdc