Not getting Proper response from Jmeter when using SOAP Web service - web-services

I am trying to do some SOAP web service testing from Jmeter for POST methods. But I am not getting proper response. Please find some of the conditions and their exceptions below.
1) Implementation = HttpClinet4
Request: POST http://example.com/getInfo
With Post body request
Response: <HEAD><TITLE>Authentication Required</TITLE></HEAD>
<!-- default "Authentication Required" response (307) -->
</BODY>
Status : Pass
2) Implementation = HttpClinet3
Request: POST http://example.com/getInfo
With Post body request
Response: <HEAD><TITLE>internal error - server connection terminated</TITLE></HEAD>
Description: internal error - server connection terminated</B></FONT>
<HR>
<!-- default "internal error - server connection terminated" response (502) -->
</BODY>
Status : Fail
3) Implementation = Java
Request: POST http://example.com/getInfo/With some garbage value
With Post body request
Response:
Description: internal error - server connection terminated</B></FONT>
<HR>
<!-- default "internal error - server connection terminated" response (502) -->
</BODY>
Status : Fail
Why I am getting three different request and responses for different implementations? Which one should I use?
Note: I am running my Jmeter behind proxy with proper details from command prompt.Thanks in advance.

Related

Unable to match a simple Soap body with 'x-mock-match-request-body' in Postman

Description
Unable to match a simple Soap body with x-mock-match-request-body.
To Reproduce
Steps to reproduce the behavior:
Create an example for a mock server with any url, any http verb and any response
e.g. POST {{url}}/test with the response:
{
"test":"test"
}
Add the following request body in the example:
<soap:Envelope>
</soap:Envelope>
Create a request pointed at the example url with the same body as the example body
Send the request
Add the header x-mock-match-request-body and give the value true
Send the request
Expected behavior
Step 4 is expected to return the example response as the body is not matched and the http verb and url path is correct - this works as expected
Step 6 is expected to return the example response as the body is the same as specified in the example and the http verb and url path is correct - this does NOT work as expected
Screenshots
Mock example:
Mock example headers and response:
Request with body matching:
Headers and response:
Headers and response without body matching:
App Type [Native App]
Postman Version [7.24.0]
OS: [Windows 10 Enterprise]
I am able to match a JSON-body without issue. Has anyone experienced this when using SOAP?
I added the header Content-type: Application/xml to both the example and the request and it worked.

400 server error if to try to send http Get requests with params and cookies

I'm trying to send https requests with python "requests" lib
payLoad = {'session_id': str(webSessionId), 'Merchant': 'Company'}
resp = requests.get(url, params = payLoad, cookies = cookiesSession, headers = headers)
print resp.url
But I'm getting server error 400. At the same time if to check url from sent request can see following:
https://url/error
Passed parameters are missing.
If to remove cookies following url is returned:
https://url?Merchant=Company&session_id=d1160eda748a5ede015bbe1abe35606138086fc8
But Server returns 403 error(authorization)
Cookies and headers are valid as were successfully used in previous two https request. But here is some strange situation. How can I send "get" request with params and cookies?

How to test web service with authentication using JMeter

I'm using Apache JMeter 2.11 to test a web service with authentication. For the sample request I'm using View Results Tree as a listener and a SOAP/XML-RPC Request with the following syntax to my parameters:
URL: http://www.domain.com:####/dir/dir/webservice.asmx
SOAPAction: http://www.domain.com/action
What I have tried
1) Adding an HTTP Header Manager using
Name: Authorization:
Value: Basic [Base64 code encoded in ASCII, UTF-8, with or without domain in the user name] as explained here
With result: Response headers: HTTP/1.1 401 Unauthorized
2) Adding an HTTP Authorization Manager using
Base URL: http://www.domain.com:####
Username: [USERNAME]
Password: [PASSWORD]
Domain: [DOMAIN]
Realm: [NULL]
Mechanism: [BASIC_DIGEST/KERBEROS] as explained here
With result: Response headers: HTTP/1.1 401 Unauthorized
I also tried enabling Keep Alive in the request as suggested here
What am I doing wrong?
First you need to know the auth type, is it basic ? Digest ? Kerberos or other ?
Second, don't use SOAP/XML-RPC Request, use Http Request,
See Templates > Webservice in jmeter menu, it creates a sample test plan for Soap testing.
Add then your authentication with the correct Auth Manager using HttpClient 4 as sampler implementation and check.

Request format is unrecognized for URL unexpectedly ending in '/$metadata'

