Code Monkey home page Code Monkey logo

handsoap's People

Contributors

codesnik avatar dredozubov avatar g3d avatar intouchmvc avatar j4y avatar jimmiw avatar jmhodges avatar jstotz avatar mynameisrufus avatar pgericson avatar thomaskay avatar troelskn avatar ydnar 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  avatar  avatar  avatar  avatar  avatar  avatar

handsoap's Issues

jasperserver multipart response

I am trying to convert some SOAP::RPC::DRIVER code I was using to fetch pdf documents from jasperserver. This probably isn't really an issue I just can't seem to find how to do it in the documentation.

My xml request

<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header />
env:Body

<request operationName="runReport" locale="en"><argument name="RUN_OUTPUT_FORMAT">PDF</argument><resourceDescriptor isNew="false" wsType="" name="" uriString="/reports/staging/staging-stop"><label>null</label><parameter name="start_date"><![CDATA[1300410000000]]></parameter><parameter name="time_zone_offset"><![CDATA[-3600]]></parameter><parameter name="end_time"><![CDATA[00:59:59]]></parameter><parameter name="output_format"><![CDATA[PDF]]></parameter><parameter name="device_id"><![CDATA[51]]></parameter><parameter name="user_id"><![CDATA[1]]></parameter><parameter name="include"><![CDATA[true]]></parameter><parameter name="time_zone"><![CDATA[Central Time (US & Canada)]]></parameter><parameter name="end_date"><![CDATA[1301101199000]]></parameter><parameter name="start_time"><![CDATA[01:00:00]]></parameter></resourceDescriptor></request>

/env:Body
/env:Envelope

portion of backtrace from error

/usr/lib/ruby/gems/1.8/gems/handsoap-1.1.8/lib/handsoap/http/drivers/abstract_driver.rb:70:in `parse_multipart'
/usr/lib/ruby/gems/1.8/gems/handsoap-1.1.8/lib/handsoap/http/drivers/abstract_driver.rb:25:in `parse_http_part'
/usr/lib/ruby/gems/1.8/gems/handsoap-1.1.8/lib/handsoap/http/drivers/curb_driver.rb:64:in `send_http_request'
/usr/lib/ruby/gems/1.8/gems/handsoap-1.1.8/lib/handsoap/service.rb:249:in `invoke'

Are there some options to invoke or a method of response that will make this work?

Add curb as gem dependency

Hi,

I'm trying to use handsoap in a clean ruby 1.8.7 installation and when I install handsoap I can't run it without curb gem installed.

Maybe could be posible to add curb as a gem dependecy

Thanks

Fault not parsed correctly

Hi,

in the method Fault.from_xml in lib/handsoap/service.rb the namespace selector is partially missing, ie. instead of

fault_code = node.xpath('./faultcode', ns).to_s

it should probably be

fault_code = node.xpath('./env:faultcode', ns).to_s

Same with faultstring and detail.

Best regards,
Thomas

REXML query driver problem with text nodes

Hi,

when using REXML as query driver there is a problem when using #to_s on an element returned by an XPath with text() like ./ns:Element/text() since the returned REXML element is of type REXML::Text which does not have a #text method. However, the text value can be returned by using the #value method. So an additional check for the REXML::Text element is needed.

Best regards,
Thomas

NTLM Authentication

