Skip to content

Instantly share code, notes, and snippets.

@Fivell
Forked from simonharrer/gist:1173228
Created November 2, 2012 14:31
Show Gist options
  • Save Fivell/4001706 to your computer and use it in GitHub Desktop.
Save Fivell/4001706 to your computer and use it in GitHub Desktop.
Use JRuby to create a Java Soap Web Service
require 'java'
require 'jruby/core_ext'
module WS
class WebService
def test()
puts "Call received at #{Time.new}"
# x = Result.new
# x.name = "asdf"
# return x
"muh"
end
end
class Result
attr_accessor :name
end
# make them accessible for jax-ws
Result.become_java!
WebService.add_class_annotation(javax.jws.WebService => { "targetNamespace" => "http://test.net/muh/"})
WebService.add_method_signature("test", [java.lang.String])
WebService.become_java!
end
Endpoint = javax.xml.ws.Endpoint
Endpoint.publish( "http://localhost:8888/WebServiceService/WebServicePort", WS::WebService.new )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment