SOAP + HTTP Authentication

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

···

--
Posted via http://www.ruby-forum.com/.

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/soap/basicauth .
Unfortunately I don't know how to do it with AWS client. Someone?

Regards,
// NaHi

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

Oliver

···

On Sun, Feb 05, 2006 at 08:58:21PM +0900, NAKAMURA, Hiroshi wrote:

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/soap/basicauth .
Unfortunately I don't know how to do it with AWS client. Someone?

--
Oliver Andrich --- oliver.andrich@gmail.com --- http://roughbook.de/

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&quot;
    xmlns:env="Error;
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
  <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&quot;
    xmlns:env="Error;
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
  <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 ?

···

On 2/5/06, Oliver Andrich <oliver.andrich@gmail.com> wrote:

On Sun, Feb 05, 2006 at 08:58:21PM +0900, NAKAMURA, Hiroshi wrote:
> 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/soap/basicauth .
> 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

--
Oliver Andrich --- oliver.andrich@gmail.com --- http://roughbook.de/

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&quot;
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/&quot;
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
  <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&quot;
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/&quot;
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
  <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

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&quot;
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/&quot;
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
  <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" ?>

···

On 2/17/06, Drew Butler <nodrew@gmail.com> wrote:

<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema&quot;
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/&quot;
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
  <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 ?

On 2/5/06, Oliver Andrich <oliver.andrich@gmail.com> wrote:
>
> On Sun, Feb 05, 2006 at 08:58:21PM +0900, NAKAMURA, Hiroshi wrote:
> > 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/soap/basicauth .
> > 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
>
> --
> Oliver Andrich --- oliver.andrich@gmail.com --- http://roughbook.de/
>
>