# SOAP problems

**URL:** <https://rubytalk.org/t/soap-problems/37207>\
**Category:** ruby-talk\
**Created:** [26 April 2007 17:20 UTC](https://rubytalk.org/t/soap-problems/37207 "2007-04-26T17:20:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_B](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@Mike\_B](https://rubytalk.org/u/Mike_B)\
**Post date:** [26 April 2007 17:20 UTC](https://rubytalk.org/t/soap-problems/37207/1 "2007-04-26T17:20:12Z")

</div>

Here is my irb session:

irb -r soap/wsdlDriver  
irb(main):001:0\> end\_point = "[http://my.endpoint.com/cgi-bin/ipc-](http://my.endpoint.com/cgi-bin/ipc-)  
SOAP/"  
=\> "[http://my.endpoint.com/cgi-bin/ipc-SOAP/](http://my.endpoint.com/cgi-bin/ipc-SOAP/)"  
irb(main):002:0\> soap =  
SOAP::WSDLDriverFactory.new(end\_point).create\_rpc\_driver  
WSDL::XMLSchema::Parser::UnknownElementError: unknown element: {}html  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:116:in  
`decode\_tag'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:82:in  
`start\_element'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/xsd/xmlparser/parser.rb:67:in  
`start\_element'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/xsd/xmlparser/rexmlparser.rb:34:in  
`tag\_start'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/rexml/parsers/streamparser.rb:24:in  
`parse'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/rexml/document.rb:173:in `parse\_stream'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/xsd/xmlparser/rexmlparser.rb:27:in  
`do\_parse'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:63:in `parse'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:42:in  
`parse'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/wsdl/importer.rb:31:in `parse'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:30:in  
`import'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/wsdl/importer.rb:18:in `import'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/soap/wsdlDriver.rb:124:in `import'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/1.8/soap/wsdlDriver.rb:28:in `initialize'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):2  
irb(main):003:0\>

This works with some perl code I have, so I know the server is working  
as it should.

Google was unhelpful.

Is it possible I am missing that the soap4r package needs, but isn't a  
dependency?

Mike B.

> **···**
>
> from :0

---

<div class="post-metadata">

**Author:** ![Philipp\_Taprogge](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@Philipp\_Taprogge](https://rubytalk.org/u/Philipp_Taprogge)\
**Post date:** [26 April 2007 18:50 UTC](https://rubytalk.org/t/soap-problems/37207/2 "2007-04-26T18:50:07Z")

</div>

Hi!

Thus spake barjunk on 04/26/2007 07:18 PM:

> Here is my irb session:
> 
> irb -r soap/wsdlDriver  
> irb(main):001:0\> end\_point = "[http://my.endpoint.com/cgi-bin/ipc-](http://my.endpoint.com/cgi-bin/ipc-)  
> SOAP/"  
> =\> "[http://my.endpoint.com/cgi-bin/ipc-SOAP/&quot](http://my.endpoint.com/cgi-bin/ipc-SOAP/&quot);  
> irb(main):002:0\> soap =  
> SOAP::WSDLDriverFactory.new(end\_point).create\_rpc\_driver  
> WSDL::XMLSchema::Parser::UnknownElementError: unknown element: {}html

> Is it possible I am missing that the soap4r package needs, but isn't a  
> dependency?

Unlikely. The error is pretty obvious: the XML parser encountered an  
element it did not expect in the server's response: \<html\>.

This suggests that the server is not returning an XML document at  
all but rather a normal web page. Perhaps this is a 404 or 500 error  
page?  
In any case, the create\_rpc\_driver method experts to find a WSDL  
file which the server must provide.  
Perhaps your perl code is not using a wsdl driver?

HTH,

&nbsp;&nbsp;Phil

---

<div class="post-metadata">

**Author:** ![Mike\_B](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@Mike\_B](https://rubytalk.org/u/Mike_B)\
**Post date:** [26 April 2007 23:40 UTC](https://rubytalk.org/t/soap-problems/37207/3 "2007-04-26T23:40:06Z")

</div>

\<snip previous stuff\>

> Unlikely. The error is pretty obvious: the XML parser encountered an  
> element it did not expect in the server's response: \<html\>.
> 
> This suggests that the server is not returning an XML document at  
> all but rather a normal web page. Perhaps this is a 404 or 500 error  
> page?  
> In any case, the create\_rpc\_driver method experts to find a WSDL  
> file which the server must provide.  
> Perhaps your perl code is not using a wsdl driver?
> 
> HTH,
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Phil

Phil,

Turns out that you are right, I type-od the url...shoulda been https.

That was self-inflicted wound.

Now all I have to do is figure out how to pass some arguments to the  
soap call and I'll be moving along.

The perl is:

my $login\_result = $soap-\>call('login' =\> ('username', 'pass'))-

> result;

but I haven't figured out to do it with ruby. I have tried:

irb(main):170:0\> p soap.call("login")  
"No username passed"  
=\> nil

Which makes sense, but have no idea how to pass the username and  
password. But I'll keep digging!

Mike B.

> **···**
>
> On Apr 26, 10:46 am, Philipp Taprogge \<Philipp.Tapro...@gmx.net\> wrote:

---

<div class="post-metadata">

**Author:** ![Mike\_B](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@Mike\_B](https://rubytalk.org/u/Mike_B)\
**Post date:** [27 April 2007 00:15 UTC](https://rubytalk.org/t/soap-problems/37207/4 "2007-04-27T00:15:04Z")

</div>

OK...so here it is.

end\_point = "[https://my.endpoint.com/cgi-bin/ipc-SOAP/&quot](https://my.endpoint.com/cgi-bin/ipc-SOAP/&quot);  
soap = SOAP::RPC::Driver.new(end\_point,"urn:/myurn")  
soap.options['protocol.http.ssl\_config.verify\_mode'] =  
OpenSSL::SSL::VERIFY\_NONE  
soap.add\_method\_with\_soapaction('login', 'login', "defaultusername",  
"defaultpassword")  
soap.login("realuser","realpass")

In my case if use a valid username/pass pair I get a 1, if not, a nil.

I'm not really sure what the purpose of putting defaultusername and  
defaultpassword in the add\_method statement above, but I tried "" and  
" ", neither worked. I had to actuall put string values.

For example:

soap.add\_method\_with\_soapaction('login', 'login', "a", "b")

still worked, but :

soap.add\_method\_with\_soapaction('login', 'login', "", "")

and

soap.add\_method\_with\_soapaction('login', 'login', " ", " ")

didn't.

Thanks for the feedback. Sure would be great if there was more  
documentation with the soap4r stuff...where can I submit some?

Mike B.

> **···**
>
> On Apr 26, 3:38 pm, barjunk \<barj...@attglobal.net\> wrote:
> 
> > On Apr 26, 10:46 am, Philipp Taprogge \<Philipp.Tapro...@gmx.net\> \> wrote:  
> > \<snip previous stuff\>
> > 
> > \> Unlikely. The error is pretty obvious: the XML parser encountered an  
> > \> element it did not expect in the server's response: \<html\>.
> > 
> > \> This suggests that the server is not returning an XML document at  
> > \> all but rather a normal web page. Perhaps this is a 404 or 500 error  
> > \> page?  
> > \> In any case, the create\_rpc\_driver method experts to find a WSDL  
> > \> file which the server must provide.  
> > \> Perhaps your perl code is not using a wsdl driver?
> > 
> > \> HTH,
> > 
> > \> Phil
> > 
> > Phil,
> > 
> > Turns out that you are right, I type-od the url...shoulda been https.
> > 
> > That was self-inflicted wound.
> > 
> > Now all I have to do is figure out how to pass some arguments to the  
> > soap call and I'll be moving along.
> > 
> > The perl is:
> > 
> > my $login\_result = $soap-\>call('login' =\> ('username', 'pass'))-
> > 
> > \>result;
> > 
> > but I haven't figured out to do it with ruby. I have tried:
> > 
> > irb(main):170:0\> p soap.call("login")  
> > "No username passed"  
> > =\> nil
> > 
> > Which makes sense, but have no idea how to pass the username and  
> > password. But I'll keep digging!
> > 
> > Mike B.

---

<div class="post-metadata">

**Author:** ![Mike\_B](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@Mike\_B](https://rubytalk.org/u/Mike_B)\
**Post date:** [1 May 2007 18:45 UTC](https://rubytalk.org/t/soap-problems/37207/5 "2007-05-01T18:45:05Z")

</div>

Further study gives more information, the two fields are the 'names'  
that the soap action will use.

Example:

username="defaultuser"  
password="defaultuser"  
soap.add\_method\_with\_soapaction('login','login',username, password)

soap.login("actualuser","actualpass") will fail because the  
'actualuser' value will be passed to both arguments because of the  
initial setting above of defaultuser to both the username and  
password.

To solve this, password would have to be set to 'defaultpass' or some  
other different value.

I guess it is using the value passed in the add\_method as the variable  
name it uses in the action.

Someone with more knowledge might want to expand on this, but I  
thought I would share what I found out.

Mike B.

> **···**
>
> On Apr 26, 4:13 pm, barjunk \<barj...@attglobal.net\> wrote:
> 
> > On Apr 26, 3:38 pm,barjunk\<barj...@attglobal.net\> wrote:
> > 
> > \> On Apr 26, 10:46 am, Philipp Taprogge \<Philipp.Tapro...@gmx.net\> \> \> wrote:  
> > \> \<snip previous stuff\>
> > 
> > \> \> Unlikely. The error is pretty obvious: the XML parser encountered an  
> > \> \> element it did not expect in the server's response: \<html\>.
> > 
> > \> \> This suggests that the server is not returning an XML document at  
> > \> \> all but rather a normal web page. Perhaps this is a 404 or 500 error  
> > \> \> page?  
> > \> \> In any case, the create\_rpc\_driver method experts to find a WSDL  
> > \> \> file which the server must provide.  
> > \> \> Perhaps your perl code is not using a wsdl driver?
> > 
> > \> \> HTH,
> > 
> > \> \> Phil
> > 
> > \> Phil,
> > 
> > \> Turns out that you are right, I type-od the url...shoulda been https.
> > 
> > \> That was self-inflicted wound.
> > 
> > \> Now all I have to do is figure out how to pass some arguments to the  
> > \>soapcall and I'll be moving along.
> > 
> > \> The perl is:
> > 
> > \> my $login\_result = $soap-\>call('login' =\> ('username', 'pass'))-
> > 
> > \> \>result;
> > 
> > \> but I haven't figured out to do it with ruby. I have tried:
> > 
> > \> irb(main):170:0\> psoap.call("login")  
> > \> "No username passed"  
> > \> =\> nil
> > 
> > \> Which makes sense, but have no idea how to pass the username and  
> > \> password. But I'll keep digging!
> > 
> > \> Mike B.
> > 
> > OK...so here it is.
> > 
> > end\_point = "[https://my.endpoint.com/cgi-bin/ipc-SOAP/"soap=SOAP::RPC::Driver.new(end\_point,"urn:/myurn](https://my.endpoint.com/cgi-bin/ipc-SOAP/%22soap=SOAP::RPC::Driver.new(end_point,%22urn:/myurn)")soap.options['protocol.http.ssl\_config.verify\_mode'] =  
> > OpenSSL::SSL::VERIFY\_NONEsoap.add\_method\_with\_soapaction('login', 'login', "defaultusername",  
> > "defaultpassword")soap.login("realuser","realpass")
> > 
> > In my case if use a valid username/pass pair I get a 1, if not, a nil.
> > 
> > I'm not really sure what the purpose of putting defaultusername and  
> > defaultpassword in the add\_method statement above, but I tried "" and  
> > " ", neither worked. I had to actuall put string values.
> > 
> > For example:
> > 
> > soap.add\_method\_with\_soapaction('login', 'login', "a", "b")
> > 
> > still worked, but :
> > 
> > soap.add\_method\_with\_soapaction('login', 'login', "", "")
> > 
> > and
> > 
> > soap.add\_method\_with\_soapaction('login', 'login', " ", " ")
> > 
> > didn't.
> > 
> > Thanks for the feedback. Sure would be great if there was more  
> > documentation with the soap4r stuff...where can I submit some?
> > 
> > Mike B.
