On Nov 2, 2005, at 6:22 PM, Kero wrote:

>> One important difference is that the SOAP packets in the two  
>> examples are using
>> different "Soap Styles". Specifically, what you're seeing on the  
>> wire (and what
>> you want) is Document-style. The example that you dumped showed a  
>> SOAP packet
>> that is using Soap Encoding for the XML (i.e., or more  
>> specifically, it uses
>> RPC/Encoded rather than the Doc/Literal style you are looking for).
>>
>
> Am I looking at different defaults (yuck) or is the wsdl setting this?
>

The server you are attempting to call determines it. THe server  
describes the web services it makes available (and the soap style,  
etc) using WSDL (Web Service Description Language).

>
>> You can see where you dump the xml that you specify RPC/Encoded  
>> style:
>>
>>
>>> client = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver
>>>
>>
>> See how you're specifying to create an RPC driver (using  
>> "create_rpc_driver")?
>>
>
> RPC == remote procedure call (playing advocate of the devil here) what
> does that say about encoding? to my uneducated mind, it says nothing
> (Ruby Drb does rpc as well; I have a module in my kernel called  
> sunrpc)
>

RPC SOAP calls generally use SOAP Encoding. See the WSDL spec for  
more details:

     http://www.w3.org/TR/wsdl

You can link from this document to others that define SOAP encoding,  
etc.

The standards docs provide pretty good detail -- but if you're just  
beginning, it's likely better to read some articles on-line to get  
started or pick up a book on web services. I'd look at amazon and  
figure out which is best. It's really a pretty deep subject and takes  
more than a few listserv messages to summarize, although you can get  
by pretty well if you just learn the basics.

>
>> One of the first steps is to figure out how to dump a version of  
>> the soap
>> envelope that uses Document/Literal rather than the RPC/Encoded  
>> for your SOAP.
>> I'd begin by looking to see if there's something like:
>>
>> client = SOAP::WSDLDriverFactory.new(wsdl_url).create_doc_driver
>>
>> If not, look through the documentation to see how to specify Doc/ 
>> Literal
>> encoding.
>>
>
> "the documentation" ?
> I found absolutely no documentation concerning ruby/soap.
> I found example code for trivial stuff, so I'm happy I got *something*
> across the wire without an error.
>
> I think I want "direct", not soap envelope.

There are other ways to send XML over HTTP without using SOAP and  
"web services" -- assuming you are in control of BOTH the server and  
the client. If you control both ends, then simply HTTP posting XML as  
a string to a normal rails controller would work fine. Then the  
server side of your app can just get the xml and parse it directly.

If you don't control the server you need to interact with and it  
publishes its data using SOAP/Web Services, then you probably have to  
use SOAP/Web Services. If that's the case, then get the WSDL from the  
server (it looks like you've got a URL that points to the WSDL that  
you can just point a browser to to get the WSDL. Once you've got the  
WSDL then look it over and do some research to figure out what it  
wants you to do -- there's really no other way. Whoever publishes the  
server can likely help you.

Once you understand how the web service works, you can probably  
figure out the ruby classes without much documentation --


>
>> I'm not sure where to go from there, but I think understanding the  
>> SOAP encoding
>> style you need to send should be your first step. I'd also review  
>> the WSDL of
>> the service you're trying to invoke to see what it expects as well  
>> -- it would
>> probably require either one or the other of RPC/Encoded or Doc/ 
>> Literal. You
>> need to make sure you using the correct style before trying to  
>> invokde the
>> service.
>>
>
> Does ruby allow me to query it?
>
> What is a SOAPArray? a SOAPStruct? playing with it gives me worse
> results, but how can I know which ruby classes match the wsdl
> description? Is it built for me? How?
>


I wish I could answer these. Sorry, but my knowledge is primarily  
from the Java world -- I've not used web services with Ruby yet. I  
know how to understand the XML and the data on the wire, but the ruby  
classes are beyond what I know currently... Sorry!