Tuesday, February 17th, 2009 | Author: dmw4

Before I start I’d like to thank the SOAP4R Group for giving me a helping hand.

So we’ve got to access a SOAP interface from Ruby. Ruby’s built in library is OK but updating the library (which is an old version of the SOAP4R library) will give you some bug fixes and more features as you’d expect.

You can download the Gem from here: Link That page contains a few links to more help on SOAP4R.

From ground up following this guide (I wont rewrite mark Thomas’ guide it’s pretty concise)  I chose the “Generate classes from WSDL”. It’s just a bit more convenient and you can see which methods you can run.

So you’ll hopefully end up with file such as

  • DefaultClient.rb
  • default.rb
  • defaultDriver.rb
  • defaultMappingRegistry.rb

You’ll need 2 more files.I’ve called them main.rb & soapAuthentication.rb. Extracting the Authentication header extension out to it’s own file:

require 'soap/header/simplehandler'
class SoapAuthHeader < SOAP::Header::SimpleHandler
NAMESPACE = 'http://namespace'
DIGEST  = 'digest'
ENCODING = 'none'
SIGNATURE  = 'signature'
  def initialize()
super(XSD::QName.new(NAMESPACE, 'Trust'))
  end

def on_simple_outbound
{
"Encoding" => ENCODING,
"Digest" => DIGEST,
"Signature" => SIGNATURE
}
end
end

The above code adds Encoding, Digest and a Signature to the header when sending the SOAP envelopes. So for example on outbound it now adds:

   <env:Header>
      <n1:Trust xmlns:n1="http://questionmark.com/QMWISE/" env:mustUnderstand="0">
         <n1:Signature>9354A730B02651997F02ED97BEA3B439</n1:Signature>
         <n1:Digest>8C6504C136A975BBFC420499B4444BC3</n1:Digest>
         <n1:Encoding>none</n1:Encoding>
      </n1:Trust>
   </env:Header>

Within main.rb I’ve got

require ‘defaultDriver.rb’
require ’soapAuthentication.rb’

## Create SOAP Driver
wsdl = “your WSDL location”

obj = DefaultSOAP.new()
obj.wiredump_dev = STDERR if $DEBUG #add some debugging to the command line

trust = SoapAuthHeader.new #create a new authentication header
obj.headerhandler << trust #adds the header to outbound envolopes

If you’ve found this useful (or wrong) leave me a comment.

Category: Ruby  | Tags: ,  | Leave a Comment
Thursday, October 23rd, 2008 | Author: dmw4

The hell of getting postgresql and ruby to work finally is over.

gem install ruby-postgres

however this doesn’t fully install the driver. Locate a copy of sleay32.dll, libpq.dll, comerr32.dll, libintl-2.dll, krb5_32.dll, libeay32.dll, libiconv-2.dll from here postgresql-8.3.4-1-binaries-no-installer.zip or when I upload the files, from here.

to check whether it’s installed correctly or not.

M:\>irb
irb(main):001:0> require ‘postgres’
=> true

If this is true. Go play.

Category: Ruby  | Tags: , ,  | Leave a Comment
Wednesday, October 15th, 2008 | Author: dmw4

I finally found a nice simple way to update Ruby Gems when you’re behind a proxy thanks to Nigel Thorne.

set HTTP_PROXY=http://[username]:[password]@[proxyserver]:[port]

or if your proxy doesn’t use authentication

set HTTP_PROXY=http://[proxyserver]:[port]

Since the Gem software looks for the upper case HTTP_PROXY variable when executing it’ll take this from teh environment variable and work it’s magic. This makes everything a lot simpler and gives me one less reason to use NetBeans, as I never liked it inability to choose from gem updates.

Category: Uncategorized  | Tags: ,  | Leave a Comment
Wednesday, October 08th, 2008 | Author: dmw4

Looks like I just couldn’t stay away from Aberystwyth. I’ve landed a job in Information Services up at the University doing “systems development & support” on web based services at the Uni. At the moment I’ve been playing around with my own SharePoint site for the last 2 hours.

Being my birthday today the weather’s great and I’m off out for a drink tonight. Cheers!

 

Friday, June 27th, 2008 | Author: dmw4

Well I’m there at last, and I managed to pull a 2:1 out of the hat. My dissertation result of 65% must have pulled my grade up a fair few marks, which I’m really glad about. I spent many a sleepless night on it and without a few key people (who know who they are) I definitely wouldn’t have gotten as far as I did.

I’ve just landed a job at the NHS doing 3rd line technical support, or more precisely phone support for near on 1,000. It’s only temporary for now as I’m still thinking of moving to Bristol at the end of summer

There are a few projects in the pipeline, such as “The Magazine” which is primarily a web based venture covering topics from the arts to psycho-geography. If you don’t know what psycho-geography is head on over for an explanation from Luke. There is another project in the pipeline which is advertising based, however that’s all I’ve been told so far about the job specification so it’s anyone’s guess at this point that the system will do.

Finally, my passing out ceremony is on the 18th of July and is broadcast live from the University which you can get to from <this link> if you’re bored and fancy watching people look silly in gowns.

Dan

Saturday, May 17th, 2008 | Author: dmw4

If you’re interested in Ruby and programming issues in general some of the following links might be useful:

Zen and the Art of Programming - A general Ruby, Rails blog, the RSS feed from this is great if you want to keep track of goings on outside the Rails community.

Ongoing - An interesting read for those who want a recap of the “interesting” bits of programming conferences like JavaOne. At the time of posting this he’s gone into full flower-picture-taking-mode, andsome of them are fantastic.

Stevey’s Blog Rants - this one is great only if you’ve got a lot of time on your hands. There’s an interesting article about the come back of dynamic lanaguages and some methods/tools to speed them up that are just around the corner.

IT Signals - useful for finding out how plug-ins that he uses work. Maybe useful, might not be.

Too-biased - musings on subjects from CouchDB to ActiveShipping (A rails merchant plug-in) and then some…

If you’ve got any more interesting sites that you regularly read along the same lines as any of the above leave me a comment and I’ll add it to the list.

Dan

Category: Rails, Ruby  | Tags: , ,  | Leave a Comment
Thursday, April 17th, 2008 | Author: dmw4

It’s all printed and bound a day early. I’m quite pleased in a way it’s all over.

The project has taught me a decent amount of Ruby on Rails, however I’m not planning on making a career out of it just yet.It’s been far more interesting than many other programming projects I’ve taken part in, in the past 4 years.

It’s quite strange to think that my 4 years at University will be up within a months time. I’m looking to go into a customer facing job, interfacing between programmers and and the public. So if you’re hiring give my CV a quick look over.

Dan

Category: University  | Tags: , , ,  | Leave a Comment