OpenPathMedia Logo
O-Marks
O-Marks FAQ
Agile Web and Software Development
Home   |    Web Design   |    Consulting   |    Products   |    Portfolio   |    Blog    |    About    |    Contact

:: Welcome

Black Path Welcome to OpenPathMedia. We are providers of web design, software consulting, iPhone development, and agile software development.
O-Marks Screenshot

O-Marks

OpenPathMedia is proud to announce the release of O-Marks for the iPhone. O-Marks allows you to view your bookmarks stored on either Delicious or FoxMarks and then launch the Safari browser with the link. O-Marks is designed to give you access to your bookmarks wherever you go with the fewest number of clicks.

Find out more >>

Recent Blog Posts

Nigel Thorne has a great solution for updating gems while behind a secure proxy:

Execute this command:
set HTTP_PROXY=http://[username]:[password]@[proxyserver]:[port]
… and then run gem update.

Beware that if you have special characters in your username or password you’ll need to URL encode those. Scroll down about 3 pages here for a urlencoder. Recommend you don’t put your full username and password in, though.

September 2nd, 2008 by Travis Sparks

I’ve been working on a Rails application that needed to access a .NET webservice that I have no control over. While doing this turned out to be relatively easy in the end, I found it very difficult to find any conclusive information on the web. Sometimes the ‘magic’ of rails actually makes things harder. Below I’ll share what I did and some of the pitfalls that I found were easy to fall into.

First up my Ruby on Rails code:

require 'soap/wsdlDriver'
wsdl = "http://localhost/mywebservice.asmx?WSDL"
service = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
auth = service.Authenticate( :Password => params[:password], :UserId => params[:name] )
if auth.authenticateResult == “true”
… do something …
end

  • The first line includes the wsdl driver.
  • The second line is a link to the .NET webservice’s WSDL file.
  • The next line does two things. First it creates a WSDLDriverFactory and then a driver for the service. At this point ’service’ has access to all of the exposed services listed in the WSDL.
  • I call the Authenticate method with two parameters: Password and UserID. This is where I got a little confused by the ‘magic’. The parameters should be preceded by a colon and should be exactly the same case as the parameters are defined in the WSDL. Do not make the first characters a lower-case as you might elsewhere in rails unless the WSDL defines the parameter that way.
  • The if statement uses the result. Note here the WSDL defines AuthenticateResult with a leading capital, but in ruby we have to use a lower-case letter. In this case, the result is a boolean but must be treated as text and is why the if statement compares to the “true” text.

I found this example code the most useful in helping me: http://dev.ctor.org/soap4r/browser/trunk/sample/wsdl/googleSearch/wsdlDriver.rb?rev=1605

Good luck!

September 2nd, 2008 by Travis Sparks