Tracing timestamp of XML request/responses with JAX-WS - java

We have created a JAX-WS webservice, this service is being invoked by multiple clients. Some clients have configured timeout for API response. Even after sending success response, some client are stating that request is being timed out.
So is there any way to track, at what time a particular request hits the server and what time server responded back ?
I've enable http traces in weblogic server by using below properties
-Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true
-Dcom.sun.xml.ws.transport.http.HttpAdapter.dump=true
And request and response are appearing like below, where timestamp is missing
---[HTTP request - ]---
Accept: text/xml, multipart/related
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
---[HTTP response 200]---
null: HTTP/1.1 200 OK
Content-Length: 521
Content-Type: text/xml;charset=UTF-8
Weblogic Version is - 12.2.1

Related

Transfer-encoding header already present error in JMeter HTTP Request

I keep getting the following error in my Response data tab in jmeter:
org.apache.http.client.ClientProtocolException
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:909)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:481)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:298)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1105)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1094)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:429)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.http.ProtocolException: Transfer-encoding header already present
at org.apache.http.protocol.RequestContent.process(RequestContent.java:93)
at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:109)
at org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:176)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:518)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
... 9 more
My test script was created via the JMeter Proxy. The test is sending multipart data (a jpg image) to a REST API resource via a POST. The HTTP Header Manager auto created by the Recording Controller in JMeter has the following:
Transfer-Encoding : chunked
Accept : application/json
Accept-Encoding : gzip, deflate
Any idea why the Response is getting an error?
Request:
POST http://localhost:8080/email/v2/client/user/name/loadtest1#test.net/
POST data:
--oYtJU-XXTgMSkyaIrRBYNXw8AfMA2nMQSzJ20bJr--
Cookie Data:
JSESSIONID=b3bb843e-dafd-4cc5-8b0b-045c490736f8
Request Headers:
Connection: keep-alive
Transfer-Encoding: chunked
Accept: application/json
Accept-Encoding: gzip, deflate
Try removing from HTTP Header Manager the Transfer-Encoding header.
Can you show you Http Request in your Question ? and the Header Manager in it ?
What is the status of the following parameters of the http request which is failing:
Use multipart/form-data for HTTP POST
Browser-compatible headers
You don't have any HTTP Header Manager instances elsewhere in you test plan, do you? As if yes it may interfere as HTTP Header Manager's scope isn't limited to one sampler only when it is not added as a child.
Your post request details doesn't look like file upload request. Take a look into Upload and Download Scenarios with Apache JMeter guide to see whether you missed anything important.
Never run load generator and application under test on the same machine. Even when developing or debugging your test.

JAX-WS issuing GET then GET and POST

I wrote a JAX-WS client using classes generated from wsimport to invoke a webservice. To test my client locally, I wrote an implementation of the webservice and published it locally and called it. Everything worked as expected.
One thing I noticed is that my client connects to the endpoint and issues a GET followed by another connection with a GET against the endpoint looking for the wsdl, and finally issues the POST with my payload in the same connection.
Here is the tcpmon output (edited to protect the guilty):
GET /someWS HTTP/1.1
User-Agent: Java/1.7.0_03
Host: 127.0.0.1:9877
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
----------------------------------
GET /someWS?wsdl HTTP/1.1
User-Agent: Java/1.7.0_03
Host: 127.0.0.1:9877
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
POST /someWS HTTP/1.1
Accept: text/xml, multipart/related
Content-Type: text/xml; charset=utf-8
SOAPAction: "document/http://someUrl"
User-Agent: JAX-WS RI 2.2.4-b01
Host: 127.0.0.1:9877
Connection: keep-alive
Content-Length: 610
<Valid Soap message here/>
Is this standard behaviour or I have messed something up? I am using JAX-WS RI 2.2. This works fine locally, but a certain production WS is quite unhappy with the initial GET request and throws a 500 and I was hoping that I could suppress the GET requests and just skip to the POST.
The client is not caching the wsdl file locally and hence you will see a GET request before every POST. The GET is for getting the wsdl file and the POST is for the actual web service request. Ask the client to cache the wsdl locally and refer to it.

Implementing If-Match HTTP Header in Spring

The ShallowEtagHeaderFilter which is part of Spring processes the If-None-Match header on an Http request. As part of the Http 1.1 spec this returns an Http status of 304 - Not Modified if the contents of the If-None-Match header sent on the request is the same as the Etag header. This is helpful for caching as it means that if the Etag is the same on the client and server then the contents will be identical.
This is fine.
However my question is this - does Spring have support for the If-Match header (again part of HTTP 1.1) rather than If-None-Match because as far as the docs go it looks like the ShallowEtagHeaderFilter only processes the If-None-Match header. I need the If-Match header to prevent simultaneous requests from overwriting the previous one. IE I only want the request to be processed if the Etags are the same and hence they have the latest version of the entity.
It doesn't look like the ShallowEtagHeaderFilter supports If-Match:
curl "Accept: application/json" -H 'If-Match: "somevalue"' -i http://localhost:8080/rest-sec/api/resources/1
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
ETag: "03cb37ca667706c68c0aad4cb04c3a211"
Content-Type: application/json;charset=UTF-8
Content-Length: 56
Date: Fri, 11 Jan 2013 14:58:40 GMT
I opened a JIRA issue to track this:
https://jira.springsource.org/browse/SPR-10164

