I have written an http4 client to push Json data up to a server that will take the http request or post. now, my code works on some systems and not on others? and I do not know where the problem lies. is it the server or the client. below is the trace on the POST to the server and the response from the server back to the client. can someone explain to me why this is failing? is the server telling me it is expectng something other than JSON? thank you !!!
I've tried using different headers with same result. I tried sending up a CSV in multipart form-data media type, this fails also, with the same response???? Please note the response, ACCEPT=multipart/form-data header THE POST REQUEST
setHeader[CamelHttpMethod, POST] -->
http4://apm-ts-query-svc-prod.app-api.aws-usw02-pr.px.io:443/v2/ts/upload?throwExceptionOnFailure=false <<< Pattern:InOnly,
Headers:{Authorization=Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImxlZ2FjeS10b2tlbi1rZXkiLCJ0eXAiOiJKV1QifQ.eyJqdGkiOiI0Zrzfo6VKOA,
breadcrumbId=ID-alfuse2i-35498-1557318510555-3-598, CamelAcceptContentType=application/json, CamelFileAbsolute=false,
CamelFileAbsolutePath=/app/PassThruMT1/jboss-fuse-6.3.0.redhat-310/g-dig/upload/Industries/J402_Motor_2019-05-02-11-00-00_0.csv, CamelFileLastModified=1557319009000, CamelFileLength=1538,
CamelFileName=Industries/J_Motor_2019-05-02-11-00-00_0.csv,
CamelFileNameConsumed=Industries/J_Motor_2019-05-02-11-00-00_0.csv,
CamelFileNameOnly=J_Motor_2019-05-02-11-00-00_0.csv, CamelFileNameProduced=g-dig/json/Industries/J_Motor_2019-05-02-11-00-00_0.csv, CamelFileParent=g-d/upload/Industries, CamelFilePath=g-dal/upload/Industries/J_Motor_2019-05-02-11-00-00_0.csv, CamelFileRelativePath=Industries/J_Motor_2019-05-02-11-00-00_0.csv, CamelHttpCharacterEncoding=UTF-8,
CamelHttpMethod=POST,
CamelHttpUri=https://apm-ts-ingestion-svc-prod.app-api.aws-usw02-pr.px.io/v2/ts/upload?throwExceptionOnFailure=false,
Content-Type=application/json, CUSTKEY=Industries, EXPIRY=2019-05-09 06:36:36.101, TENANT=676f31-752-40d-81-c80c5be, TOKEN=eyJhbGciOiJSUzI1NiIsImtpZeQ2eflqE5C3j44MvhPIR0bSEZgznonA503vrzfo6VKOA, UPLOADURL=https://apm-ts-ingestion-svc-prod.app-api.aws-usw02-pr.px.io/v2/ts/upload, x-ge-csvformat=ODB}, BodyType:String, Body:{
"tags" : [ {
"tagId" : "TI5925.PV",
"data" : [ {
"ts" : "2019-05-02T16:00:00",
"v" : "8.903611",
"q" : "3"
} ]
}, {
"tagId" : "TIA4562.PV",
"data" : [ {
"ts" : "2019-05-02T16:00:00",
"v" : "56.47153",
"q" : "3"
} ]
}, {
"tagId" : "XIA4596A.PV",
"data" : [ {
"ts" : "2019-05-02T16:00:00",
"v" : "3.335917",
"q" : "3"
} ]
}, {
"tagId" : "XIA4596B.PV",
"data" : [ {
"ts" : "2019-05-02T16:00:00",
"v" : "1.670584",
"q" : "3"
} ]
}, {
"tagId" : "TIA4561.PV",
"data" : [ {
"ts" : "2019-05-02T16:00:00",
"v" : "49.85203",
"q" : "3"
} ]
}, {
"tagId" : "XIA4595A.PV",
"data" : [ {
"ts" : "2019-05-02T16:00:00",
"v" : "2.098929",
"q" : "3"
} ]
}, {
"tagId" : "XIA4595B.PV",
"data" : [ {
"ts" : "2019-05-02T16:00:00",
"v" : "2.647079",
"q" : "3"
} ]
}, {
"tagId" : "TIA4565.PV",
... [Body clipped after 1000 chars, total length is 16321]
THE RESPONSE
log[HTTP4 Upload Response: ${body}] <<< Pattern:InOnly, Headers:{Accept=multipart/form-data, Authorization=Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImxlZ2FjeS10b2tlbi1rZXkiLCJ0eXAiOiJKV1QifQ.eyJqdGkiOiI0ZmYwY2UxZGFhN2E0N2U4ODIwA503vrzfo6VKOA, breadcrumbId=ID-alphprdfuse2i-35498-1557318510555-3-598, Cache-Control=no-cache, no-store, max-age=0, must-revalidate,
CamelAcceptContentType=application/json,
CamelFileAbsolute=false, CamelFileAbsolutePath=/app/PassMT1/jboss-fuse-6.3.0.redhat-310/tal/upload/Industries/J_Motor_2019-05-02-11-00-00_0.csv,
CamelFileLastModified=1557319009000, CamelFileLength=1538,
CamelFileName=Industries/J_Motor_2019-05-02-11-00-00_0.csv, CamelFileNameConsumed=Industries/J_Motor_2019-05-02-11-00-00_0.csv,
CamelFileNameOnly=J_Motor_2019-05-02-11-00-00_0.csv,
CamelFileNameProduced=g-dal/json/Industries/J_Motor_2019-05-02-11-00-00_0.csv, CamelFileParent=g-dal/upload/Industries,
CamelFilePath=g-dal/upload/Industries/J_Motor_2019-05-02-11-00-00_0.csv,
CamelFileRelativePath=Industries/J_Motor_2019-05-02-11-00-00_0.csv,
CamelHttpCharacterEncoding=UTF-8, CamelHttpMethod=POST,
CamelHttpResponseCode=415, CamelHttpResponseText=Unsupported Media Type,
CamelHttpUri=https://apm-ts-ingestion-svc-prod.app-api.aws-usw02-pr.px.io/v2/ts/upload?throwExceptionOnFailure=false, Connection=keep-alive,
Content-Length=0, Corr=4c4ffcb10fa7ef1c, CUSTKEY=Industries,
Date=Wed, 08 May 2019 12:38:27 GMT, Expires=0, EXPIRY=2019-05-09 06:36:36.101, Pragma=no-cache, Server=none, Strict-Transport-Security=max-age=31536000 ; includeSubDomains, TENANT=67626f31-75-43-81b-cc5bdbce, TOKEN=eyJhbGciOiJSUzI1NiIsI6GlLIGp8-HPeQ2eflqE5C3j44MvhPIR0bSEZgznonA503vrzfo6VKOA, UPLOADURL=https://apm-ts-ingestion-svc-prod.app-api.aws-usw02-pr.px.io/v2/ts/upload, X-Application-Context=APMTS:cloud:0, X-Content-Type-Options=nosniff, X-Frame-Options=DENY, x-ge-csvformat=ODB, X-Vcap-Request-Id=01d04cf7-47ae-4cf9-7d4c-357afe207769, X-Xss-Protection=1; mode=block}, BodyType:org.apache.camel.converter.stream.InputStreamCache, Body:[Body is instance of org.apache.camel.StreamCache]
Well, this is due to just that, what I suspected. It turns out that the upload URL has 2 distinct endpoints, with the /upload it is intended for CSV data multipart form-data, and without the /upload is used for JSON. so, the answer is YES. The server is sending back in the response header what it is expecting as a media type.
https://apm-ts-ingestion-svc-prod.app-api.aws-usw02-pr.px.io/v2/ts/upload - CSV
https://apm-ts-ingestion-svc-prod.app-api.aws-usw02-pr.px.io/v2/ts - JSON
thank you, hope this also helps someone else.