thought I'd try to see if anyone has seen this or something similar as I'm not sure where to start looking. I have a bunch of web services which have been fine for the longest time but now my server guy said they gave out an error that I've never seen before. Any ideas / things to look at?
Log Name: Application
Source: ASP.NET 4.0.30319.0
Date: 6/12/2012 6:57:03 AM
Event ID: 1309
Task Category: Web Event
Level: Warning
Keywords: Classic
User: N/A
Computer: Server
Description:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 6/12/2012 6:57:03 AM
Event time (UTC): 6/12/2012 1:57:03 PM
Event ID: 691c9c8fabeb4701aa31488d6db060ce
Event sequence: 123578
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: domain
Trust level: Full
Application Virtual Path: /
Application Path: D:\Sites\webroot\
Machine name: Server
Process information:
Process ID: 2456
Process name: w3wp.exe
Account name: IIS APPPOOL\AppPool_AID1651
Exception information:
Exception type: InvalidOperationException
Exception message: Request format is unrecognized for URL unexpectedly ending in '/$metadata'.
at System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath)
at System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)
at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Thanks!
All you need is to add the following to your web.config
<configuration>
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
</configuration>
My web service also logs Event Code 3005. I'm calling my web service using JQuery $.ajax(), which produces two http requests. The first request is an "OPTIONS" request, and it is met with an 500 Internal Server Error message. This is the one that's being logged with Event Code 3005. The second request is a "POST" request, which is met with the correct answer from the web service.
I haven't been successful in my attempts to keep the "OPTIONS" requests from being logged as errors, but I hope this information is helpful to you anyway.
My error log also matches yours with this phrase:
Exception message: Request format is unrecognized for URL unexpectedly ending in …

http POST: The post body is empty. All data is send in section: "Post Params: key:". Is this OK?

I'm new to internet programming and got a problem when sending a post request to a server (I received an unspecific error message). The server I want to connect is Microsoft HealthVault PreProductionEnvironment. The Specification say the this:
"HealthVault Service communications occur via schematized XML in the body of an HTTP request over a TLS Connection [RFC2818]. The HTTP requests MUST be submitted using the POST HTTP verb."
I tried to check the post request by sending it to "http://posttestserver.com/post.php?dir=ms_hv" (result displayed on "http://posttestserver.com/data/2011/12/05/ms_hv/"). This is the data I got:
Time: Mon, 05 Dec 11 05:26:53 -0800
Source ip: xxx.xxx.xxx.xxx
Headers (Some may be inserted by server)
UNIQUE_ID = TtzGna3sqvkAABZHetMAAAAH
CONTENT_LENGTH = 1157
HTTP_CONNECTION = close
HTTP_ACCEPT_ENCODING = gzip
HTTP_ACCEPT_LANGUAGE = en-US,*
HTTP_USER_AGENT = Mozilla/5.0
HTTP_HOST = posttestserver.com
CONTENT_TYPE = application/x-www-form-urlencoded
REMOTE_ADDR = 188.98.76.99
REMOTE_PORT = 21675
GATEWAY_INTERFACE = CGI/1.1
REQUEST_METHOD = POST
QUERY_STRING = dir=ms_hv
REQUEST_URI = /post.php?dir=ms_hv
REQUEST_TIME = 1323091613
Post Params:
key: '<?xml_version' value: '"1.0" encoding="utf-8"?><wc-request:request xmlns:wc-request="urn:com.microsoft.wc.request"><header><method>CreateAuthenticatedSessionToken</method><method-version>2</method-version><app-id>bc1fdbef-f814-4ee3-b414-1e9f6956c7ab</app-id><language>de</language><country>DE</country><msg-time>2011-12-05T14:26:51.31Z</msg-time><msg-ttl>1800</msg-ttl><version>2.0.0.0</version></header><info><auth-info><app-id>05a059c9-c309-46af-9b86-b06d42510550</app-id><credential><appserver2><sig digestMethod="SHA1" sigMethod="RSA-SHA1" thumbprint="50054D4FAEE16F69AAF66B7596ED30F9922B949E">fZaPzgI3x2ngzKnI2AU0leWgR7ycj7GcABPxktIKRd/u5eWk4dMGLiHv7x9oLKDAGC9BtAOGqe1YX80OpRFQC3VCioc9SGyAtBf0dTiM2tNcDTIboNqq0 m/d8FaI/MjIt8SlvXbV/LmCnEnjToPaiYnXqesJLflNUBRgotH2MK6YljcdB3G2JxghBlaqAYXKfx7c 8WQ9hA nnw75kTaJWXdgTAtdb0yUT5poYvm/ahG1PEl9BQCrR CmdYGECet4nlT1pFozYizI1lpZ4DQEv5eDz9YHGsqGO59oSOTX3iamRK wsaVvhKUBqS6 g7Q34wRa pv9mTocenMmCFOQ==</sig><content><app-id>bc1fdbef-f814-4ee3-b414-1e9f6956c7ab</app-id><hmac>HMACSHA256</hmac><signing-time>2011-12-05T14:26:51.3193190Z</signing-time></content></appserver2></credential></auth-info></info></wc-request:request>'
== Begin post body ==
== End post body ==
The issue I don't understand is the post body beeing empty. All the post-data is shown in "Post Params". Is this correct? Could this be the fault?
Please tell me if you need more detailed description.
Solution (probably):
The post body is empty but in the specification it says "XML in the body of an HTTP request", this probably means "in the POST body" (but mine is empty). I'll check out this posibility.
By using a "?" in your URL, you use the HTTP GET method. You can mix GET and POST in one request (which can lead to some obscure problems, especially when register_globals is switched on in your php-installation), but you shouldn't:
As I interpret your error-message, your server does not accept submitting the informations via HTTP GET. Instead you have to use the HTTP POST method. An example for a HTTP POST using QT you can find here.