# Problem creating SOAP Request

**URL:** <https://www.ruby-forum.com/t/problem-creating-soap-request/110835>\
**Category:** Ruby\
**Created:** [July 31, 2007, 12:56pm UTC](https://www.ruby-forum.com/t/problem-creating-soap-request/110835 "2007-07-31T12:56:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@matthew](https://www.ruby-forum.com/u/matthew)\
**Post date:** [July 31, 2007, 12:56pm UTC](https://www.ruby-forum.com/t/problem-creating-soap-request/110835/1 "2007-07-31T12:56:25Z")

</div>

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](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](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](http://www.w3.org/2001/XMLSchema)”  
xmlns:env=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)”  
xmlns:xsi=“[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)”\>  
env:Body  
\<n1:searchFree xmlns:n1=“urn:Map24Geocoder51”  
env:encodingStyle=“[http://schemas.xmlsoap.org/soap/encoding/](http://schemas.xmlsoap.org/soap/encoding/)”\>  
  
  
\</n1:searchFree\>  
\</env:Body\>  
\</env:Envelope\>

The RequestHeader and MapSearchFreeRequest parts are ALWAYS empty…?

Can anyone help?

Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![matthew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@matthew](https://www.ruby-forum.com/u/matthew)\
**Post date:** [July 31, 2007, 3:30pm UTC](https://www.ruby-forum.com/t/problem-creating-soap-request/110835/2 "2007-07-31T15:30:40Z")

</div>

On Jul 31, 12:56 pm, Matt Su [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> the following code to create my request:  
> xmlns:env=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/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](http://groups.google.com/group/soap4r)

---

<div class="post-metadata">

**Author:** ![matthew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@matthew](https://www.ruby-forum.com/u/matthew)\
**Post date:** [July 31, 2007, 4:24pm UTC](https://www.ruby-forum.com/t/problem-creating-soap-request/110835/3 "2007-07-31T16:24:48Z")

</div>

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

Hi,

Matt Su wrote:

> ```
> factory =
> 
> ```
> 
> SOAP::WSDLDriverFactory.new(“[http://maptp11.map24.com/map24/webservices1.5?soap=Map24Geocoder51](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-----

---

<div class="post-metadata">

**Author:** ![matthew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@matthew](https://www.ruby-forum.com/u/matthew)\
**Post date:** [July 31, 2007, 5:20pm UTC](https://www.ruby-forum.com/t/problem-creating-soap-request/110835/4 "2007-07-31T17:20:59Z")

</div>

> 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](http://www.w3.org/2001/XMLSchema)”  
xmlns:env=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)”  
xmlns:xsi=“[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)”\>  
env:Body  
\<n1:searchFree xmlns:n1=“urn:Map24Geocoder51”  
env:encodingStyle=“[http://schemas.xmlsoap.org/soap/encoding/](http://schemas.xmlsoap.org/soap/encoding/)”\>  
  
  
\</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 🙂

---

<div class="post-metadata">

**Author:** ![matthew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@matthew](https://www.ruby-forum.com/u/matthew)\
**Post date:** [August 1, 2007, 4:22am UTC](https://www.ruby-forum.com/t/problem-creating-soap-request/110835/5 "2007-08-01T04:22:10Z")

</div>

-----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](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-----
