Prev: Wsdl - Webservice Client
Next: What Version?
From: Axel Fuchs on 13 Mar 2010 14:45 Hi, I am trying to do patent searches accessing the webservice at the European patent office (www.ops.epo.org/patents/patent-information/free/open-patent-services.html). Here is the code I wrote: ____________________________________________________________ #step 1: SOAP method and parameters require 'soap/wsdlDriver' wsdl = 'ops.wsdl' driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver #step 2: SOAP request and response XSD::Charset.encoding = 'UTF8' my_query = 'ti=green and ti=plant' result = driver.biblio-search(my_query,1,3) ________________________________________________ Questions: How do I access the elements in result? What do I do about this error message: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/baseparser.rb:371:in `pull': The 'xml' prefix must not be bound to any other namespace (http://www.w3.org/TR/REC-xml-names/#ns-decl) (REXML::ParseException) Line: Position: Last 80 unconsumed characters: <import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http:/ from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/baseparser.rb:365:in `each' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/baseparser.rb:365:in `pull' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/streamparser.rb:16:in `parse' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:201:in `parse_stream' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/xsd/xmlparser/rexmlparser.rb:27:in `do_parse' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:63:in `parse' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:42:in `parse' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:30:in `import' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:19:in `import' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/import.rb:59:in `import' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/import.rb:47:in `parse_attr' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:144:in `decode_tag' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:137:in `each' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:137:in `decode_tag' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:82:in `start_element' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/xsd/xmlparser/parser.rb:67:in `start_element' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/xsd/xmlparser/rexmlparser.rb:34:in `tag_start' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/streamparser.rb:24:in `parse' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:201:in `parse_stream' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/xsd/xmlparser/rexmlparser.rb:27:in `do_parse' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:63:in `parse' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:42:in `parse' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:30:in `import' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:19:in `import' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/import.rb:59:in `import' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/import.rb:47:in `parse_attr' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/parser.rb:143:in `decode_tag' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/parser.rb:139:in `each' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/parser.rb:139:in `decode_tag' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/parser.rb:84:in `start_element' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/xsd/xmlparser/parser.rb:67:in `start_element' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/xsd/xmlparser/rexmlparser.rb:34:in `tag_start' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/streamparser.rb:24:in `parse' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:201:in `parse_stream' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/xsd/xmlparser/rexmlparser.rb:27:in `do_parse' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/parser.rb:65:in `parse' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/importer.rb:29:in `parse' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:30:in `import' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/importer.rb:18:in `import' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/wsdlDriver.rb:124:in `import' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/wsdlDriver.rb:28:in `initialize' from ./patent_get.rb:7:in `new' from ./patent_get.rb:7 -- Posted via http://www.ruby-forum.com/.
From: Brian Candler on 16 Mar 2010 15:33 Axel Fuchs wrote: > Hi, > I am trying to do patent searches accessing the webservice at the > European patent office > (www.ops.epo.org/patents/patent-information/free/open-patent-services.html). $ curl -v http://www.ops.epo.org/patents/patent-information/free/open-patent-services.html * getaddrinfo(3) failed for www.ops.epo.org:80 * Couldn't resolve host 'www.ops.epo.org' * Closing connection #0 curl: (6) Couldn't resolve host 'www.ops.epo.org' $ dig www.ops.epo.org. a ... ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, So it looks like that link is bad (authoritative non-existent domain answer) > Here is the code I wrote: I suggest you follow the steps on the other thread: - ensure you're using the gem soap4r, not the bundled one require 'rubygems' gem 'soap4r' require 'soap/wsdlDriver' - build interface classes using wsdl2ruby.rb - get a wiredump > Questions: How do I access the elements in result? - run it in irb and use inspection to look at the available methods > What do I do about this error message: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/baseparser.rb:371:in > `pull': The 'xml' prefix must not be bound to any other namespace > (http://www.w3.org/TR/REC-xml-names/#ns-decl) (REXML::ParseException) This suggests they're sending back invalid XML or that the WSDL has invalid XML, but we'd need to see a wiredump exchange and/or the WSDL. -- Posted via http://www.ruby-forum.com/.
From: Brian Candler on 16 Mar 2010 16:28 Brian Candler wrote: > $ dig www.ops.epo.org. a > ... > ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, > > So it looks like that link is bad (authoritative non-existent domain > answer) It looks like the correct domain is ops.epo.org, not www.ops.epo.org. The path you gave gives a 404 error. The error page contains a link to the WSDL at http://ops.epo.org/patents/patent-information/free/wsdl/ops.wsdl but that also gives a 404 error. But I found another link to this: http://ops.epo.org/wsdl/ops.wsdl wsdl2ruby.rb says that it doesn't like the wsdl, with the same error you gave. It seems it doesn't like: <xsd:import namespace="http://ops.epo.org" schemaLocation="http://ops.epo.org//schema/ops.xsd"/> If you fetch this xsd you see that it imports two more xsd's, and these include these declarations: xmlns:xml="http://www.w3.org/XML/1998/namespace" I believe this is what it's objecting to. You can fix these by making them relative links. Try the attached for size. Attachments: http://www.ruby-forum.com/attachment/4583/fixed-xml.zip -- Posted via http://www.ruby-forum.com/.
|
Pages: 1 Prev: Wsdl - Webservice Client Next: What Version? |