I'm trying to connect to an Exchange Server that only supports NTLM authentication. I found this issue where it's recommended to install the rubyntlm gem (https://github.com/wimm/rubyntlm). I installed it and tried again and the "Wrong credentials" error was still being raised. Looking at the http drivers code it seems like it's only trying to use HTTP basic auth (unless I'm missing something, please let me know if I am).

Playing around with the rubyntlm gem I managed to authenticate successfully https://gist.github.com/2932631, but from outside the handsoap gem.

Im going to try to add ntlm support to the handsoap gem, and the best place I can think of to do it is in the http drivers, would this be the right place?

Modifying previous version

Hi,

I'm trying to modify version 1.1.8 of this gem and am running into some issues with the test suite. I'm thinking it might could be that I'm not using the expected versions of the dependency gems.

One of the errors I'm most concerned about is:

  1. Failure:
    test_attribute_hash_access(TestOfNokogiriDriver) [tests/xml_query_front_test.rb:183]:
    <"bl\xC3\xA5b\xC3\xA6rgr\xC3\xB8d"> expected but was
    <"blåbærgrød">.

Note that I have only modified one line of code for this gem that handles how it deals with parsing errors for NokoGiri. Any advice on how to set up the test environment would be greatly appreciated. Thanks!

  • Steven

Default namespace

Hi,

1 - As far as I can tell, handsoap only supports prefixed namespaces and not default namespaces(*) like this: "... <books xmlns="http://somebooksite.com/book_spec"> ...".

(*) http://www.w3.org/TR/REC-xml-names/#defaulting

Am I wrong in that observation? If not, will you consider adding this feature?

2 - Some services defines more than one namespace in the envelope:

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

Is this possible with handsoap? If not, will you consider adding this feature?

Regards,
Tonni - who is trying to wrap his head around xml/soap

Dynamic endpoint assignment

Is there a way to dynamically assign an endpoint?
I want to define the endpoint from a URI stored in the database.

Thanks!

NTLM Authentication and SharePoint web services

I am trying to use handsoap 1.1.4 to consume SharePoint 2003 (WSS 2.0) web services. After fiddling a little bit with the configuration of namespaces, I have come to the point where I can send a correct SOAP request but I receive 401 HTTP error: Unauthorized. I am following the guidelines for HTTP authentication (http_request.set_auth @@username, @@password) but I believe SharePoint requires NTLM. Is there any way to make that work with Handsoap?

Curb or httpclient by default ?

Hi,

I've read that curb is the default http driver, but in "lib/handsoap/parser.rb" I see an explicit require for "httpclient".

Is it a mistake or I'm missing something ?

Thanks

Getting action input parameters

Hello.

I'm using handsoap gem for SOAP interactions and I want to get list of input params for a selected action.

For example, action showExample is defined below:

...
<xs:schema xmlns:ax232="..." xmlns:ax234="..." attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="...">
...
<xs:element name="showExample">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="UserField1" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="UserField2" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="UserField3" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
...
</xs:schema>
...
</wsdl:types>

How can I get ['UserField1', 'UserField2', 'UserField3'] automatically for any action I specify?

Regards, Alex.

cache_classes

I has some code that looks up roadspeed from navteq and after 1st request I get the following.

ArgumentError (A copy of Map24RoutingService has been removed from the module tree but is still active!):
app/models/map24_routing_service.rb:130:in parse_linkinfo_response' app/models/map24_routing_service.rb:125:inmap app/models/map24_routing_service.rb:125:inparse_linkinfo_response'
app/models/map24_routing_service.rb:100:in link_info' handsoap (1.1.8) lib/handsoap/service.rb:189:insend'
handsoap (1.1.8) lib/handsoap/service.rb:189:in method_missing' app/controllers/navteq_controller.rb:12:inget_link_info'
/usr/lib/ruby/gems/1.8/gems/newrelic_rpm-2.13.4/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:254:in perform_action' /usr/lib/ruby/gems/1.8/gems/newrelic_rpm-2.13.4/lib/new_relic/agent/method_tracer.rb:141:intrace_execution_scoped'
/usr/lib/ruby/gems/1.8/gems/newrelic_rpm-2.13.4/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:247:in perform_action' /usr/lib/ruby/gems/1.8/gems/newrelic_rpm-2.13.4/lib/new_relic/rack/developer_mode.rb:20:incall'
/usr/lib/ruby/gems/1.8/gems/newrelic_rpm-2.13.4/lib/new_relic/rack/developer_mode.rb:20:in call' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:inservice'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /usr/lib/ruby/1.8/webrick/server.rb:173:instart_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in start' /usr/lib/ruby/1.8/webrick/server.rb:162:instart_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in start' /usr/lib/ruby/1.8/webrick/server.rb:92:ineach'
/usr/lib/ruby/1.8/webrick/server.rb:92:in start' /usr/lib/ruby/1.8/webrick/server.rb:23:instart'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'

I set cache_classes to true and it made the error go away, but I was wondering if something was not being cleaned up after a request.

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

  spec.license = 'MIT'
  # or
  spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Parsing is very slow

There are a few reasons why:

  1. Handsoap::XmlQueryFront::NokogiriDriver#to_s is very inefficient

The method uses a lot of literal strings that are constant and do not need to be modified. Using literal strings means they need to be #duped every time they are used in the method. Also, there are several #gsub calls where #gsub! could be called instead.

There is also a note about Nokogiri APIs being unstable, I'm not sure if this is the case anymore, but I overrode this method to just call #content on the backing Nokogiri node. I have something like this as a solution:

diff --git a/lib/handsoap/xml_query_front.rb b/lib/handsoap/xml_query_front.rb
index 3df435c..742d7e1 100644
--- a/lib/handsoap/xml_query_front.rb
+++ b/lib/handsoap/xml_query_front.rb
@@ -168,9 +168,8 @@ module Handsoap
       # Returns the underlying native element.
       #
       # You shouldn't need to use this, since doing so would void portability.
-      def native_element
-        @element
-      end
+      attr_reader :native_element
+
       # Returns the node name of the current element.
       def node_name
         raise NotImplementedError.new
@@ -350,13 +349,34 @@ module Handsoap
           element = @element.children.first
         end
         return if element.nil?
+        string = element.content
+
         # This looks messy because it is .. Nokogiri's interface is in a flux
         if element.kind_of?(Nokogiri::XML::CDATA)
-          element.serialize(:encoding => 'UTF-8').gsub(/^<!\[CDATA\[/, "").gsub(/\]\]>$/, "")
+          stirng.gsub!(EBEGIN_CDATA, BLANK_STRING)
+          string.gsub!(EEND_CDATA,   BLANK_STRING)
         else
-          element.serialize(:encoding => 'UTF-8').gsub('&lt;', '<').gsub('&gt;', '>').gsub('&quot;', '"').gsub('&apos;', "'").gsub('&amp;', '&')
+          string.gsub!(ELT,   LT)
+          string.gsub!(EGT,   GT)
+          string.gsub!(EQUOT, QUOT)
+          string.gsub!(EAPOS, APOS)
+          string.gsub!(EAMP,  AMP)
         end
-      end
+        string
+      end
+      EBEGIN_CDATA = /^<!\[CDATA\[/
+      EEND_CDATA   = /\]\]>$/
+      BLANK_STRING = ''
+      ELT          = '&lt;'
+      LT           = '<'
+      EGT          = '&gt;'
+      GT           = '>'
+      EQUOT        = '&quot;'
+      QUOT         = '"'
+      EAPOS        = '&apos;'
+      APOS         = "'"
+      EAMP         = '&amp;'
+      AMP          = '&'
     end
   end
 end
  1. All the data transformers use #to_s

This is expensive since calling #to_s is expensive, but even if #to_s is fixed I do not think the other transformers need to unescape the escape sequences, do they?

I don't really have the time to fix this right now and also make sure I don't break the other drivers. :(

  1. Using XPath is not very efficient for large data structures

Rewalking the XML subtree is expensive for big data structures. I'm not sure if this is a problem for Handsoap, but maybe a notice in the documentation should be added.

I have worked around all of these issues in a gem that uses handsoap: http://github.com/Marketcircle/jiraSOAP.

Feature request: Add a few basic DOM operations to XmlQueryFront

In one of my Handsoap usecases, I'm retrieving a large set of DataPoint nodes, each with timestamp and value as child nodes, as follows:

2009-10-07T12:30:00
5

As I understand it, the only way to individually retrieve the timestamp and value nodes for each DataPoint is through XPath, which is a relatively heavyweight operation compared to simple retrieval of both child nodes for a use case like this. Simply adding a "children()" method would probably be sufficient.

I may end up adding this in myself, of course, but just wanted to "officially" put it out as a suggestion.

Version bump

Hi,

I went to delete some patches I had written a while back and had merged back into this project a year ago.

Could you please release a 1.1.9 ?

👍

Does not parse namespaces containing quotes

The following response throws a 'The response is not a valid SOAP envelope' error due to the single quotes in xmlns:ns1="'daily'_type_quota"

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="'daily'_type_quota" xmlns:ns2="urn:EntityService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">SOAP-ENV:Headerns1:remaining_quota23992/ns1:remaining_quotans1:quota_used_so_far8/ns1:quota_used_so_farns1:command_groupAccountManagement/ns1:command_groupns1:quota_typedaily/ns1:quota_type/SOAP-ENV:HeaderSOAP-ENV:Bodyns2:addResponse<entity_id xsi:type="xsd:long">335511</entity_id>/ns2:addResponse/SOAP-ENV:Body/SOAP-ENV:Envelope

No gem generated

Hi,

although the last change of the gemspec is many hours ago, no 1.0.0 gem has been built.

Best regards,
Thomas

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.