-
Notifications
You must be signed in to change notification settings - Fork 616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not get it to work (using JRuby 1.7.10 and Savon 2.3.0) #549
Comments
@fjyaniez I just installed jruby-1.7.9 and this seems to work fine: jruby-1.7.9 :003 > client = Savon.client(wsdl: "http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl")
=> #<Savon::Client:0xa82570e @wsdl=#<Wasabi::Document:0x73215d85 @document="http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl", @request=#<HTTPI::Request:0x138301d0>>, @globals=#<Savon::GlobalOptions:0x7dec08b1 @option_type=:global, @options={:encoding=>"UTF-8", :soap_version=>1, :namespaces=>{}, :logger=>#<Logger:0x1d0a3e63 @logdev=#<Logger::LogDevice:0xb85e47a @filename=nil, @shift_age=nil, @dev=#<IO:fd 1>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x35b0b7f @mon_count=0, @mon_mutex=#<Mutex:0x4e4fc091>, @mon_owner=nil>, @shift_size=nil>, @formatter=nil, @progname=nil, @default_formatter=#<Logger::Formatter:0x55eb97c1 @datetime_format=nil>, @level=0>, :log=>true, :filters=>[], :pretty_print_xml=>false, :raise_errors=>true, :strip_namespaces=>true, :convert_response_tags_to=>#<Proc:0x5e382bf8@/Users/tjarratt/git/savon/lib/savon/options.rb:56 (lambda)>, :multipart=>false, :wsdl=>"http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"}>>
jruby-1.7.9 :004 > client.operations
D, [2014-02-13T13:14:29.239000 #9951] DEBUG -- : HTTPI GET request to ec.europa.eu (httpclient)
=> [:check_vat, :check_vat_approx] It looks like I'm using Wasabi v3.2.2 locally, so maybe I'll bump that and upgrade to jruby 1.7.10 and see how it works. |
Hi @tjarratt I'm also using Wasabi 3.2.2. If you could try using jruby 1.7.10 it would be great :) Thanks! |
@fjyaniez I'm sad to report that I was able to use Savon v2.3.3 on jruby 1.7.10 with Wasabi v3.2.3 without any issue. Would you mind attaching a gist of the WSDL your client is getting? I would probably use an http client like httparty to fetch the document before your client tries to call eg: require 'httparty'
puts "WSDL is #{HTTParty.Get('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl')}.inspect"
client = Savon.client(wsdl: "http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl")
puts client.operations.inspect Relevant output from my irb session: ± bundle exec irb
jruby-1.7.10 :001 > RUBY_VERSION
=> "1.9.3"
jruby-1.7.10 :002 > require 'savon'
=> true
jruby-1.7.10 :003 > client = Savon.client(wsdl: "http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl")
=> #<Savon::Client:0x4aac53a8 @wsdl=#<Wasabi::Document:0x77a860e4 @document="http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl", @request=#<HTTPI::Request:0x4f71561b>>, @globals=#<Savon::GlobalOptions:0x19cc2f5c @option_type=:global, @options={:encoding=>"UTF-8", :soap_version=>1, :namespaces=>{}, :logger=>#<Logger:0x1de54f07 @logdev=#<Logger::LogDevice:0x39a763e6 @filename=nil, @shift_age=nil, @dev=#<IO:fd 1>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x1c8fae9c @mon_count=0, @mon_mutex=#<Mutex:0x1d10926a>, @mon_owner=nil>, @shift_size=nil>, @formatter=nil, @progname=nil, @default_formatter=#<Logger::Formatter:0x2afc7c0e @datetime_format=nil>, @level=0>, :log=>true, :filters=>[], :pretty_print_xml=>false, :raise_errors=>true, :strip_namespaces=>true, :convert_response_tags_to=>#<Proc:0x2634912e@/Users/tjarratt/git/savon/lib/savon/options.rb:56 (lambda)>, :multipart=>false, :wsdl=>"http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"}>>
jruby-1.7.10 :004 > client.operations
D, [2014-02-13T19:31:38.817000 #13774] DEBUG -- : HTTPI GET request to ec.europa.eu (httpclient)
=> [:check_vat, :check_vat_approx]
jruby-1.7.10 :005 > Savon::VERSION
=> "2.3.3"
jruby-1.7.10 :006 > Wasabi::VERSION
=> "3.2.3"
jruby-1.7.10 :007 > |
Hi, I found a difference in my setup, I'm using ruby 2.0.0 compatibility:
jruby-1.7.10 :007 > puts "WSDL is #{HTTParty.get('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl')}.inspect"
WSDL is <?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:ec.europa.eu:taxud:vies:services:checkVat" xmlns:tns1="urn:ec.europa.eu:taxud:vies:services:checkVat:types" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:impl="urn:ec.europa.eu:taxud:vies:services:checkVat" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/">
<xsd:documentation>
Specific disclaimer for this service ----------------------------------------- The
objective of this Internet site is to allow persons involved in the intra-Community supply of
goods or of services to obtain confirmation of the validity of the VAT identification number of
any specified person, in accordance to article 27 of Council Regulation (EC) No. 1798/2003 of 7
October 2003. Any other use and any extraction and use of the data which is not in conformity
with the objective of this site is strictly forbidden. Any retransmission of the contents of
this site, whether for a commercial purpose or otherwise, as well as any more general use other
than as far as is necessary to support the activity of a legitimate user (for example: to draw
up their own invoices) is expressly forbidden. In addition, any copying or reproduction of the
contents of this site is strictly forbidden. The European Commission maintains this website to
enhance the access by taxable persons making intra-Community supplies to verification of their
customers VAT identification numbers. Our goal is to supply instantaneous and accurate
information. However the Commission accepts no responsibility or liability whatsoever with
regard to the information obtained using this site. This information: - is obtained from Member
States databases over which the Commission services have no control and for which the Commission
assumes no responsibility; it is the responsibility of the Member States to keep their databases
complete, accurate and up to date; - is not professional or legal advice (if you need specific
advice, you should always consult a suitably qualified professional); - does not in itself give
a right to exempt intra-Community supplies from Value Added Tax; - does not change any
obligations imposed on taxable persons in relation to intra-Community supplies. It is our goal
to minimise disruption caused by technical errors. However some data or information on our site
may have been created or structured in files or formats which are not error-free and we cannot
guarantee that our service will not be interrupted or otherwise affected by such problems. The
Commission accepts no responsibility with regard to such problems incurred as a result of using
this site or any linked external sites. This disclaimer is not intended to limit the liability
of the Commission in contravention of any requirements laid down in applicable national law nor
to exclude its liability for matters which may not be excluded under that law. Usage: The
countryCode input parameter must follow the pattern [A-Z]{2} The vatNumber input parameter must
follow the [0-9A-Za-z\+\*\.]{2,12} In case of problem, the returned FaultString can take the
following specific values: - INVALID_INPUT: The provided CountryCode is invalid or the VAT
number is empty; - SERVICE_UNAVAILABLE: The SOAP service is unavailable, try again later; -
MS_UNAVAILABLE: The Member State service is unavailable, try again later or with another Member
State; - TIMEOUT: The Member State service could not be reach in time, try again later or with
another Member State; - SERVER_BUSY: The service can't process your request. Try again latter.
</xsd:documentation>
<wsdl:types>
<xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="urn:ec.europa.eu:taxud:vies:services:checkVat:types" xmlns="urn:ec.europa.eu:taxud:vies:services:checkVat:types">
<xsd:element name="checkVat">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="countryCode" type="xsd:string"/>
<xsd:element name="vatNumber" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="checkVatResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="countryCode" type="xsd:string"/>
<xsd:element name="vatNumber" type="xsd:string"/>
<xsd:element name="requestDate" type="xsd:date"/>
<xsd:element name="valid" type="xsd:boolean"/>
<xsd:element maxOccurs="1" minOccurs="0" name="name" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="address" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="checkVatApprox">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="countryCode" type="xsd:string"/>
<xsd:element name="vatNumber" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="traderName" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="traderCompanyType" type="tns1:companyTypeCode"/>
<xsd:element maxOccurs="1" minOccurs="0" name="traderStreet" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="traderPostcode" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="traderCity" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="requesterCountryCode" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="requesterVatNumber" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="checkVatApproxResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="countryCode" type="xsd:string"/>
<xsd:element name="vatNumber" type="xsd:string"/>
<xsd:element name="requestDate" type="xsd:date"/>
<xsd:element name="valid" type="xsd:boolean"/>
<xsd:element maxOccurs="1" minOccurs="0" name="traderName" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="traderCompanyType" nillable="true" type="tns1:companyTypeCode"/>
<xsd:element maxOccurs="1" minOccurs="0" name="traderAddress" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="traderStreet" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="traderPostcode" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="traderCity" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="traderNameMatch" type="tns1:matchCode"/>
<xsd:element maxOccurs="1" minOccurs="0" name="traderCompanyTypeMatch" type="tns1:matchCode"/>
<xsd:element maxOccurs="1" minOccurs="0" name="traderStreetMatch" type="tns1:matchCode"/>
<xsd:element maxOccurs="1" minOccurs="0" name="traderPostcodeMatch" type="tns1:matchCode"/>
<xsd:element maxOccurs="1" minOccurs="0" name="traderCityMatch" type="tns1:matchCode"/>
<xsd:element name="requestIdentifier" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="companyTypeCode">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[A-Z]{2}\-[1-9][0-9]?"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="matchCode">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="1">
<xsd:annotation>
<xsd:documentation>VALID</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="2">
<xsd:annotation>
<xsd:documentation>INVALID</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="checkVatRequest">
<wsdl:part name="parameters" element="tns1:checkVat">
</wsdl:part>
</wsdl:message>
<wsdl:message name="checkVatApproxResponse">
<wsdl:part name="parameters" element="tns1:checkVatApproxResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="checkVatApproxRequest">
<wsdl:part name="parameters" element="tns1:checkVatApprox">
</wsdl:part>
</wsdl:message>
<wsdl:message name="checkVatResponse">
<wsdl:part name="parameters" element="tns1:checkVatResponse">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="checkVatPortType">
<wsdl:operation name="checkVat">
<wsdl:input name="checkVatRequest" message="impl:checkVatRequest">
</wsdl:input>
<wsdl:output name="checkVatResponse" message="impl:checkVatResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="checkVatApprox">
<wsdl:input name="checkVatApproxRequest" message="impl:checkVatApproxRequest">
</wsdl:input>
<wsdl:output name="checkVatApproxResponse" message="impl:checkVatApproxResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="checkVatBinding" type="impl:checkVatPortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="checkVat">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="checkVatRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="checkVatResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="checkVatApprox">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="checkVatApproxRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="checkVatApproxResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="checkVatService">
<wsdl:port name="checkVatPort" binding="impl:checkVatBinding">
<wsdlsoap:address location="http://ec.europa.eu/taxation_customs/vies/services/checkVatService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
.inspect
=> nil
jruby-1.7.10 :008 > client = Savon.client(wsdl: "http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl")
=> #<Savon::Client:0x61019643 @globals=#<Savon::GlobalOptions:0x2f303a76 @option_type=:global, @options={:encoding=>"UTF-8", :soap_version=>1, :namespaces=>{}, :logger=>#<Logger:0x27b9b888 @logdev=#<Logger::LogDevice:0x1201fd18 @shift_age=nil, @filename=nil, @dev=#<IO:fd 1>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x408f3be4 @mon_count=0, @mon_mutex=#<Mutex:0x7ba516d8>, @mon_owner=nil>, @shift_size=nil>, @formatter=#<Logger::SimpleFormatter:0x137efe53 @datetime_format=nil>, @progname=nil, @default_formatter=#<Logger::Formatter:0x766b0524 @datetime_format=nil>, @level=0>, :log=>true, :filters=>[], :pretty_print_xml=>false, :raise_errors=>true, :strip_namespaces=>true, :convert_response_tags_to=>#<Proc:0x6c1ebb38@/Users/fjyaniez/.rvm/gems/jruby-1.7.10@port-monitor/gems/savon-2.3.3/lib/savon/options.rb:56 (lambda)>, :multipart=>false, :wsdl=>"http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"}>, @wsdl=#<Wasabi::Document:0x559590fc @document="http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl", @request=#<HTTPI::Request:0x4e61bc49>>>
jruby-1.7.10 :009 > puts client.operations.inspect
HTTPI GET request to ec.europa.eu (net_http)
NoMethodError: undefined method `element_children' for nil:NilClass
from /Users/fjyaniez/.rvm/gems/jruby-1.7.10@port-monitor/gems/wasabi-3.2.3/lib/wasabi/parser.rb:299:in `sections'
from /Users/fjyaniez/.rvm/gems/jruby-1.7.10@port-monitor/gems/wasabi-3.2.3/lib/wasabi/parser.rb:292:in `section'
from /Users/fjyaniez/.rvm/gems/jruby-1.7.10@port-monitor/gems/wasabi-3.2.3/lib/wasabi/parser.rb:282:in `schemas'
from /Users/fjyaniez/.rvm/gems/jruby-1.7.10@port-monitor/gems/wasabi-3.2.3/lib/wasabi/parser.rb:67:in `parse_namespaces'
from /Users/fjyaniez/.rvm/gems/jruby-1.7.10@port-monitor/gems/wasabi-3.2.3/lib/wasabi/parser.rb:54:in `parse'
from /Users/fjyaniez/.rvm/gems/jruby-1.7.10@port-monitor/gems/wasabi-3.2.3/lib/wasabi/document.rb:160:in `parse'
from /Users/fjyaniez/.rvm/gems/jruby-1.7.10@port-monitor/gems/wasabi-3.2.3/lib/wasabi/document.rb:146:in `parser'
from /Users/fjyaniez/.rvm/gems/jruby-1.7.10@port-monitor/gems/wasabi-3.2.3/lib/wasabi/document.rb:63:in `soap_actions'
from /Users/fjyaniez/.rvm/gems/jruby-1.7.10@port-monitor/gems/savon-2.3.3/lib/savon/client.rb:28:in `operations'
from (irb):9:in `evaluate'
from org/jruby/RubyKernel.java:1119:in `eval'
from org/jruby/RubyKernel.java:1519:in `loop'
from org/jruby/RubyKernel.java:1282:in `catch'
from org/jruby/RubyKernel.java:1282:in `catch'
from /Users/fjyaniez/.rvm/gems/jruby-1.7.10@port-monitor/gems/railties-3.2.16/lib/rails/commands/console.rb:47:in `start'
from /Users/fjyaniez/.rvm/gems/jruby-1.7.10@port-monitor/gems/railties-3.2.16/lib/rails/commands/console.rb:8:in `start'
from /Users/fjyaniez/.rvm/gems/jruby-1.7.10@port-monitor/gems/railties-3.2.16/lib/rails/commands.rb:41:in `(root)'
from org/jruby/RubyKernel.java:1083:in `require'
from script/rails:6:in `(root)'jruby-1.7.10 :010 > Savon::VERSION
=> "2.3.3"
jruby-1.7.10 :011 > Wasabi::VERSION
=> "3.2.3"
jruby-1.7.10 :012 > RUBY_VERSION
=> "2.0.0" I'm going to check with 1.9.3 and let you know... thanks! |
And I can confirm the problem is using JRuby in ruby 2.0.0 mode. |
Oh, great, thanks for providing that debug information @fjyaniez! It looks like the bug is in Wasabi under Jruby 2.0.0 mode then. I'll keep this open until savonrb/wasabi#42 is fixed. |
Thank you so much @tjarratt |
Good news -- I've finally found a reproducible testcase for this issue. I've heard grumbles about this bug from a few other people, so I'm hoping to find a resolution this week. |
Curious -- on my machine it looks like it's failing because the XML passed to nokogiri is an empty string. It seems to work if you fetch the wsdl separately and then pass it to savon. Does that match what you're seeing, @fjyaniez? require 'savon'
wsdl = File.read("path/to/checkVatService.wsdl")
client = Savon.client(wsdl: wsdl)
client.operations # [:check_vat, :check_vat_approx] SUCCESS |
Narrowed this down a bit further to the Shell export JRUBY_OPTS=--2.0 Gemfile source 'https://rubygems.org'
ruby '2.0.0', engine: 'jruby', engine_version: '1.7.10'
gem 'savon', '~> 2.3.2' test.rb require 'httpi'
HTTPI.get("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl") Making a request with |
Using JRuby the response body is empty.
I think the problem is related to Transfer-Encoding "chunked". If this works on HTTParty, the next step is to discover what magic it does. I'll try to look at this on afternoon. |
Ok. I quit. I can't find out what is going on ... somebody have some idea? |
@rogerleite I appreciate all of the hard work you put in trying to debug this problem, as well as your honesty. I was looking at this last night and it occurred to me that this error is very likely the same error that is causing our builds to fail on travis-ci. Will investigate more this week and see if I can track down the culprit. |
@fjyaniez I think I found the root cause of the problem -- it's embarrassingly obvious in retrospect.
require 'net/http'
Net::HTTP.get("ec.europa.eu", "/taxation_customs/vies/checkVatService.wsdl") The issue tracking this in the JRuby repo is jruby/jruby#1216 and it looks like it was just reported as fixed two hours ago. |
Great, thanks for your time and letting me know @tjarratt |
I'd never find this bug ... i swear that i saw this working on httparty. |
@rogerleite -- to be fair, I led you astray. I implied that |
I'm triying to use Savon to check if an european VAT is valid without success:
Does it work for any of you?
Thanks.
The text was updated successfully, but these errors were encountered: