Coder Social home page Coder Social logo

handsoap's People

Contributors

jmhodges avatar jstotz avatar troelskn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

handsoap's Issues

Official releases on rubyforge

Hi,

would it be possible that you create a project on rubyforge for releasing the official handsoap library (as .tgz and .gem)? With the help of the rubyforge gem or the hoe gem, it is rather easy to release files/news on rubyforge and rubyforge is still the main gem server. Then it would be possible to specify handsoap as dependency in other gems.

If you like, I can provide you with the basic rake tasks.

Best regards,
Thomas

ps. Why .tgz? Linux distributions don't really like gems and are more comfortable with .tgz files. And creating the .tgz file along the .gem file is no additional effort.

handsoap license

Hi,

handsoap is currently under an CC-BY 2.5 license which is not compatible with GPL v3. Would it be possible for you to release handsoap under a GPL v3 compatible license or to explicitly dual-license it?

Best regards,
Thomas

Make adding the xml header optional

One other small request: some SOAP services don't like the header (Intel AMT SOAP services being one of them). It seems to be trivial to add an accessor to Handsoap::XmlMason::Document which controls whether an XML header is written or not.

HTTP authentication support?

I needed to use HTTP authentication for the SOAP service I was consuming. I forked the project to implement this, however I found out that it is actually possible already using on_after_create_http_client hook:

def on_after_create_http_client(http_client) 
 http_client.userpwd = "#{self.class.username}:#{self.class.password}"
end

This probably only works with curb; I haven't tested it with httpclient. Maybe this can be added as a feature to handsoap with a nicer API than the example above. Otherwise, this code snippet could be added to the documentation.

net/http driver and HTTPS

Hi,

not sure what your plans regarding SSL are, but for my use case a simple:

http_client.use_ssl = true if url.scheme == 'https'

in the NetHttp#send_http_request method did the trick for submitting requests to a HTTPS endpoint.

Cheers,
Florian

script/generate handsoap - No such file or directory

script/generate handsoap -t https://gateway.developer.telekom.com/p3gw-mod-odg-sms/services/SmsService?wsdl
exists app
exists app/models
readlink: illegal option -- f
usage: readlink [-n] [file ...]
create app/models/sms_service.rb
No such file or directory - /opt/local/lib/ruby/gems/1.8/gems/handsoap-0.3.4/generators/handsoap/templates/var/folders/hi/hijrjnD8Fr8jbSKY1SYB+E+++TI/-Tmp-/handsoap_generator.2017.0
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/commands.rb:377:in initialize' /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/commands.rb:377:inopen'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/commands.rb:377:in render_file' /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/commands.rb:260:infile'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/commands.rb:259:in open' /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/commands.rb:259:infile'
/opt/local/lib/ruby/gems/1.8/gems/handsoap-0.3.4/generators/handsoap/handsoap_generator.rb:87:in file_contents' /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/manifest.rb:47:insend'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/manifest.rb:47:in send_actions' /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/manifest.rb:46:ineach'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/manifest.rb:46:in send_actions' /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/manifest.rb:31:inreplay'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/commands.rb:42:in invoke!' /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/scripts/../scripts.rb:31:inrun'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/generate.rb:6
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire'
script/generate:3

undefined method `to_utf8'

I'm having some problem when going from 0.2.9 => 0.3.1.

There is an exception when using xml_to_str
undefined method `to_utf8' for #Handsoap::XmlQueryFront::NokogiriDriver:0xb66b28b0

Problem with chunked http response

I'm getting errors when the service returns a chunked http-response. Curl seems to include this in the header part, causing a bad header '"\r\n"'. error.

generator not working

$ ./script/generate handsoap http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl weather
    exists  app
    exists  app/models
Expected exactly 1 interface/portType in WSDL

if I try the same steps that the generator does in script/console, I get that same failure with a stacktrace:

>> compiler.compile_service(protocol, :soap_actions)
RuntimeError: Expected exactly 1 interface/portType in WSDL
  from /Library/Ruby/Gems/1.8/gems/troelskn-handsoap-0.5.4/lib/handsoap/parser.rb:133:in `interface'
  from /Library/Ruby/Gems/1.8/gems/troelskn-handsoap-0.5.4/lib/handsoap/compiler.rb:137:in `compile_service'
  from /Library/Ruby/Gems/1.8/gems/troelskn-handsoap-0.5.4/lib/handsoap/compiler.rb:54:in `write'
  from /Library/Ruby/Gems/1.8/gems/troelskn-handsoap-0.5.4/lib/handsoap/compiler.rb:120:in `compile_service'
  from (irb):17

