Timestamp validation failed error while sending SOAP request in java - soap

Able to get response in SoapUI on setting "WSS TimeToLive" to any value greater than zero. But through java code what should be the done to set "WSS TimeToLive" property value. Any idea!!!

Related

QuickFIX/J: Is there any way to modify the logon response sent by the server

I am building a FIX adapter and the server I am hitting to response with 1137=FIX.5.0SP2.
My understanding is that 1137/DefaultApplVerId should be an enum. And QuickFIX/J throws up because it is expecting an enum value like 9.
13:46:00.628 [NioProcessor-12] ERROR quickfixj.errorEvent - org.quickfixj.QFJException: Unknown or unsupported ApplVerID: FIX.5.0SP2
org.quickfixj.QFJException: Unknown or unsupported ApplVerID: FIX.5.0SP2
Since I have no control over how the server responds. So my question is if there is any way for me to intercept and modify the response before it gets parsed by QuickFIX/J?

Appropriate status code for a invalid form

The data could not have been inputted by a typical user due to client-side validation. Is "400 Bad Request" the appropriate status code?
If you are certain the form is invalid 400 Bad Request is acceptable. However depending on why you believe a form is invalid you may also choose to use
status code 422 Unprocessable Entity.
This status code is designed to handle the use case where an submitted request is understood by the server and the request is syntactically correct, but the server was unable to process the instructions contained within the request.
Another possibly appropriate error code would be 415 Unsupported Media Type. This error code should be used when the server fails to understand the request due to an invalid type of form. For example, if a server expected a JSON value but was given XML it should in theory return a 415 Unsupported Media Type code.

Calling error component from sightly java

I have a sightly java class(a java class included inside component) which calls an api and checks whether the response in null. If its null, I have to call the error component. When I am setting the response status as 404, it is not working because before executing that line, it is taking the response as 200. How to call the error component in this case.
Note: I have tried redirecting the URL to error.html, but thats not the proper solution.
It is generally bad practice to redirect or change the response status from a component/view as the response might already have some content that was committed.
You might want to redesign you application to either:
Call the remote API at the beginning of the request handling and, if the remote API returns null, return a 404 before anything else is committed to the response.
Handle the null response from the remote API by either:
Rendering an appropriate response, in case the null response is expected/permitted in some cases.
Throwing an exception, which will result in status 500, in case the null response is not expected.

Camel does not set 'Transfer-Encoding chunked' in case response is prepared by exception handler processor

I am implementing REST services using Apache-CXF running on servicemix and for that I have a camel route that does some processing, sends the message over queue, process some more and send back the reply. Something like this:
from("direct:start")
.process(A)
.process("activemq:abc")
.process(B);
On this route I have applied some basic validation and exception handler and when I have to stop the route in both cases, I use something like this:
exchange.getOut().setBody(response);
exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);
I use soap UI, restclient-UI and putty to make http requests and I get proper response body displayed in all of them. Now I wanted to preserve request headers so I made a little change everywhere in the code so that response bodies are set in exchange.getIn() only. For example: in case of validation failure I do:
exchange.getIn().setBody(response);
exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);
Just with this little change, the rest clients I am using to make request stopped displaying the response body. As per the server logs, response is being generated and also as per the logs in rest client, I am getting the proper response but they are unable to display the response body only in case when I stop the route in between. Normal response is displaying just fine. Only the restclient-UI was considerate enough to show the error as to why they are not displaying body and the error is:
Byte array conversion from response body stream failed.
Diggin deeper, I found the only response header which was there in success response but missing in error response:
Transfer-Encoding chunked
Error response is around 1000 characters long and contains a header called content-length. I am not sure but I think the problem has something to do with this itself. I would really like to play with exchange.getIn but these different kind of responses prepared by camel are confusing me. How can I make sure my camel responses are always displayed properly?
The Content-Length header will be preserved from the original request so you need to remove it so that camel cxf can work out the new body length on the response and set Content-Length with that.

Coldfusion Webservice and SOAP

I am using coldfusion and IIS 7.5
Problem is that when the web service has 500 error, it returns HTML instead of XML.
Can anyone help me in fixing this please.
Thanks.
This is an Internal Server Error, may have occurred because of a data type mismatch. The server is expecting one data type but you are sending a different data type for the input parameter. Please check the input format of the web service that you are calling.
For example: If you try to consume a web service method which takes a SOAP object as an input parameter and you call that method with a different parameter other than SOAP the server will throw a 500 error.