Remove X-ORACLE-DMS-ECID and X-ORACLE-DMS-RID response headers - weblogic12c

I have some JAX-RS services deployed in WebLogic 12.2.1. When any service send a response, WebLogic will add the following response headers:
X-ORACLE-DMS-ECID
X-ORACLE-DMS-RID
How do I remove these two response headers?

This can be done with the following JVM properties :
-Doracle.dms.context=OFF
-Dweblogic.diagnostics.context.DisableDMSHTTPAlways=true
But, removing these headers is not supported by Oracle when using FusionMiddleware because some OFMW components should not work properly any longer.

Related

WSO2 Enterprise Integration: POST request give CORS Error

I have Restful APIs. I want to use WSO2 EI. I use WSO2 Integration Studio. When I do that all GET request works well. But POST request gets CORS error when I send request from the front-end (ReactJs). Also request with parameters do not pass to backend either. Is there any extra configuration need to be done?
If you are using WSO2 EI V7.x.x or V8.x.x, just add the following configuration to the <EI_HOME>/runtime/microesb/conf/deployment.toml file.
[synapse_properties]
'synapse.rest.CORSConfig.enabled' = "true"
'synapse.rest.CORSConfig.Access-Control-Allow-Origin' = "http://127.0.0.1:5500, http://localhost:5500"
'synapse.rest.CORSConfig.Access-Control-Allow-Methods' = "GET, POST, PUT, DELETE, HEAD, OPTIONS"
'synapse.rest.CORSConfig.Access-Control-Allow-Headers' = "content-type, Accept, Authorization"
Change the Allowed origin, methods, and headers according to your need.
For WSO2 EI v6.x.x, check out https://docs.wso2.com/display/EI660/Enabling+CORS+for+Data+Services+

GWTTestCase - HTMLUnit - No permitted "Access-Control-Allow-Origin"

