JMeter returns wsdl as a response - web-services

Im trying to do simple web service test using JMeter. I'm using SOAP/XML-RPC Request with simpliest configuration
URL = https://...address here..?wsdl
SOAP action and Use KeepAlive stay unchecked
XML request is loaded from file, correctly
What is more i have added View Result Tree to see results.
Thats all.
Problem is i'm still getting whole wsdl file as a response (i have expected a normal soap response for my xml soap requst).
I have tested in SOAPui this request and url - everythink working fine. Do i need do add smth more? maybe this is problem with https protocol?
What is more i have tried WebService (SOAP) Request (DEPRECATED) however im getting exception becouse of using https while i want to use load WSDL.
Any ideas to solve my problem?
Here is a request from View Result Tree
POST https://...address here..?wsdl
POST data:
Filename: D:\install\apache-jmeter-2.11\TEST\request.xml
<actual file content, not shown here>
[no cookies]
Request Headers:
Content-Type: text/xml
Connection: close
User-Agent: Jakarta Commons-HttpClient/3.1
Host: hostname
Content-Length: 1826
EDIT: i solved this problem by doing configuration like this:
ULR = https://..address here.. (NO WSDL)
SOAP action specified (url from wsdl)
KeepAlive checked
XML pasted in textbox section
However when i load xml from file - test fails with message couldnt parse stream. The same message pasted into textbox section - works perfectly. Whats wrong?

Configuration:
URL : scheme://..address here.. (NO WSDL)
SOAP action specified (url from wsdl)
KeepAlive checked
path to XML file pasted into right section
File encoding:
XML was not loading as i expected because of encoding.
I had set UTF-8 with BOM encoding while my service expected UTF-8 without BOM.

Related

What's the http request for the page source?

I've managed to make a file downloader in C++ (using winsock). It downloads every simple link with a file like: www.page.com/image.png
I want to make it download all of the images from an entire page, such as all the images from a 4chan thread, but I don't know what I should send in the http request to get the page's source. How can I request the source of a webpage?
You don't send anything in the http request, in the manner you're thinking.
An http request sends a single request, for a single document, and returns a single document from the server.
To download an entire page, you will have to parse the downloaded HTML document, extract all the relative links from the HTML source, then issue a separate http request for every image, css, js, etc... referenced from the main document.
This is how tools like wget's --recursive option download entire pages.
If the page is located at the root of the http://www.page.com server, you would send a GET request to the www.page.com server asking for the / resource:
GET / HTTP/1.1
Host: www.page.com
Let's say the page was actually located at http://www.page.com/thepage.html. You would send a GET request asking for /thepage.html instead:
GET /thepage.html HTTP/1.1
Host: www.page.com
Either way, you would then have to parse the resulting HTML to get the individual URLs of all the <img> tags that are on the page.

"Range:" http header causes hang in ColdFusion app

Whenever I add the "range" header in a HTTP request for a .cfm or .cfc file on my server, I get a timeout. The server simply does not respond.
To debug, I created a blank file called "/signup/test.cfm" on my server. It contains nothing. Next, I make a normal request and an edited request for the file:
Request:
GET /signup/test.cfm HTTP/1.1
Host: site.com
Response:
HTTP/1.1 200 OK
Request:
GET /signup/test.cfm HTTP/1.1
Host: site.com
Range: bytes=0-40960
Response:
timeout in transmission from site.com
If I include the Range header in a request to a static file, there is no problem.
What could be causing this, and how do I debug it? The file I am requesting is empty, so no code should be executing. Application.cfc is empty. Since I assume no code is executing, does this mean that it is a server configuration problem?
EDIT: By adding a tag to my script, I have confirmed that it does execute the ColdFusion code. The response is just never sent back to me.
Most likely the cf parser doesn't work with ranged requests while the static file handler does.
Range is for fetching part of content and subsequently fetching more later. E.g. Video file streaming or download continuation. Not something easily handled by a script handler as the request is meant to be returned all at once.
Here's a stackoverflow with a sample range request to show how this works
Sample http range request session

Issue with setting the content type for http request header with axis2

I have a webservice client code which accesses a service (Axis2 based). I tried changing the content type in the request header using the following code.
ServiceClient serviceClient = stub._getServiceClient();
Options options = serviceClient.getOptions();
options.setProperty(HTTPConstants.CHUNKED, "true");
options.setProperty(Constants.Configuration.ENABLE_HTTP_CONTENT_NEGOTIATION,"true");
options.setProperty(Constants.Configuration.MESSAGE_TYPE,"text/xml");
But the above code was not working for the content type text/xml .But It worked when I used the content type application/xml .I was not able to set the content type as text/xml.
Can anybody give me a solution for this?
Your client may be using the wrong SOAP version to format its request. text/xml is the SOAP 1.1 content type. application/soap+xml is the content type for SOAP 1.2.
This page illustrates how to change the SOAP version.
serviceClient.getOptions().setSoapVersionURI(
org.apache.axiom.soap.SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
will set the SOAP version to 1.1, for example.

Spring Security

I am trying to use spring security in my application developing restful web services and not getting the way how to send request to j_spring_security_check directly so that i can provide same url as a web service to Authorization of username and password.
Currently i am using following request pattern:
URL: "http://localhost:8080/CabFMS/j_spring_security_check"
Content-type: application/x-www-form-urlencoded
Body: {'j_username':'user','j_password':'123'}
Response: is Bad credentials
I am not sure about Content-type and body parameters. Please provide suggestion. To send request i am using REST Client
Tarun Gupta
As you correctly noticed j_spring_security_checks expects application/x-www-form-urlencoded content, therefore you need to encode it as such:
j_username=user&j_password=123
Your request pattern should be :
/j_spring_security_check?j_username=user&j_password=123
with method "POST" type.
other then this you can change request action & parameters text "j_spring_security_check" and "j_username" ,"j_password" by configuring alternate text in attributes :
login-processing-url,
username-parameter,
password-parameter
of spring "form-login" tag in security configuration xml file.
Create an AuthenticationSuccessHadler for this, in the authenticationSuccess method, return base64 encoded authorization header with the pattern username:password
Then, on each request, set the header as Basic yourtokenhere

Problem with Posting JSON object with WSRequest

I want Play to call a webservice. The webservice accepts application/json and returns this as well. With the following code I'm trying to achieve this. (Note, the headers.put(xxx) are added later in an effort to solve the problem).
WSRequest request = WS.url(targetURL);
request.body = new Gson().toJson(user);
request.headers.put("Content-type","application/json");
request.headers.put("Accept","application/json");
request.post();
The strange thing is that my JBOSS server replies: "Cannot consume content type". If I use my 'Simple REST client' plugin in my Chrome browser, and provide the entire JSON Body GSon created and add the content-type header, I get a valid response. Is this not the way to send JSON to the server? Or am I missing some fundamental piece here?
While checking the API documentation on the WSRequest class i noticed the field mime-type
By setting it as follows JBOSS (resteasy) accepted my request succesfully.
request.mimeType = "application/json";