Error is java.io.IOException: Server returned HTTP response code: 500 for URL: while invoking weservice

I am getting this Error is java.io.IOException: Server returned HTTP response code: 500 for URL: exception while invoking the web service url that i have.
I am calling a .NET based web service through a framework built in java and getting:
Headers returned from the server:
Content-Length:736
Content-Type:text/xml; charset=utf-8
Server:Microsoft-IIS/7.0
X-Powered-By:ASP.NET
Date:Thu, 12 May 2011 08:51:45 GMT
java.io.IOException: Server returned HTTP response code: 500 for URL: "http://hcd
cd-bt01.hcch.com/HCCExceptionLogService/service.svc?wsdl"
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:1170)
at com.splwg.mpl.senders.http.HTTPSender.sendResponse(HTTPSender.java:34
5)
at com.splwg.mpl.sending.NewSenderManager.sendResponse(NewSenderManager.
java:191)
at com.splwg.mpl.sending.SameThreadSendingManager.callSender(SameThreadS
endingManager.java:63)
at com.splwg.mpl.stagingtable.download.OutboundMessageSender.handleRouti
ngs(OutboundMessageSender.java:361)
at com.splwg.mpl.stagingtable.download.OutboundMessageSender.sendRespons
e(OutboundMessageSender.java:95)
at com.splwg.mpl.sending.NewSenderManager.sendResponse(NewSenderManager.
java:191)
at com.splwg.mpl.sending.SameThreadSendingManager.processDestination(Sam
eThreadSendingManager.java:293)
at com.splwg.mpl.sending.SameThreadSendingManager.sendResponse(SameThrea
dSendingManager.java:252)
at com.splwg.mpl.sending.SameThreadSendingManager.doSend(SameThreadSendi
ngManager.java:208)
at com.splwg.mpl.server.async.ExecSendRequestProcessor.ProcessRequest(Ex
ecSendRequestProcessor.java:61)
at com.splwg.mpl.server.async.RequestProcessingThreadAdapter.run(Request
ProcessingThreadAdapter.java:46)
at com.splwg.mpl.server.PooledThread.run(PooledThread.java:91)
at java.lang.Thread.run(Thread.java:595)
The wsdl url which i am invoking is http://hcdcdbt01.hcch.com/HCCExceptionLogService/service.svc?wsdl
I have used SOAP UI 3.6.1 tool for testing this wsdl which is giving me the right result.
Headers that i have used are:
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://tempuri.org/IExceptionLogService/LogException"
POST
Host:hcdcd-bt01.hcch.com
http://hcdcd-bt01.hcch.com/HCCExceptionLogService/service.svc
SOAP UI HEADERS:
POST http://hcdcd-bt01.hcch.com/HCCExceptionLogService/service.svc HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://tempuri.org/IExceptionLogService/LogException"
User-Agent: Jakarta Commons-HttpClient/3.1
Host: hcdcd-bt01.hcch.com
Content-Length: 763
Can any body tell me what went wrong ?
It is a server error response, presumably on an internal service as the given address doesn't reside on the internet AFAIK.
You must get the server logs to establish what it does not like about your request.
Since the server sent the response code 500 - internal server error - I think you'll have to debug it on the server side, not the client side.
You should check the output of the server log.

Is there a way in CXF to disable the SoapCompressed header for debugging purposes?

I'm watching CXF service traffic using DonsProxy, and the CXF client sends an HTTP header "SoapCompressed":
HttpHeadSubscriber starting...
Sender is CLIENT at 127.0.0.1:2680
Packet ID:0-1
POST /yada/yada HTTP/1.1
Content-Type: text/xml; charset=UTF-8
SoapCompressed: true
Accept-Encoding: gzip,gzip;q=1.0, identity; q=0.5, *;q=0
SOAPAction: ""
Accept: */*
User-Agent: Apache CXF 2.2
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:9090
Connection: keep-alive
Transfer-Encoding: chunked
I'd like to turn SoapCompressed off in my dev environment so that I can see the SOAP on the wire. I've searched Google and grepped the CXF source code, but don't see anything in the docs or code that reference this. Any idea how to make the client send "SoapCompressed: off" instead, without routing it through Apache HTTPD or the like? Is there a way to configure it at the CXF client, in other words?
A grep of the CXF codebase doesn't yield "SoapCompressed" at all. I really don't think it's CXF that is sending that. The Accept-Encoding thing is also suspect as that is only sent if you enable the GZIP interceptors. Is it possible that the proxy thing you are using is adding it?
The client for org.apache.cxf.jaxrs.client.AbstractClient has points where you set the headers in a key-value map (Map). "SoapCompressed", "false".

Categories