lib/patentscope/webservice.rb in patentscope-0.0.2 vs lib/patentscope/webservice.rb in patentscope-0.0.4
- old
+ new
@@ -1,10 +1,10 @@
module Patentscope
class Webservice
- PATENTSCOPE_WEBSERVICE_LOCATION = "http://www.wipo.int/patentscope-webservice/servicesPatentScope"
+ PATENTSCOPE_WEBSERVICE_LOCATION = "https://patentscope.wipo.int/patentscope-webservice/servicesPatentScope"
def wsdl
send_wsdl_request
end
@@ -42,16 +42,16 @@
private
def perform_operation(operation, options_hash)
soap_envelope = soapbuilder.build_envelope(operation, options_hash)
response = send_soap_request(soap_envelope)
- if response.include?('This request requires HTTP authentication')
+ if response.include?('Error') && response.include?('Unauthorized')
raise WrongCredentialsError
elsif response.include?('Business error during the execution of service')
raise BusinessError
else
- soapbuilder.strip_envelope(response, operation)
+ soapstripper.strip_envelope(response, operation)
end
end
def send_soap_request(soap_envelope_xml)
client.post_url(PATENTSCOPE_WEBSERVICE_LOCATION, "text/xml", soap_envelope_xml)
@@ -67,8 +67,12 @@
password: Patentscope.configuration.password)
end
def soapbuilder
WebserviceSoapBuilder.new
+ end
+
+ def soapstripper
+ WebserviceSoapStripper.new
end
end
end