Why I get a Error 400 bad request only with datetime - bad-request

I get a 400 bad request error when the URL send a date time as a parameter expected:
xxx/api/v2/client/64/groups/2019-01-27T07:07:00
but if only send a date it works:
xxx/api/v2/client/64/groups/2019-01-27
I have tested it on my local envirment and it works with date and datetime parameters, but on the client URL it doesn't work with time. All the configs files are the same both environments. The only difference is the server where it is deployed.
Thanks.

I had to add the requestPathInvalidCharacters into the web.config.
<httpRuntime targetFramework="4.5" requestPathInvalidCharacters="<,>,%,&,*,\,?"/>

Related

Cross-Origin Request - "Same origin" blocked on GET request

I'm trying to deploy a SAILS app & a VUE app on heroku with a custom domain. I'm currently facing with something that seems to be a CORS issue, but I do not understand this one.
Problem
When I send a GET request to my backend in stage mode, (with postman or my frontend-app) I get an error message :
"... blocking Cross-Origin Request : the "same origin" policy does not
allow access to the resource located at
https://app-frontend.herokuapp.com/api/v1/account/user-controller
...".
The HTML response is :
Status 503 →Service Unavailable
Cache-Control →no-cache, no-store
Connection →keep-alive
Content-Length →511
Content-Type →text/html; charset=utf-8
Date →Tue, 24 Jul 2018 08:17:13 GMT
Server →Cowboy
And my sails console gives me this info :
Redirecting GET request from 'undefined.' subdomain...
But with POST requests, I don't face to this problem and my route is well defined as it works in dev mode.
Did you try setting csrf: false in the config/security.js? It shouldn't affect GET requests, but the key to your problem might be somewhere there.

Error while using authorization in SoapUI

I am trying to test my SOAP webservice running on weblogic 12c (which is not installed locally) using SoapUI as a client. Without authorization everything works fine, but when I implement very simple UserToken on server and do every step described here:
https://www.soapui.org/soap-and-wsdl/authenticating-soap-requests.html
then I've got following error:
<faultcode>wsse:InvalidSecurityToken</faultcode>
<faultstring>Security token failed to validate. weblogic.xml.crypto.wss.SecurityTokenValidateResult#211ca945[status: false][msg UNT Error:Message Created time past the current time even accounting for set clock skew]</faultstring>
Also I've looked to the http log of SoapUI and I've noticed something strange there:
Tue Mar 20 09:15:52 CET 2018:DEBUG:>>
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="..." xmlns:wsu="...">
<wsse:UsernameToken wsu:Id="UsernameToken-374B6AAD9B07D377D515215337525091">
<wsse:Username>user</wsse:Username>
<wsse:Password Type="...#PasswordText">password</wsse:Password>
<wsse:Nonce EncodingType="...#Base64Binary">urRvoAYbjjovfD0OQqvJ6g==</wsse:Nonce>
<wsu:Created>2018-03-20T08:15:52.464Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
The time of log (which is current one) is different then in <wsu:Created> tag. I don't know if it is important, but I am in UTC+01:00 time zone.
EDIT
I've give up with SoapUI and I've implemented my own Java client with authorization using CredentialProvider:
((BindingProvider) port).getRequestContext().put(WSSecurityContext.CREDENTIAL_PROVIDER_LIST, credentialProviders);
And then it was the same! So probably it isn't SoapUI problem, but something else.
Exception in thread "main" com.sun.xml.ws.fault.ServerSOAPFaultException:
Client received SOAP Fault from server: Security token failed to validate. weblogic.xml.crypto.wss.SecurityTokenValidateResult#37b70a09[status: false]
[msg UNT Error:Message Created time past the current time even accounting for set clock skew] Please see the server log to find more detail regarding exact cause of the failure.
at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:193)
at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:131)
at com.sun.xml.ws.client.sei.StubHandler.readResponse(StubHandler.java:253)
at com.sun.xml.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:203)
at com.sun.xml.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:290)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:92)
...
When I've looked to the message using Wireshark, time in header was also decrease by one hour. That is really strange and I have no idea what is going on. How am I supposed to test my webservice using authorization? Locally I am using Windows 7, but my Weblogic is running on CentOS 7. As I said both are set to UTC+01:00.
OK, I finally menage to solve this issue. It turns out that server time is late for 2 minutes comparing to the local machine time. Webservice requires time between client and server cannot be larger then few seconds. When I adjusted time everything is working properly.
Additionally, current time in log Mar 20 09:15:52 CET 2018 and time in message 2018-03-20T08:15:52.464Z are equal, but just in different format.