running on Mac OX 10.5.8, with the following software versions:

master $ rails -v
Rails 2.3.2
master $ ruby -v
ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
master $ gem list troelskn-handsoap

*** LOCAL GEMS ***

troelskn-handsoap (0.5.4)

Setting additional headers in on_before_dispatch

Setting additional headers on the HTTP client (only tested with Curb) in the on_before_dispatch hook does not work, because they are overwritten later on in the send_http_request method.

    http_client = Curl::Easy.new(uri)
    on_after_create_http_client(http_client) # headers are set here
    http_client.headers = headers # overwrite occurs here

Because of this, setting up Basic Authorization using a header does not work. This can easily fixed by using merge!:

    http_client.headers.merge!(headers)

However, maybe we can add an API to set additional HTTP headers?

handsoap parsing soap response problem

Hello:

I am a moderately experienced Ruby scripter, but with almost zero soap experience. I am just starting writing an client that is running against a service provided through Axis2. It appears the service accepts my request, processes it, and sends a response.

The problem comes when handsoap's parser (nokogiri in this case) tries to parse the response. It always raises an error and I have to see the result using the result to the "on_missing_document" method.

EDIT: Removed junk that was the result of a misunderstanding on my part. SOAP isn't easy on beginners!

Customized Fault parsing

Hi,

the "on_fault" method raise the Fault object but if it is not formatted the way it is supposed to be (Code and Reason tags), I didn't find a way to get to the Response object to parse it manually and raise the real error code, โ€ฆ

Maybe, if it is possible to set something different than "lazy" for the fault handling, we could have the Response object returned instead of a regular Fault object

XmlMason: CDATA values shouldnt be escaped

Contents of statements like his souldnt be encoded:

element.set_value("<[[CDATA[bla]]>")

It would be great If there was a way to prevent it.

A quick workaround could look like this:

module Common
class NonEscapingString < String
def gsub(arg)
self
end

 def to_s
   self
 end

end
end

Just wrap code that shouldn't be escaped with a NonEscapingString class. Not very beautiful.

Large multipart responses failing

In service.rb line 413, ::Tempfile objects don't have the .string method, so it died there. I hacked the following in an attempt to get around, but I don't know if this is correct:

*** /var/lib/gems/1.8/gems/troelskn-handsoap-0.4.3/lib/handsoap/service.rb 2009-08-09 11:41:50.433057698 -0400
--- /var/lib/gems/1.8/gems/troelskn-handsoap-0.4.3/lib/handsoap/service-dannys.rb 2009-08-09 11:39:26.297058435 -0400


*** 360,365 ****
--- 360,366 ----

  loop do
    head = nil
  • mycontent_length=content_length
    if 10240 < content_length
      require "tempfile"
      body = Tempfile.new("CGI")
    

    *** 410,416 ****
    ""
    end

! parts << {:head => head, :body => body.string}
break if buf.size == 0
break if content_length == -1
end
--- 411,425 ----
""
end

! if body.kind_of? ::StringIO then
! parts << {:head => head, :body => body.string}
! elsif body.kind_of? ::Tempfile then
! bodystring=""
! body.read(mycontent_length, bodystring)
! parts << {:head => head, :body => bodystring}
! else
! raise "body must be StringIO or Tempfile"
! end
break if buf.size == 0
break if content_length == -1
end

Anyway, after changing the service.rb, I now get:

"Exception `Handsoap::XmlQueryFront::ParseError' at /var/lib/gems/1.8/gems/troelskn-handsoap-0.4.3/lib/handsoap/xml_query_front.rb:56 - Handsoap::XmlQueryFront::ParseError"

This is probably to do with my hack not being the right way to do it, specifically I couldn't figure out whether "content_length" is the right size to use for the body.read.

Before throwing the parse error, I receive 3 parts of the response. The first two (64894 bytes and 34174 bytes) go fine. I'll forward all the files in an email.

--- Request ---
URI: http://10.0.1.231:8080/axis2/services/DataCentricService
SOAPAction: GetObjectViewByCategoryRequest

