Problem creating SOAP Request

Discussion in 'Ruby' started by Matt Su, Jul 31, 2007.

  1. Matt Su

    Matt Su Guest

    Hi there,

    I am trying to do a soap request to the Mapping Service Map24.

    They have a WSDL for their webservice:

    http://maptp11.map24.com/map24/webservices1.5?soap=Map24Geocoder51

    I am attempting to do the Free Geocode operation: 'searchFree'. It
    appears this takes a RequestHeader and a MapSearchFreeRequest. I use
    the following code to create my request:

    factory =
    SOAP::WSDLDriverFactory.new("http://maptp11.map24.com/map24/webservices1.5?soap=Map24Geocoder51")
    driver = factory.create_rpc_driver
    result = driver.searchFree( {:Map24ID => "1"}, {:SearchText =>
    "London, UK"} )

    However, this only ever generates the following SOAP Request:

    <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <env:Body>
    <n1:searchFree xmlns:n1="urn:Map24Geocoder51"
    env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <RequestHeader xsi:nil="true"></RequestHeader>
    <MapSearchFreeRequest xsi:nil="true"></MapSearchFreeRequest>
    </n1:searchFree>
    </env:Body>
    </env:Envelope>

    The RequestHeader and MapSearchFreeRequest parts are ALWAYS empty..?

    Can anyone help?

    Thanks in advance :)
    --
    Posted via http://www.ruby-forum.com/.
     
    Matt Su, Jul 31, 2007
    #1
    1. Advertising

  2. Matt Su

    dima Guest

    On Jul 31, 12:56 pm, Matt Su <> wrote:
    > Hi there,
    >
    > I am trying to do a soap request to the Mapping Service Map24.
    >
    > They have a WSDL for their webservice:
    >
    > http://maptp11.map24.com/map24/webservices1.5?soap=Map24Geocoder51
    >
    > I am attempting to do the Free Geocode operation: 'searchFree'. It
    > appears this takes a RequestHeader and a MapSearchFreeRequest. I use
    > the following code to create my request:
    >
    > factory =
    > SOAP::WSDLDriverFactory.new("http://maptp11.map24.com/map24/webservices1.5?soap=Map24Geocoder51")
    > driver = factory.create_rpc_driver
    > result = driver.searchFree( {:Map24ID => "1"}, {:SearchText =>
    > "London, UK"} )
    >
    > However, this only ever generates the following SOAP Request:
    >
    > <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    > xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    > <env:Body>
    > <n1:searchFree xmlns:n1="urn:Map24Geocoder51"
    > env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    > <RequestHeader xsi:nil="true"></RequestHeader>
    > <MapSearchFreeRequest xsi:nil="true"></MapSearchFreeRequest>
    > </n1:searchFree>
    > </env:Body>
    > </env:Envelope>
    >
    > The RequestHeader and MapSearchFreeRequest parts are ALWAYS empty..?
    >
    > Can anyone help?
    >
    > Thanks in advance :)
    > --
    > Posted viahttp://www.ruby-forum.com/.


    You should post your question on http://groups.google.com/group/soap4r
     
    dima, Jul 31, 2007
    #2
    1. Advertising

  3. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hi,

    Matt Su wrote:
    > factory =
    > SOAP::WSDLDriverFactory.new("http://maptp11.map24.com/map24/webservices1.5?soap=Map24Geocoder51")
    > driver = factory.create_rpc_driver
    > result = driver.searchFree( {:Map24ID => "1"}, {:SearchText =>
    > "London, UK"} )


    When you use a Hash as a parameter, you need to start from a parameter name.

    result = driver.searchFree(
    {:RequestHeader => {:Map24ID => "1"}},
    {:MapSearchFreeRequest => {:SearchText => "London, UK"}}
    )

    Generating stub files with wsdl2ruby.rb should be easier to use for this
    kind of service which has complex request.

    // NaHi

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.2.1 (Cygwin)

    iQEVAwUBRq9Frh9L2jg5EEGlAQK0SAgAp19e5ag2PUflBgwqvVLtN+e7x5GHtWLl
    mfI8MpaJ8P4mZ1H3hG8+SQuGzP4KoQXpcyhXrsrx77s43ozWQgj+0vhytPBo7ome
    TSAA5F+HAHVTi7NSB0KNLAbrCF58MBVvJRLO8MBxm9if+IyqRGW5bP4Rt3s9Wkdg
    d+Y1KoYlIUQw7S2f4Oy5g8Iaj68+L8zv2n90bFS90sz/Zoq7MtDUDPezseOnhMWC
    TrdcOFTyhhXHG/z+KJbpWYDKFNsmu+x9769PdnoxBtwdTEOMiIs/oZHmNIobeCeL
    dom7p/OBHgz1Gv/yZLWJrMTOBGgD7ZgGXvnGVa9efpCBRawQSZFOhg==
    =K0aY
    -----END PGP SIGNATURE-----
     
    NAKAMURA, Hiroshi, Jul 31, 2007
    #3
  4. Matt Su

    Matt Su Guest

    > When you use a Hash as a parameter, you need to start from a parameter
    > name.
    >
    > result = driver.searchFree(
    > {:RequestHeader => {:Map24ID => "1"}},
    > {:MapSearchFreeRequest => {:SearchText => "London, UK"}}
    > )
    >
    > Generating stub files with wsdl2ruby.rb should be easier to use for this
    > kind of service which has complex request.


    Thanks for your response I really appreciate it.

    I tried your modification, however I still see the following SOAP
    Request being generated:

    <?xml version="1.0" encoding="utf-8" ?>
    <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <env:Body>
    <n1:searchFree xmlns:n1="urn:Map24Geocoder51"
    env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <RequestHeader xsi:nil="true"></RequestHeader>
    <MapSearchFreeRequest xsi:nil="true"></MapSearchFreeRequest>
    </n1:searchFree>
    </env:Body>
    </env:Envelope>

    Why are the RequestHeader and MapSearchFreeRequest xsi:nil attributes
    true: should they not be filled with whatever I pass in the call
    driver.searchFree?

    I have used the SOAP and Driver Generator before for a simpler request
    for a different service and it worked perfectly. Does the
    WSDLDriverFactory and the create_rpc_driver method not always work for
    complex WSDLs??

    Thanks again in advance :)
    --
    Posted via http://www.ruby-forum.com/.
     
    Matt Su, Jul 31, 2007
    #4
  5. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hi,

    What version of soap4r are you using? As Andre wrote in soap4r-ml, it
    should generate request elements with earlier soap4r versions.

    % ruby -rsoap/soap -e 'p SOAP::Version'

    I tried soap4r-1.5.5 which is bundled with ruby-1.8.X and found that it
    fails to parse the WSDL you pointed. If you are using soap4r-1.5.5,
    please update to soap4r-1.5.7 from http://dev.ctor.org/soap4r

    Matt Su wrote:
    >> When you use a Hash as a parameter, you need to start from a parameter
    >> name.


    It's wrong. It works but not needed. Sorry for confusing you. The
    client program you posted at first should work with soap4r-1.5.7.

    Regards,
    // NaHi

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.5 (Cygwin)

    iQEVAwUBRq/uGR9L2jg5EEGlAQIeygf/ej4KhKxsZ6QXrf6X5JOsAXSxhMzuEVMS
    mQ3scSskogAEPmhSrEUvr25jGJNnlkKwhd2ep/OOpD1moGEN2/x9e2Illhy9ABpk
    lpqVhlggCRI4JL2N0xJBleSis4RQLXGlwO+ae3PMZ54BRcMMTYMWtcmSw81eDHEV
    gqzNSUawAKnxbjF0uczHQySual2wWfMBHbM7+CPTVab99AZA3CHUgObFMcH4iOTL
    Tz9cy3NF0+5+A02N1UXZ9MT70KiAYklLdsmIg5latt171Lgx3K/TzxhKegeG353U
    Jmgv3SlZyo3EVYUVrC0+zmBlDUDxIlJey4MyZegB6+s/He0NUQ0Z0w==
    =bwlR
    -----END PGP SIGNATURE-----
     
    NAKAMURA, Hiroshi, Aug 1, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Birtle
    Replies:
    2
    Views:
    2,135
    John Saunders
    Oct 16, 2003
  2. comp.text.xml
    Replies:
    0
    Views:
    535
    comp.text.xml
    Sep 20, 2006
  3. Ivan S
    Replies:
    0
    Views:
    552
    Ivan S
    Aug 13, 2008
  4. Mullin Yu
    Replies:
    0
    Views:
    241
    Mullin Yu
    Oct 8, 2003
  5. Frederik Vanderhaegen

    Soap Extension problem (seems that soap request is not sent to server)

    Frederik Vanderhaegen, Oct 20, 2006, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    288
    Frederik Vanderhaegen
    Oct 20, 2006
Loading...

Share This Page