Not able to access Coldfusion Rest Service through website url - Coldfusion

My coldfusion version is 10 and configured with iis. I have configured Rest service using the following code
<cfset restInitApplication(getDirectoryFromPath(getCurrentTemplatePath()), "myservicename") />
My cfc which is in same directory looks something like that
component restpath="test" rest="true" produces="application/json"
{
remote array function getResult(
required string tmpID restargsource="path",
string startDate restargsource="query",
string endDate restargsource="query"
)
httpmethod="GET"
restpath="{tmpID}"
{
return arguments.tmpID;
}
}
I am trying to access the rest service by url but it is giving me 404 not found error. Here is url which i have tried.
http://localhost:8500/rest/myservicename/test/10221
http://example.com/rest/myservicename/test/10221
http://127.0.0.1/rest/myservicename/test/10221
But all three is not working for me. When i try to refresh the service from coldfusion administrator, it is giving me following error.
Unable to refresh REST service.
Application myservicename could not be initialized.
Reason: The application does not contain any rest enabled CFCs.
The application does not contain any rest enabled CFCs.
I have save my cfc to webroot of iis and update the root path of rest service through coldfusion administrator. Then above error is gone and got the green message 'Server has been updated successfully'. But still not accessible through any url. Still getting 404 error. Can any one point me where i am doing wrong? Or help me to resolve this issue.

SoapUI endpoint error randomly

I don't understand something about SoapUI and his mockservice's behaviour.
I'm using the client of SoapUI (testcase) and a Java EE application with JAX-RPC.
My problem is :
when I'm trying to call any webservice, from my Java Client, or the testcase of SoapUI, the mockservice return a well message at first call, and the error below at the second call, with the same call or not.
But if I'm waiting, It works ...
So, I have enabled the option in SOAPui : "close HTTP connection after each SOAP request" and it works all the time...
So my question is :
"Is it a normal behaviour of the mockservice, and how to implement this with my java client ?"
Thank you all.
<soapenv:Fault>
<faultcode>Server</faultcode>
<faultstring>Missing operation for soapAction [] and body element [null] with SOAP Version [SOAP 1.1]</faultstring>
</soapenv:Fault>
OK,
I found a solution on the forum of SoapUI : http://www.soapui.org/forum/viewtopic.php?t=5648
It is when you have the settings flag "HTTP Settings/Logs wire content of all mock requests" set to true.
=> Uncheck the flag and it works fine!
Thanks a lot !
I had the same problem, using SoapUI 5.1.2 Pro.
After receiving first asynchronous response to the MockService, the MockService
stopped and could not receive any more responses for the request I sent.
The error message was:
Thu Jul 02 12:59:44 CEST 2015:ERROR:An error occurred [Missing operation for soapAction [XXXX] and body element [null] with SOAP Version [SOAP 1.1]], see error log for details
In SoapUI Settings:
File->Preferences->Http Settings: "Enable Mock HTTP log", uncheck box:
"Logs wire content of all mock requests".
Now I receive several asynchronous responses in a row, and give response back on them.
The same problem may happen when two mock services run with the same endpoint address (including port and path) on SoapUI.

Downloading file by WebClient Exception

I have a problem downloading particular file types by WebClient. So there are no problems with usual types - mp3, doc and others, but when I rename file extension to config it returns me:
InnerException = {System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
when I'm trying to access this file in browser (http://localhost:3182/Silverlight.config) - it's a usual xml file within - server returns me following error page:
Server Error in '/' Application.
This type of page is not served.
Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.config' may be incorrect. Please review the URL below and make sure that it is spelled correctly.
Requested URL: /Silverlight.config
So I suppose this hapens because of some server configuration, which blocks files of unknown type.
downloading code is simple:
WebClient webClient = new WebClient();
webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted);
webClient.OpenReadAsync(new Uri("../Silverlight.config", UriKind.RelativeOrAbsolute));
completted eventhandler omitted for simplicity.
I'm not sure this is possible.
The .config extension is handled by the ASP.NET engine, for security reasons (sensitive data like connection strings need to be kept safe and hidden from unauthorized viewers).
This means that visitors cannot view your web.config file's content by simply entering "www.example.com/web.config" into their browser's adress bar.
EDIT : actually you can but I don't recommand it. If you really need to do it, you have to remove the mapping between the .config extension and ASP.NET ISAPI filter in IIS.