When running GWTTestCase that call an external Restful service with GWT (Using Restlet-GWT) the app throws the error below.
Error:
Jan 05, 2015 1:24:41 PM com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl runSingleJob
SEVERE: Job run failed with unexpected RuntimeException: Wrapped java.lang.RuntimeException: No permitted "Access-Control-Allow-Origin" header.
net.sourceforge.htmlunit.corejs.javascript.WrappedException: Wrapped java.lang.RuntimeException: No permitted "Access-Control-Allow-Origin" header.
at net.sourceforge.htmlunit.corejs.javascript.Context.throwAsScriptRuntimeEx(Context.java:1889)
at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.doSend(XMLHttpRequest.java:681)
at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.access$000(XMLHttpRequest.java:94)
at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest$1.run(XMLHttpRequest.java:603)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:602)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
at com.gargoylesoftware.htmlunit.javascript.background.JavascriptXMLHttpRequestJob.run(JavascriptXMLHttpRequestJob.java:36)
at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl.runSingleJob(JavaScriptJobManagerImpl.java:328)
at com.gargoylesoftware.htmlunit.javascript.background.DefaultJavaScriptExecutor.run(DefaultJavaScriptExecutor.java:162)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.RuntimeException: No permitted "Access-Control-Allow-Origin" header.
... 9 more
From my research this seems to be an issue that HTMLUnit would not allow to access Cross-domain, is there a work around with this?
You can add the support of CORS to your application.
A support has been provided in 2.3 release of the Restlet framework (cf http://restlet.com/technical-resources/restlet-framework/guide/2.3/introduction/whats-new/2.3).
If you are using the 2.2 release, and because we won't add this feature to 2.2, you can add the required classes in your own code manually (cf https://github.com/restlet/restlet-framework-java/blob/2.3/modules/org.restlet/src/org/restlet/service/CorsService.java, https://github.com/restlet/restlet-framework-java/blob/2.3/modules/org.restlet/src/org/restlet/engine/application/CorsFilter.java, and https://github.com/restlet/restlet-framework-java/blob/2.3/modules/org.restlet/src/org/restlet/engine/application/CorsResponseHelper.java).
I was stumped by this very same error response but I am not able to refactor the Restlet framework into my client & server codebases.
A couple of tips for handling diagnosis of the problem.
use a proxy or inspect dev tool to record the exact headers within the request and response for both the OPTIONS and GET/POST pairs.
OPTIONS request header "Origin" must match response header "Access-Control-Allow-Origin" exactly. No wildcards. Perhaps write your response to just echo the request like:
response.addHeader("Access-control-allow-origin", request.getHeader("Origin"));
Your request header names must be fully enumerated within the OPTIONS "Access-control-request-headers" header value AND match the "Access-control-Allow-Headers" response header.
Note: that a mismatch in #3 will trigger the same error message as a mismatch in #2.

Camel ReST Proxy route in ServiceMix fails for Base64 uploads

I have deployed on SMX the following route that proxies all ReST request to the real ReST service provider (Tomcat). All ReST calls to SMX routed successfully however a saveDocument service that uploads PDF files fail.
public void configure() throws Exception {
from("jetty:http://{{smx.host}}:{{smx.rest-proxy-port}}/{{smx.context}}matchOnUriPrefix=true")
.log("ReST call received (Java DSL)")
.to("jetty:http://{{real-server-address}}:{{real-ws-port}}/{{context}}?bridgeEndpoint=true&throwExceptionOnFailure=false")
.log("Rest call proxied (Java DSL)");
}
The following exception is logged in servicemix.log.
19:53:57,065 | WARN | HttpClient-137 | HttpExchange | 111 - org.eclipse.jetty.util - 7.5.4.v20111024 | EXCEPTION JettyContentExchange#188af650=POST//real-server-address...:8080/contextpath.../saveDocument#SENDING(3ms)->
EXCEPTED(0ms)sent=3ms java.lang.IndexOutOfBoundsException
Do I have to perform some additional processing on the base64 before redirect the call to the real ReST service?
UPDATE on my previous post.
This seems to work when I use txt file but fails for pdf or doc.
UPDATE 2: It also fails when txt size exceeds 7KB.
Is it possible to set camel jetty to accept big size files?
This can be solved if Multipart WS is used.
I have implemented a Multipart CXF ReST file upload service for testing the route in case of a multipart WS.
The following route works OK for multipart:
from("jetty:http://.../?matchOnUriPrefix=true&enableMultipartFilter=false")
.noStreamCaching()
.log("Service Proxied")
.to("jetty:http://...:../?bridgeEndpoint=true&throwExceptionOnFailure=false");
Still cannot find what is going wrong with the first WS.
The issue is tracked here also.

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.

Cross domain REST/Jersey web services with CORS

I want to make Cross domain REST web services with CORS(Cross-Origin Resource Sharing). I am using Jersey Libraries for making services.
I need to know
What code/configuration changes i need to do from server side perspective?
How to invoke this services from HTML5/js.
Thanks
All the information for your server side configuration can be found at enable-cors.org.
There is no need to change any code clientside, but I would recommend checking the Browsers capability for CORS before using it. Testing code can be found, e.g., here.
I have chosen to solve this problem by providing the server CORS response at the Jersey container level. This might offer more convenience for some applications since it can apply for all responses from the container without modification to the resource handling code.
First one has to create a container response filter that will inject the appropriate header(s). For example for a container that indicates Access-Control-Allow-Origin:* for any response:
class CORSFilter implements ContainerResponseFilter {
#Override
public ContainerResponse filter(ContainerRequest request, ContainerResponse response) {
response.getHttpHeaders().add("Access-Control-Allow-Origin", "*");
return response;
}
}
Then the filter must be added be added to the Jersey response filter chain. This can be done through the resource config in use for the application.
...
DefaultResourceConfig rc = new ClasspathResourceConfig();
rc.getContainerResponseFilters().add(new CORSFilter());
// now create a simple lightweight server using this resource config.
HttpServer server = HttpServerFactory.create(uri,rc);
...
Steps which I used to enable CORS Filter in my Jersey based embedded Jetty application.
jetty-servlet version - 2.12
Added cors-filter dependency in pom
<dependency>
<groupId>com.thetransactioncompany</groupId>
<artifactId>cors-filter</artifactId>
<version>2.1.2</version>
</dependency>
Add the corsfilter to ServletContextHandler of your application.
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
context.addFilter(CORSFilter.class, "/*", EnumSet.of(DispatcherType.INCLUDE,DispatcherType.REQUEST));
server.setHandler(context);//set handle to your server