Test Soap webservice using jmeter with http request - java

i have a question for you guys, do you know a way how can i send http request with jmeter to my soap webservice(jax-ws library)?. I have a problem to point server name or ip(its localhost so should it be loopback?) and path. I'm using glassfish4 as my web server. I do not want to use option SOAP/XML RPC Request, because when i use it with my web service i can't see that any data have been sent(it's always 0 -in fact maybe you have idea why is that...it's also a solution to my problem because i need http request to see how much data i've sent)
!https://postimg.org/image/mpbai5n1v/
Thanks in advance
Regards!

Use:
Http Request and fill in:
Server Name or IP
IP if different from 443 or 80
Protocol if https
Add a Header Manager under it with :
Content-Type=text/xml; charset=utf-8
Note there is a template that lets you easily create this, see screenshot:
Finally I suggest you read this tutorial:
http://jmeter.apache.org/usermanual/build-ws-test-plan.html

Related

orbot as proxy with jaunt web-scraping

I am working on app (android) that is supposed to visit website & retrieve some data from there. I was thinking it would be nice to use tor so I would not leave so much info about myself.
I've completed scraping part and everything works. Problem is, i can not make proxy accessing internet. I wanted to use Orbot as proxy. I always get 405 error and text:
"this is an http connect tunnel, not a full http proxy it appears you have configured your browser to use this tor port as an http proxy this is not correct: this port is configured as connect tunnel, not an http proxy. please configure your client accordingly. you can also use https; then the client should automatically use http connect"
Code:
UserAgent agent = new UserAgent();
agent.setProxyHost("127.0.0.1");
agent.setProxyPort(8118);
agent.visit("http://stackoverflow.com");
I've tried
System.setProperty("http.proxyHost", "127.0.0.1");
System.setProperty("http.proxyPort", "8118");
instead of the two middle lines from previous code as well plus few other probably not smart things (: and nothing has helped.
From error text about connect tunnel and proxy I figured problem is somewhere in networking but although I searched about it, I couldn't fix it. Perhaps something in Orbot's settings?
My question is, what am I missing please? :)

How to see the Requests and Responses send by the Cloudfundy Java Client in the background (Api Mocking)

I am using the Cloudfoundry Java Client to make a Rest-API with Spring Boot.
I want to test the endpoint by stubbing (e.g. with Wiremock) the requests, which are send by the SDK in the background. For that, I need to get example-requests and -responses.
What I need to know is: When I call
{
//...
myCloudFoundryClient.organizations()
}
in the background the client does:
curl "https://api.my-domain.com/v2/organizations" -X GET
and then receives:
HTTP/1.1 200 OK
Content-Type: application/json
{
"some-json" : ...
}
I tried my usual Http-Proxys like the build-in Wiremock proxy and even Fiddler, but they don't seem to see those Requests.
What am I missing?
The problem was, that the "Reactor"-implementation of the CF-Client uses Netty for HTTP. Netty however uses CONNECT for all requests. Wiremock can't handle that.
(https://github.com/reactor/reactor-netty/issues/617#issuecomment-467012859)
The solution for me was switching to Hovercraft

POST payload over HTTPS connection in Spring

I am trying to connect to third party system over HTTPS connection and post parameters to receive a response. This is gonna be a POC I will be doing for which I am already started researching. I have already done a client-server TCP connection with an outbound gateway using SI in my spring application. Does SI provide a way to achieve HTTPS connection or is there any easier way, RestTemplate?
I could see Spring Integration - how to send POST parameters with http outbound-gateway, but it talks about HTTP rather than HTTPS.
Note: A linux server already communicates to this third party system using CURL. I need to replicate this communication in my spring application. Here is the sample Req / Res shared.
Request data: ord=000000&term=022&storenum=00623&fgen=667&action=1024&ctime=072119:22:23:32&tmout=08&PLU=00007565604633&BC=10364678071919225000623&QTY= 1.000
Response: 000000022006231024ctime=072119:22:23:32&itmz=P---11NSFU-T&desc=JARU ALL MN LT UP DIAMOND&rmfsline=1&avqty=1.0&barcode=10364678071919225000623&qty=1.0&rcptqty=3.0000&rcptline=5&upc=7565604633&reqqty=1.0&unitprice=1.97&price=5.91&dept=92&resp=00&POST /RMFSWeb/LineAuthListener? HTTP/1.1
Also, the URL shared with me is https://xx-cert.keb.com:20143 but this doesn't have a class/method name in the URL. Is it not required for an HTTPS connection?
Please share your thoughts on how I can achieve https connection from spring with the data above. Thanks for your help
RestTemplate with PostRequest will do all your job.
Refer an answer by 'Tharshan' in this post.
How to POST form data with Spring RestTemplate?

Java standalone proxy program

I am making a proxy application for a browser. It has to use only the standard libraries. So far, I've managed to create the server. When trying to access a web page from a client, i get the following information:
CONNECT gmail.com:443 HTTP/1.1
User-Agent: Mozilla/5.0 Firefox/49.0
Proxy-Connection: keep-alive
Connection: keep-alive
Host: gmail.com:443
My question is: what to use in order to handle the requests? How to handle a file download?
Once you get that CONNECT command, do what is asked: create the upstream connection, and return the appropriate success/failure response. If the upstream connection was successful, all you have to do now is copy bytes in both directions, simultaneously. The endpoints will take care of all SSL issues, uploads, downloads, etc. You have no further role to play.
The general behaviour of a proxy is as follows:
Receive request from browser
Make a request to the actual server, resolving all redirects if necessary
Get the response from server and passit on to client
I am not getting into complications of changing request/response headers, caching etc.
Now from the above, you are making a SSL connection to gmail.com refer.
The browser is actually sending correct request, in this case you need to implement the handshake and connect to gmail with HTTPS offloading SSL on your side and sending the response received to the browser through the negotiated SSL with the browser.
Suggestion is to use HTTP instead of HTTPS, if this is not a production grader system and try out the concept first

If SOAP is HTTP independant and REST is HTTP Based then Why?

I was just curious , currently the address in my WSDL SOAP File is
<wsdl:port name="MyPort" binding="tns:MyBinding">
<soap:address location="http://localhost:87/SomeMethod"/>
</wsdl:port>
Now since SOAP response is passed along with the HTTP response , Will i have to change the port from 87 to 80 while deploying the service ??
(The reason why i think this should be done because since SOAP is being tagged along with HTTP and HTTP is only available at port 80
I would appreciate it if someone could explain how this would work I know i am wrong here... )
Also Incase of rest i am testing my REST application using
curl http://localhost:6517/JerseyServer/rest/contacts
since REST runs over http ? How is it running over 6517 port ?? Is Tomcat acting as a proxy ? I am using Jersey??
Http is a protocol. You can run it on any available port, it does not have to be 80 but 80 is just the default port used for http.
It is possible to run any service on any port--it's a matter of telling the service/application which port to listen to. 80 is the default port for HTTP. You could run email on ports 12345, HTTP on 443, FTP on 80, and HTTPS on 21... since these are not the default ports for the protocols, you will need to explicitly specify the port to connect to.
As fas mentioned, default ports are just a convention to avoid having to specify what port to go to when visiting google.com (or stackoverflow.com).

Categories