SOAP Action WSDL

后端 未结 8 1147
再見小時候
再見小時候 2020-12-30 02:18

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.nationa

相关标签:
8条回答
  • 2020-12-30 02:27

    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

    0 讨论(0)
  • 2020-12-30 02:32

    SOAPAction is required in SOAP 1.1 but can be empty ("").

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

    "The header field value of empty string ("") means that the intent of the SOAP message is provided by the HTTP Request-URI."

    Try setting SOAPAction=""

    0 讨论(0)
  • 2020-12-30 02:34

    the service have 4 operations: 1. GetServiceDetails 2. GetArrivalBoard 3. GetDepartureBoard 4. GetArrivalDepartureBoard

    Implementation of web service

    0 讨论(0)
  • 2020-12-30 02:41

    I have solved this problem, in Java Code, adding:

     MimeHeaders headers = message.getMimeHeaders();
     headers.addHeader("SOAPAction", endpointURL);
    
    0 讨论(0)
  • 2020-12-30 02:47

    I've just spent a while trying to get this to work an have a written a Ruby gem that accesses the API. You can read more on it's project page.

    This is working code in Ruby:

    require 'savon'
    client = Savon::Client.new do
      wsdl.document = "http://realtime.nationalrail.co.uk/LDBWS/wsdl.aspx"
    end
    
    response = client.request 'http://thalesgroup.com/RTTI/2012-01-13/ldb/GetDepartureBoard' do
    
      namespaces = {
        "xmlns:soap" => "http://schemas.xmlsoap.org/soap/envelope/",
        "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
        "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema"
      }
    
      soap.xml do |xml|
        xml.soap(:Envelope, namespaces) do |xml|
          xml.soap(:Header) do |xml|
            xml.AccessToken do |xml|
              xml.TokenValue('ENTER YOUR TOKEN HERE') 
            end
          end
          xml.soap(:Body) do |xml|
            xml.GetDepartureBoardRequest(xmlns: "http://thalesgroup.com/RTTI/2012-01-13/ldb/types") do |xml|
              xml.numRows(10)
              xml.crs("BHM")
              xml.filterCrs("BHM")
              xml.filterType("to")
            end
          end
        end
      end
    end
    p response.body
    

    Hope that's helpful for someone!

    0 讨论(0)
  • 2020-12-30 02:50

    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 out from Example 3-19 in O'Reilly's Programming Web Services with SOAP . 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.

    0 讨论(0)
提交回复
热议问题