Brian Candler wrote:

> So what happens when you try these methods?
> 
> What does tcpdump (Linux) or ethereal (Windows) show at the network 
> level?
> 
>     tcpdump -i eth0 -n -s1500 -vX tcp port 80

That nothing was going out over HTTP at all.

> 
>> require 'soap/wsdlDriver'
>> require 'rexml/document'
> 
> Why require these libraries? AFAICT you're just trying to send a
> pre-existing XML file over HTTP.

The soap/wsdlDriver was a hangover from my hacking (in vain) session...

>> #require 'net/http'
>> require 'socket'
>> include Socket::Constants
>> 
>> file = File.new("PDSUpdate.xml")
>> doc = REXML::Document.new(file)
>> #puts doc
>> #http.post("http://inpsesrh02.inpses.co.uk:7778", doc)
> 
> I'd suggest you don't parse the document using REXML. Just read it in as 
> a
> file, and then squirt it out over the HTTP connection. I'm not sure how
> http.post will cope with being given an REXML::Document object.
> 
> Try "ri Net::HTTP" for some samples of how to do a HTTP POST.
> (or "ri1.8 Net::HTTP" under Ubuntu).

I've had a look at this documentation, the sections pertaining to POST 
all refer to form data (e.g. looking at a search box and posting info, 
setting dates and posting etc.) , rather than an individual POST of a 
file.

> Capture the result in a variable, e.g. res = http.post ...
> and inspect it.
> 
> Perhaps you should be posting to a more specific URL, e.g.
>     http.post("http://inpsesrh02.inpses.co.uk:7778/foo/myapp", doc)


>> socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
>> sockaddr = Socket.pack_sockaddr_in( 7779,
>> 'inpsesrh02.inpses.co.uk/orabpel/default/' )
>> socket.connect( sockaddr )
>> socket.puts doc
>> socket.close
> 
> Doing it this way you'd want a TCPSocket.
> See http://www.rubycentral.com/book/lib_network.html
> for some examples.

Think I'd prefer to avoid the socket route if possible anyway.


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