I just created a sample WCF webservice in ASP.net. The WebService have 2 methods. I am using first method which is accepting one integer argument. If I send a parameter like:
"123"
to the method It will give a output like this:
"You entered: 123"
Well I am testing this WebService using JMeter. It's not giving any error if I test with 1000 users. If I try with 10,000 users at some point some request are giving error.The error is:
Thread Name: webservice user 1-4836
Sample Start: 2017-06-30 13:02:34 IST
Load time: 323
Latency: 0
Size in bytes: 0
Headers size in bytes: 0
Body size in bytes: 0
Sample Count: 1
Error Count: 1
Response code: 000
Response message: Unrecognized Windows Sockets error: 0: recv failed
Response headers:
SampleResult fields:
ContentType: text/xml
DataEncoding: UTF-8
ScreenShot of View Result Tree (Error):
Related
Getting exceptions with TCP Sampler
enter image description here
We have tried the steps:
1.
enter image description here
2.
enter image description here
3 Payload sent in text
def payload = "UNB+IATA:1+1S+XX+121103+FF168019110033++ETK1+O'
"UNH+1+TKCREQ:00:1:IA'
"MSG+:131'
"ORG+1S+99999999:X7HH+VZX++T+GR+CXN'
"TKT+676713121:T'
"UNT+5+1'
"UNZ+1+FF168019110033"
Error:
2023-02-01 13:58:37,462 ERROR o.a.j.p.t.s.TCPSampler:
org.apache.jmeter.protocol.tcp.sampler.ReadException: Error reading from server, bytes read: 0
at org.apache.jmeter.protocol.tcp.sampler.TCPClientImpl.read(TCPClientImpl.java:131) ~[ApacheJMeter_tcp.jar:5.0 r1840935]
at org.apache.jmeter.protocol.tcp.sampler.TCPSampler.sample(TCPSampler.java:402) [ApacheJMeter_tcp.jar:5.0 r1840935]
Expectation:
We need the correct response without error.
When using httr::GET, in certain queries it replaces % with safe representation %25, but in other queries it doesn't. I cannot find any rule that would make this happen.
I'm using httr 1.4.1
Sample query where % is replaced (notice the error code and that URL entered is not the same as in response object returned):
> httr::GET("jira.spring.io/rest/api/latest/search?jql=project=Spring%20Framework&startAt=0")
Response [https://jira.spring.io/rest/api/latest/search?jql=project=Spring%2520Framework&startAt=0]
Date: 2020-01-16 22:57
Status: 400
Content-Type: application/json;charset=UTF-8
Size: 196 B
Query where it is not replaced (no error, URL in response same as entered):
> httr::GET("issues.jenkins-ci.org/rest/api/latest/search?jql=project='WEBSITE'%20OR%20project='Infrastructure'&startAt=0")
Response [https://issues.jenkins-ci.org/rest/api/latest/search?jql=project='WEBSITE'%20OR%20project='Infrastructure'&startAt=0]
Date: 2020-01-16 23:02
Status: 200
Content-Type: application/json;charset=UTF-8
Size: 430 kB
What is going on? Is it a bug in httr? Or should I change some parameters in GET() call?
tldr; use HTTPS requests with jira.spring.io to avoid a broken protocol upgrade.
It's not an R/HTTR issue. It's the website. Compare the results of HTTP ("failing with mystery %25") and HTTPS ("succeeding"):
http://jira.spring.io/rest/api/latest/search?jql=project=Spring%20Framework&startAt=0
{"errorMessages":["Error in the JQL Query: The character '%' is a reserved JQL character. You must enclose it in a string or use the escape '\u0025' instead. (line 1, character 15)"],"errors":{}}
https://jira.spring.io/rest/api/latest/search?jql=project=Spring%20Framework&startAt=0
{"errorMessages":["Error in the JQL Query: Expecting either 'OR' or 'AND' but got 'Framework'. (line 1, character 16)"],"errors":{}}
There appears to be a 'malfunction' in the HTTP -> HTTPS redirect protocol upgrade, which has this response header:
Status Code: 301 Moved Permanently
Location: https://jira.spring.io/rest/api/latest/search?jql=project=Spring%252520Framework&startAt=0
^^^^^
Thus a solution is to use the HTTPS endpoint and avoid the strange target Location..
I am trying to implement soap calls testing through Robot framework.Tried various solutions that I could find on google, nothing works.
The same is working when I am testing through SOAP UI. Am I missing something , I am not sure.
new test
[Tags] abcd
Add Doctor Import http://schemas.xmlsoap.org/soap/encoding/
&{headers}= Create Dictionary Content-Type text/xml SOAPAction "" Host bfx-b2b....
${auth}= Create List Test Password3#
Create Session getPlans https://bfx-b2b.../wsdl/ProductService.wsdl auth=${auth} verify=True
${file_data}= Get Binary File ${CURDIR}/request.xml
Log ${file_data}
${byte_string}= Encode String To Bytes ${REQUEST} UTF-8
${resp}= Post Request getPlans https://bfx-b2b..../B2BWEB/services/IProductPort data=${byte_string} headers=${headers}
Log ${resp.text}
Log ${resp.status_code}
I am getting below 500 error in response.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
ESS_eBiz_Operations#uhc.com and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
Few Soap UI details -
Endpoint that I am hitting on SOAP UI -https://bfx-b2b.../B2BWEB/services/IProductPort
Raw data -
POST https://bfx-b2b.../B2BWEB/services/IProductPort HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
Content-Length: 1822
Host: bfx-b2b...
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Cookie: SMCHALLENGE=YES
Cookie2: $Version=1
Authorization: Basic V2VsbHRoaWVfVGVzdDpQYXNzd29yZDMj
See if this example will help you:
*** Settings ***
Documentation Test with SOAP (WSDL) with two parameters that returns the country passing the IP
Library SudsLibrary
*** Variables ***
${ip} 150.162.2.1
*** Test Cases ***
ConsultaIP
Create Soap Client http://ws.cdyne.com/ip2geo/ip2geo.asmx?wsdl
${result} Call Soap Method ResolveIP ${ip} null
${country} Get Wsdl Object Attribute ${result} Country
${Latitude} Get Wsdl Object Attribute ${result} Latitude
${Longitude} Get Wsdl Object Attribute ${result} Longitude
log The IP ${ip} belongs to the country ${country}, Latitude: ${Latitude} Longitude: ${Longitude}
I have a recieve port, and location accepting an HL7 2.x message over MLLP. I have created a party, and configured the acknowledgement settings using the BTAHL7 configuration explorer. The message parses fine, ACKS are returned to the originating system and I am able to send the deserialized xml to a file using a passthrough pipeline, and send the resulting ACKs to a file also using a passthrough pipeline, so I can confirm successful reception parsing and validation of the inbound xml.
As a simple test, I create a send port using the BTAHL72XSendPipeline to dump the HL7 2.x message to a file. To do this, I put a filter on the send port
BTS.MessageType ==
http://microsoft.com/HealthCare/HL7/2X#ADT_A04_21_GLO_DEF
And I recieve the following parsing errors, which I don't understand because the message parsed fine when I received it:
There was a failure executing the send pipeline:
"BTAHL72XPipelines.BTAHL72XSendPipeline, BTAHL72XPipelines, Version=1.3.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Source: "BTAHL7 2.X Assembler"
Send Port: "Send.HL7" URI: "C:\Demo\HL7\In\HL7\%MessageID%.txt"
Reason: Serialization errors:
Error # 1
Segment Id: NK1_NextOfKin
Sequence Number: 1
Field Number: 5
Error Number: 207
Error Description: Application internal error
Encoding System: HL7nnnn
Alternate Error Number: Z100
Alternate Error Description: Trailing delimiter found
Alternate Encoding System: HL7-BTA
Error # 2
Segment Id: PV1_PatientVisit
Sequence Number: 1
Field Number: 45
Error Number: 207
Error Description: Application internal error
Encoding System: HL7nnnn
Alternate Error Number: Z100
Alternate Error Description: Trailing delimiter found
Alternate Encoding System: HL7-BTA
Right click on your send pipeline and choose properties then click on the ".." button next to the Send pipeline and select "true" for the "TrailingDelmitierAllowed" option. Also make sure these are checked on the receive pipeline.
I am trying to connect to a Servlet with my j2me application and it's not happening.
Case 1:
1)Deploy the servlet on the local machine.
2)Connect to the servlet on the local machine with j2me app and wait for the servlet to return a a value
3)J2ME gets the value from the servlet and displays on the screen.
Works smooth!
Case 2:
1)Deploy the servlet on a remote machine.
2)Connect to the servlet on the remote machine with j2me app and wait for the servlet to return a a value
3)J2me gets an error saying empty response. Why?
Here is my code:
Case 1: MIDlet deployed on local machine
HttpConnection c = (HttpConnection) Connector.open("http://localhost:8999/PercentileCalculator/PercentileCalculator");
c.setRequestProperty("User-Agent","Profile/MIDP-2.0, Configuration/CLDC-1.1");
c.setRequestProperty("Content-Language","en-US");
c.setRequestMethod(HttpConnection.POST);
DataOutputStream os = (DataOutputStream)c.openDataOutputStream();
os.writeUTF("100");
os.writeUTF("Test 1");
os.writeByte(12);
os.flush();
os.close();
// Get the response from the servlet page.
DataInputStream is =(DataInputStream)c.openDataInputStream();
Case 2: MIDlet deployed on remote machine
HttpConnection c = (HttpConnection) Connector.open("Url goes here");
c.setRequestProperty("User-Agent","Profile/MIDP-2.0, Configuration/CLDC-1.1");
c.setRequestProperty("Content-Language","en-US");
c.setRequestMethod(HttpConnection.POST);
DataOutputStream os = (DataOutputStream)c.openDataOutputStream();
os.writeUTF("100");
os.writeUTF("Test1");
os.writeByte(12);
os.flush(); -->Exception thrown here.
os.close();
// Get the response from the servlet page.
DataInputStream is =(DataInputStream)c.openDataInputStream();
What could be the issue?
Update 1 : 12.01AM 5 may Sunday
I am able to call my remote servlet using my midlet. I wrote a sql to connect to a mysql DB and add a new row to the DB for every call the midlet makes to the remote servlet. And yes this works.
Now the issue is...why is the remote servlet not able to return values to my midlet. Why do I always get an empty response?
Update 2: 9.46 am 8 may Tuesday
In case 2, I replaced the URL with the foll:
www.google.com --> got a response from google ..some xml string
www.facebook.com --> got a response..which was actually a null pointer exception
m.facebook.com--> got a response from facebook...some xml string
www.yahoo.com ---> no response
Now I feel that my servlet needs to print an xml string and not a normal http page. Please pour in...
Update 3 8.41am 14 may Monday
I tried accessing a friends website using my j2me code. That is, I just replace the URL in case 2 with something like http://www.friend'sURL.in --> worked(got a response)
Then, I tried http://www.mywebsiteURL.in --> empty response
So, I feel there is something wrong with my server/webhosting... no idea.
UPDATE 4 22 MAY 2012 TUESDAY
On telmo's suggestion I looked into my server logs and they are as follows:
1)Log Fields
#Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
2)Requests from a browser using my desktop (2requests have been shown)
2012-05-21 04:39:06 W3SVC6826 BJJI-GLOBEDNS 67.227.164.68 GET /Servlet/PercentileCalculator - 80 - 116.203.33.229 HTTP/1.1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/536.5+(KHTML,+like+Gecko)+Chrome/19.0.1084.46+Safari/536.5 - - n10k.in 200 0 0 485 395 421
2012-05-21 04:39:08 W3SVC6826 BJJI-GLOBEDNS 67.227.164.68 GET /favicon.ico - 80 - 116.203.33.229 HTTP/1.1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/536.5+(KHTML,+like+Gecko)+Chrome/19.0.1084.46+Safari/536.5 - - n10k.in 200 0 0 17863 318 2203
3)Requests from my midlet (emulator on my PC) (2 requests shown)
2012-05-21 04:43:17 W3SVC6826 BJJI-GLOBEDNS 67.227.164.68 POST /Servlet/PercentileCalculator - 80 - 116.203.33.229 HTTP/1.1 Profile/MIDP-1.0,+Configuration/CLDC-1.0 - - n10k.in 200 0 0 0 196 468
2012-05-21 04:43:25 W3SVC6826 BJJI-GLOBEDNS 67.227.164.68 POST /Servlet/PercentileCalculator - 80 - 116.203.33.229 HTTP/1.1 Profile/MIDP-1.0,+Configuration/CLDC-1.0 - - n10k.in 200 0 0 0 196 453
ANALYSIS OF THE LOGS
So I tried to analyze the logs and I was not quite successful in interpreting them. The only difference that I could make out between the browser request and midlet request is:
Browser request returns response -> 200 0 0 17863 318 2203
Midlet request returns response -> 200 0 0 0 196 453
The 4th number (SC Bytes -> Bytes Sent) in case of midlet request is 0. That's all that I could make out. Could anyone help?
UPDATE 5 1st june 2012 Friday 11.33 PM
1)I created a HTML file on my server and then tried accessing it with the midlet and I could access it.
2) Next, I created a PHP page and then tried accessing that with the midlet and I could access it.
3)Then i tried accessing a JSP page and got an empty response.
4) I tried accessing all the servlets deployed on my server and always got an empty response.
5) I tried to access some servlets on the internet but could not find any.
INFERENCE
There is something fishy with the way my servlet outputs the HTML page. I have posted that piece of code here. Please assist.
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try{
response.setContentType("text/html");
reply = response.getWriter();
reply.println("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html\"><title>Nikhil D</title></head><body>hmmm</body></html>");
reply.close();
reply.flush();
}
catch(Exception e)
{
}
I am not quite able to figure out whats wrong here. Its probably the manner in which my server renders my servlets/ JSP pages. No idea!
UPDATE 6 : 13th JUNE 2012
Can't waste more time on this. Work around posted in an answer below
So after all that research this is what I did:
1) Pass parameters from MIDlet to a PHP page on my server.
2) Forward the parameters from PHP page to my SERVLET
3) PHP page collects the result of the SERVLET
4) MIDlet reads the result from the PHP page.
Ta Dang! works!