Content-Type: text/xml;charset=UTF-8

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header />
env:Body
<dat:GetObjectViewByCategoryRequest xmlns:dat="http://juniper.net/nbiservice/datacentricservice">
<core:AuthToken xmlns:core="http://juniper.net/core">
core:Tokenee6a7186-208a-4d97-8427-40da4c73cda0/core:Token
/core:AuthToken
dat:categorydeviceobj/dat:category
dat:domainId1/dat:domainId
/dat:GetObjectViewByCategoryRequest
/env:Body
/env:Envelope
--- Response ---
HTTP Status: 200
Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_FF5B45112F1A1EA3831249832076826; type="application/xop+xml"; start="0.urn:uuid:[email protected]"; start-info="text/xml"
--- Part #1 ---
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary

Content-ID: 0.urn:uuid:[email protected]

--- Part #2 ---
Content-Type: text/plain;charset=utf-8
Content-Transfer-Encoding: binary

Content-ID: 1.urn:uuid:[email protected]

--- Part #3 ---
Content-Type: text/plain;charset=utf-8
Content-Transfer-Encoding: binary
Content-ID: 2.urn:uuid:[email protected]

Digest Authentication/URI endpoint specification

Hi,

I'm trying to use handsoap to access the Intel AMT soap services. I have across two issues which should be easy to to overcome:

  • Digest authentication: Intel AMT needs digest authentication and httpclient already supports this. However, there is currently (0.5.4) no way to set the security credentials using the httpclient.set_auth method.

    It would be good to have an on_after_create_http_client callback method in the service class which is called after the http client is created but before the request is sent. This would probably mean that the http driver modules would need one more method for returning the driver and that the #send_http_request would need to take the returned http client object as additional parameter. This would allow one to set the credentials in a nice way.

  • URI endpoint specification: With Intel AMT there are many hosts that implement one service. So it makes no sense to specify the URI of the endpoint at the class level. There should be some way to define the URI on a per-object basis and only fall back to the class level when no per-object URI is available.

ps. Would it be possible to make the http driver selectable on a per-service basis, ie. not use Handsoap::Http.driver[Handsoap.http_driver] but something that uses an instance method of the current service to get the driver and if that is nil, fall back to the common one?

Service that returns no soap/xml in reply

I have a soap application that returns a zero length http "accept" (202) in response to a request. handsoap doesn't seem to like this, and this condition doesn't trigger the "on_missing_document" or the "on_fault" hooks. It appears this is an unexpected response, because handsoap generates an exception:

Exception `Handsoap::XmlQueryFront::ParseError' at /var/lib/gems/1.8/gems/troelskn-handsoap-0.4.2/lib/handsoap/xml_query_front.rb:56 - Handsoap::XmlQueryFront::ParseError

Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_FF5B45112F1A1EA3831249656129588; type="application/xop+xml"; start="0.urn:uuid:[email protected]"; start-info="text/xml"
--- Part #1 ---
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary

Content-ID: 0.urn:uuid:[email protected]

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
soapenv:Body
<ns2:LoginResponse xmlns:ns2="http://juniper.net/webproxy/systemservice" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:LoginResponseType">
<ns1:Status xmlns:ns1="http://juniper.net/core">Success/ns1:Status
ns2:loginStatus
ns2:statusSuccess/ns2:status
/ns2:loginStatus
ns2:authToken
<ns1:Token xmlns:ns1="http://juniper.net/core">f30c2116-e407-42bd-89a0-6d38fbfa6b32/ns1:Token
/ns2:authToken
/ns2:LoginResponse
/soapenv:Body

/soapenv:Envelope

--- Request ---
URI: http://10.0.1.231:8080/axis2/services/SystemService
SOAPAction: LogoutRequest

Content-Type: text/xml;charset=UTF-8

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header />
env:Body
<ns2:LogoutRequest xmlns:ns2="http://juniper.net/webproxy/systemservice" />
/env:Body
/env:Envelope
--- Response ---
HTTP Status: 202

Content-Type: text/xml;charset=UTF-8

Error when iterating multipart responses

I have an application that responds with multipart responses. When try to use the xml_document.parts method, I get this error:

Handsoap::XmlQueryFront::NokogiriDriver:0x7ffe4c6e4ba8

/var/lib/gems/1.8/gems/troelskn-handsoap-0.4.4/lib/handsoap/service.rb:277:in parts': undefined local variable or methodresponse' for #Handsoap::XmlQueryFront::NokogiriDriver:0x7ffe4c6e4ba8 (NameError)
from ./nbi/datacentric_service.rb:113:in parse_get_all_devices' from ./nbi/datacentric_service.rb:90:inget_all_devices'
from test.rb:78

Any invocation of the .parts method yields the same error. It looks like a scope problem in service.rb, in the xml_document.parts method. xml_document appears to be out-of-scope for the method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.