SOAP request through JMeter with authentication - web-services

I'm having trouble sending a JMeter SOAP request through HTTP Request element -
Through SOAPUI I'm sending the request with the following properties:
Authentication via SOAP
But I cannot receive a valid response when I try to add these username password. I've tried to place it in HTTP Header Manager/ in HTTP Authorization Manager, but with no luck. I receive either error:
Response code: 404 Response message: Not Found
when placing this in the HTTP Authorization Manager and
HTTP Error 400. The request has an invalid header name
when placing the username and password in the header manager (with wss password type field, while in HTTP Authorization Manager there is not option like this).
What can I do to have a valid response from the server like I get in SOAPUI?

If you need to replicate SoapUI request I would suggest just to record the request from the SoapUI via JMeter HTTP(S) Test Script Recorder
In JMeter
File -> Template -> Recording -> Create
Workbench -> HTTP(S) Test Script Recorder -> Start
In SoapUI
File -> Preferences -> Proxy Settings
Host: localhost, Port: 8888
Enable proxy in SoapUI
Execute your request
Expand Thread Group -> Recording Controller in JMeter and observe the recorded request.
You may also need to correlate timestamps using __time() function check out Take the Pain out of Load Testing Secure Web Services for details on bypassing different web services security in JMeter tests.

Related

How to fix "Could not get any response" in Postman?

Postman for Linux
Version 6.7.1
Deepin x64
I'm trying to test a get method on postman to test my code, but I always get this error message.
Could not get any response.
There was an error connecting to localhost:3001/blocks.
Why this might have happened:
The server couldn't send a response:
Ensure that the backend is working properly
Self-signed SSL certificates are being blocked:
Fix this by turning off 'SSL certificate verification' in Settings > General
Proxy configured incorrectly
Ensure that proxy is configured correctly in Settings > Proxy
Request timeout:
Change request timeout in Settings > General
I've tried to do almost everything from this topic ("Could not get any response" response when using postman with subdomain) but nothing seems to work.
This is the on the message console.
Postman Console Message
Someone can help me to fix this?
In Postman go to Postman-> Preferences and in the settings tab turn off SSL certificate Verification
my project work try this:
Restart your web server local ex: wamp, postgree, oracle
in postman setting :
Trim keys and values in request body OFF
Use next generation URL processing ON
SSL certificate verification OFF
Always open request in web tab OFF
Send no cache header ON
Send postman token header ON
Retain headers when clicking on links OFF
Automatically follow redirects ON
Send anonymous usage data to postman OFF
It works for me:
Restart your web server like: PostgreSQL, Oracle
it will work

Unable to read XSRF-TOKEN cookie in Angular JS 1.5.5

TO protect app from CSRF attack we set a cookie named XSRF-TOKEN from server side. So from client side code we are able to set-cookie and send across to server, But to validate CSRF in the server side we need to send header while firing 'POST' service call. As per angular document automatically $http sets header X-XSRF-TOKEN by reading the cookie ( Please refer link), but Javascript code is unable to read the cookie though we have deployed our application on same domain.
Server side cookie generation code and service deployment details are as below,
final Cookie newCookie = new Cookie(
"XSRF-TOKEN",
csrfValue);
newCookie.setPath("/");
httpResponse.addCookie(newCookie);
UI is deployed in 8080 port and service is deployed in port 8084 inside same VM
Port 8080 and 8084 are different origins, so you can't read cookies from one on the other, the same as you can't access the cookies of any other website in javascript running on yours.
How does the service authenticate the user? If it's token based, and the token is sent as a request header, you don't even need further protection from csrf.

Getting Soap Fault on hitting a WebService using JMETER

I'm trying to contact a webservice via Jmeter (3.0), and I get the following error:
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Body>
<s:Fault>
<s:Code>
<s:Value>s:Sender</s:Value>
<s:Subcode>
<s:Value xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</s:Value>
</s:Subcode>
</s:Code>
<s:Reason>
<s:Text xml:lang="es-AR">The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</s:Text>
</s:Reason>
</s:Fault>
</s:Body>
</s:Envelope>
I haven't encountered any issues contacting the web service from SoapUI, so I'm wondering what could cause this problem.
You can see the screen shots here:
The HTTP Request within the tree, first part of the HTTP Request data, the HTTP Header Manager settings: https://i.stack.imgur.com/6HxIK.jpg
Here are the results on SoapUI (works just fine):
Results and log
Is it possible that the way that SoapUI sends the requests differs from the way Jmeter does and that's why it works?
Please help. Thanks!
You need to put this action bit to be a part of the Content-Type header like:
I would also recommend adding HTTP Cookie Manager to your Test Plan
Out of interest, why don't you just record the request originated from SoapUI using JMeter HTTP(S) Test Script Recorder like:
Configure JMeter for recording. The easiest way of doing this is using JMeter Templates feature
From JMeter main menu: File - Templates - Recording - Create
Workbench - HTTP(S) Test Script Recorder - Start
Configure SoapUI for recording
From SoapUI main menu: Preferences - Proxy Settings
Proxy Settting: manual, host: IP address or hostname of machine where JMeter is running, port: 8888
Execute request in SoapUI
Inspect the recorded request in JMeter under Workbench -> Recording Controller.
I think you have some trivial error in the value of http header SOAPAction.
Happened to notice(in the image you attached) that there are double quotes in its value.
Just remove the double quotes " from the SOAPAction value.
UPDATE:
It is noticed, while editing the question, that soapui has sent an additional http header action with a value (you masked the value).
So, please add action header in the jmeter request as well the right value in the jmeter plan.

WS02 API Manager malformed request to endpoint URL

We have our API being managed by WS02 API manager, but there seems to be some issue with the way it constructs the outgoing request into the configured endpoint URL. We see this sort of error from our endpoint when we make a request to the API manager:
Cannot bind to address "http://<HOST>:<PORT>http://<HOST>:<PORT>/<RESOURCE>
The URL is clearly incorrect as it is prepending the host part of the URL twice. We've put a debugging proxy in between the API manager and our endpoint and it shows the outgoing request looks like this:
GET http://<HOST>:<PORT>/<RESOURCE> HTTP/1.1
...
Host: <HOST>:<PORT>
It isn't normal for the host to be included in the first line; that should come from the "Host" header. But as it is, it makes sense we are getting the above error. Note, when we proxy this through something like Nginx, it works fine, but the server we are actually using for our endpoint doesn't like it. I'm guessing Nginx has been written in such a way so that it can resolve this kind of (technically incorrect) request.
We are adding propery 'POST_TO_URI' to our synapse API configuration in order to make the outgoing URL a complete URL [1]. This is useful when sending the messages through a proxy server. You can remove that property by modifying your API in AM_HOME/repository/deployment/server/synapse-configs/default/api/ directory. Remove the below property in your relevant APIs which sending requests to such backend servers.
<property name="POST_TO_URI" value="true" scope="axis2"/>
[1]https://docs.wso2.org/display/ESB460/HTTP+Transport+Properties

Inter-Server Communication

I have an Django application which uses different Servers.
-> First I get request, I need to authenticate it to my Authentication Server
-> Dump the request data in Log Server
-> Process the Request and getting data from different Database Server
-> Respond to the Request
-> Dump the Response data to Log Server
Each of the Server (Authentication Server, Log server...) are basically Django Services.
What is the Best way to do this communication. Obviously HTTP Requests & Responses would take too long. Serving one Request would generate more than 5-6 new HTTP requests and responses.
Can I have any way (applicable to Django) to directly call a method of other server (say Authentication Server, Log Server)