Forum: Ruby SOAP + HTTP Authentication

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ef20f94e98ccde4f4724d9979c819645?d=identicon&s=25 Drew Butler (Guest)
on 2005-12-27 07:43
Hey,

Just had a question. Been pulling out my hair all weekend trying to get
SOAP
to work properly in Rails and even straight on Ruby. I started with
Rails'
AWS and moved to Ruby's internal libraries, after which I tried out
SOAP4R.

Now, my question is, does Rails or even Ruby itself support SOAP client
calls through basic HTTP Authentication? From the research I've done,
this
is an unsupported feature. I am however not willing to give up on this
yet
until I get some input from people who are definitely more experienced
than
myself.

If anyone has done this or knows a good article or tutorial, or even
reference in a manual (so I can RTFM) please let me know. I've got a
client
who is looking to do this I and I need to make for 100% certain that
this is
possible to do, as it is a critical component of the application
interface.

Thanks in advance,

~Drew
C4ec160c6223ee24609cbd07fd922be5?d=identicon&s=25 NAKAMURA, Hiroshi (Guest)
on 2006-02-05 13:01
(Received via mailing list)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Sorry for late reply.

Drew Butler wrote:
> Now, my question is, does Rails or even Ruby itself support SOAP client
> calls through basic HTTP Authentication? From the research I've done,
> this
> is an unsupported feature. I am however not willing to give up on this
> yet
> until I get some input from people who are definitely more experienced
> than
> myself.

soap4r supports BasicAuth.  cf.`
http://dev.ctor.org/soap4r/browser/trunk/sample/so... .
 Unfortunately I don't know how to do it with AWS client.  Someone?

Regards,
// NaHi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)

iD8DBQFD5egrf6b33ts2dPkRAjqHAJ9a9iYzYVdZcRebAOF8Y3iw8aqWzgCfd++f
eUkMqVOOZPVPyN287k8LYfk=
=KVwZ
-----END PGP SIGNATURE-----
92324d1a212698587be6a5f349c7a9b4?d=identicon&s=25 Oliver Andrich (oandrich)
on 2006-02-05 14:04
(Received via mailing list)
On Sun, Feb 05, 2006 at 08:58:21PM +0900, NAKAMURA, Hiroshi wrote:
> soap4r supports BasicAuth.  cf.`
> http://dev.ctor.org/soap4r/browser/trunk/sample/so... .
>  Unfortunately I don't know how to do it with AWS client.  Someone?

Well, if you have installed http-access2 it actually does basic auth.

Oliver
Ef20f94e98ccde4f4724d9979c819645?d=identicon&s=25 Drew Butler (nodrew)
on 2006-02-17 16:47
(Received via mailing list)
Yeah, I ended up discovering http-access2 a little while back. It
defintely
does work using this method. I wish there had been some more
documentation
out there pointing me in this direction. Luckily though some old posts
in
ruby-talk had allowed me the insite that Soap4r will automatically
detect if
http-access2 is installed and with the proper othions added, it will
login
to a server for you.

Thanks for the help though.

Now I just have to figure out why the soap outputted is slightly
different
between rails and a plain ruby script. The main issue I'm seeing now is
that
a particular Soap server that I'm working with is dependant on the order
that variables is passed in, rather than the names themselves.

When I script through Ruby itself, it will pass the variables properly,
when
I run this same script through a Rails front-end however, the variables
get
flipped. This means:

<?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>
    <find xmlns="urn://pace2020.com/epace/sdk/FindObjects">
      <in0>InventoryItem</in0>
      <in1>@customer ='BIELUM'</in1>
    </find>
  </env:Body>
</env:Envelope>

becomes:

<?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>
    <find xmlns="urn://pace2020.com/epace/sdk/FindObjects">
      <in1>@customer ='BIELUM'</in1>
      <in0>InventoryItem</in0>
    </find>
  </env:Body>
</env:Envelope>

I'm currently working with the provider of this service to understand
why
they're order dependant, when the variables are different, but am unsure
why
there is a difference between the outputs of soap4r depending on how the
script is run, even though NOTHING has changed between the two. They
both
are run through the same objects created by wsdl2ruby ....

Any thoughts ?
Ef20f94e98ccde4f4724d9979c819645?d=identicon&s=25 Drew Butler (nodrew)
on 2006-02-17 17:54
(Received via mailing list)
Just a quick follow up. I just noticed that it appears that Soap4r is
sorting the variable:

  @@schema_element = [
    ["in0", "SOAP::SOAPString"],
    ["in1", "SOAP::SOAPString"],
    ["in3", "SOAP::SOAPString"],
    ["in2", "SOAP::SOAPString"],
  ]

The Soap it outputs is:

<?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>
    <find xmlns="urn://pace2020.com/epace/sdk/FindObjects">
      <in1>@customer ='BIELUM'</in1>
      <in2>in2</in2>
      <in3>in3</in3>
      <in0>InventoryItem</in00>
    </find>
  </env:Body>
</env:Envelope>

Which tells me that there is some sort of Array sorting occuring here.
Now
note, if run in just ruby, this same code becomes:

<?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>
    <find xmlns="urn://pace2020.com/epace/sdk/FindObjects">
      <in3>in3</in3>
      <in0>InventoryItem</in0>
      <in1>@customer ='BIELUM'</in1>
      <in2>in2</in2>
    </find>
  </env:Body>
</env:Envelope>

Either way, we're seeing very strange behavior. It almost appears as if
the
array is being sorted then pushed or flipped .... I've been looking
through
the Rails API, looking for a possible extension done to the sort array
methods, but have been unable to find one. Either way, my question now
is,
can I just turn off sorting? Can it just use the order I specify in the
@@schema_element class property ?

Thanks, I'll also be directing this directly to the Soap4r site as well.
Hopefully someone out there, who is more experienced with this object
than
I, will be able to help out.

~Drew


On 2/17/06, Drew Butler <nodrew@gmail.com> wrote:
> Thanks for the help though.
> get
>     </find>
>   </env:Body>
> </env:Envelope>
>
> becomes:





<?xml version="1.0" encoding="utf-8" ?>
This topic is locked and can not be replied to.