Ruby SOAP::RPC::Driver seeing the generated soap request - ruby

I'm using ruby's WSDLFactory to create an rpc driver to access the paypoint soap service and i need to see what xml request is being generated is there a way to do this code or should i try and use something like ethereal

Use wiredump_dev= and/or wiredump_file_base=.
For example,
wiredump_dev = STDOUT will output the generated request to the console and wiredump_file_base = "/tmp/soap_log_" will append the generated request to a file named soap_log_method_name_called.log

Related

Jmeter - Using GET/POST with single call

For the purpose of my test, i need to test the same endpoint is capable of using both GET/POST http method. What is the easiest way, how i can do it without creating duplicates of the script?
You can normally parameterize the HTTP request method by creating a simple CSV file with the following contents:
method
GET
POST
once done you can add a CSV Data Set Config element and set it up like:
and in your HTTP Request sampler just use ${method} JMeter Variable
That's it, you can now run your request and it will hit the endpoint twice using different methods:

(Multipart) zip upload in ruby webmachine handled by rack

I'm making an upload form for zips in a ruby webmachine app. My idea is to have an upload through my backend where I can add some extra params and then upload it to amazons s3 service with RestClient.
I did successfully create a direct upload (web based form post) to a s3bucket, but in that way I'm unable to handle the variables which are needed in the request, the way I want.
I've tried several things but I can't figure out, how to handle the request, as soon as it gets in my backend. I've created a resource and I'm debugging directly in the process_post method.
My #request variable represents a Webmachine::Request, with a Webmachine::Adapters::Rack::RequestBody and a Rack::Request, but I can't get the file out of it to use it as input for my RestClient request.
I think; #request.body.to_s and #request.body.to_io, represent the uploaded file in some way, and I tried to use them as input for Rack::Multipart methods, but that doesn't give me the file.
I also tried to work with the rack-raw-upload gem, but I can't get the mime-type something else than "application/x-www-form-urlencoded" or multipart. I do explicitly set it to; application/octet-stream
Things like File.new(filename, 'rb') gave me `rrno::ENOENT: No such file or directory # rb_sysopen'. For filename I just used 'example.zip'.
I guess I'm missing something which has to do with the Rack::Request call(env) method.
Does somebody have an idea, on how to handle the Rack uploads? Or give me any hints for a new direction? Thanks.
I've created a gist which shows how to retrieve the multipart stream. You'll need further parsing in order to get the uploaded file.
https://gist.github.com/jewilmeer/eb40abd665b70f53e6eb60801de24342

Talend tRESTClient does not work

I have a Talend job which has an input CSV file which needs to be converted to a JSON format and then using a tRESTclient/tREST , make a HTTP call request and post data.
In the current job, I have an Elasticsearch server installed on my local machine and provided that URL.
I was able to convert the files to JSON format and also verified with a tlogrow component but unable to post data.
(P.S: I was able to post data using a bulk Java code, loading jar files and making HTTP call and sending parameters using a tJAVArow component. So no issue with my localhost and posting data.)
After converting the data from input file to JSON format, set the context variable with your JSON data and then make the rest call. You can add the context variable in the HHTP Body. example : context.json_post without double quotes.

How to view GET request headers generated by open-uri

I'm using open-uri and I know I can get the response headers with the meta method as below, but I'm wondering how I can view the GET headers generated. Or would I have to use a different library for this?
page = open('http://www.google.com');
page.meta
Thanks for the help
You can set the request parameters with open('http://example.com', 'User-Agent' => 'Me'), but to see all the headers that will be sent you will probably have to sniff the traffic with a proxy, ngrep, or tcpflow. Or read the source.
open-uri is a convenience library for quickly fetching and reading files over a network. If that's not your use case, you can use a lower-level library like Net::HTTP to get more control over the connection.

How to view the raw XML or Json response using LinqToTwitter?

How can I view the raw XML or Json response when doing a search for users using the LinqToTwitter library? I'm using the SingleUserAuthorizer for oAuth.
If you have any ideas using other libraries or even a simple oAuth framework, I'm open to suggestions.
Thanks.
TwitterContext has a RawResults property you can use.
If this is just for debugging purposes, I'd use Wireshark or Fiddler - that way you get to see the complete HTTP requests/responses.

Resources