C
Chris Gunnels
Hey all,
I have scoured the web looking for an answer but can't seem to find one.
I need to send a SOAP request to a server that requires basic
authentication. I can create the base64 encoded username and password
that the server requires, but I can't seem to send that or add that to
the header as the server requires.
code i have right now:
ENDPOINT = "https://asldfjlsf.com"
request_xml_string = 'xml...'
stream = SOAP::HTTPStreamHandler.new(SOAP:
roperty.new)
header = SOAP::SOAPHeader.new
header.add("authorization",
HTTPAuth::Basic.pack_authorization("username", "pass"))
body_item = SOAP::SOAPElement.new('getResponse', request_xml_string)
body = SOAP::SOAPBody.new(body_item)
envelope = SOAP::SOAPEnvelope.new(header, body)
request_string = SOAP:
rocessor.marshal(envelope)
request = SOAP::StreamHandler::ConnectionData.new(request_string)
resp_data = stream.send(ENDPOINT, request, 'getResponse')
puts "Got response:"
puts resp_data.receive_string
Any help?
I have scoured the web looking for an answer but can't seem to find one.
I need to send a SOAP request to a server that requires basic
authentication. I can create the base64 encoded username and password
that the server requires, but I can't seem to send that or add that to
the header as the server requires.
code i have right now:
ENDPOINT = "https://asldfjlsf.com"
request_xml_string = 'xml...'
stream = SOAP::HTTPStreamHandler.new(SOAP:
header = SOAP::SOAPHeader.new
header.add("authorization",
HTTPAuth::Basic.pack_authorization("username", "pass"))
body_item = SOAP::SOAPElement.new('getResponse', request_xml_string)
body = SOAP::SOAPBody.new(body_item)
envelope = SOAP::SOAPEnvelope.new(header, body)
request_string = SOAP:
request = SOAP::StreamHandler::ConnectionData.new(request_string)
resp_data = stream.send(ENDPOINT, request, 'getResponse')
puts "Got response:"
puts resp_data.receive_string
Any help?