Problem turning HTTP Chunking off in AXIS2 - axis2

I have a client sending me requests without HTTP chunking (they use content-length). When my server responds, chunking is enabled, and the client can't handle this - even though they should be able to as they are using HTTP 1.1.....
I have tried to disable chunking by removing the entry below from the axis2 config file (axis2.xml) but the response is still going back chunked.
chunked
So the question is, is there somewhere else that the chunking is being enabled that is over-riding the axis2 setting? In tomcat setting perhaps?
Webserver details - tomcat 6.0.16, axis2 2.1.3
Thanks
Mike

you can disable Chunking programatically as follows:
Options options = new Options();
[...]
options.setProperty(HTTPConstants.CHUNKED, "false");
Source: http://jcesarperez.blogspot.com/2008/10/resolviendo-problemas-de.html

If you created a stub for your web service, just do this:
myStub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, false);

Related

Security headers setup on WebSphere 9.0.5.13

I have to get all these Headers (mentioned below) green when checked the URL "https://.com" on securityheaders.com.
Headers: "Strict-Transport-Security" "Content-Security-Policy" "X-Frame-Options" "X-Content-Type-Options"
The Web Server running here is IBM WebSphere 9.0.5.13 here.
I know it need to be added in some Web.xml file with a context param but there are so manu web.xml files not sure which one, OR
we also tried from the Server Web Container Settings by adding this which didnt work:
com.ibm.ws.webcontainer.ADD_STS_HEADER_WEBAPP....value=max-age=31536000;includeSubDomains;preload
com.ibm.ws.webcontainer.addStrictTransportSecurityHeader....value=max-age=31536000;includeSubDomains;preload
But neither did work. I need to do this for all the Headers mentioned above.
We know how to do this for Tomcat, but having difficulty with WebSphere guys.
If anybody knows how to do this please help me. Thanking you guys in advance
Regards,
Mainak
You need to use the Servlet API's to set custom response headers, either in your application or in a filter. If you can't do that, you can often do similar if you have a proxy server in front of your application.
WebSphere Liberty has basic support for adding custom response headers via server.xml, but it's not available in the traditional websphere application server.
HSTS is unique as there is support for it at various levels in configuration.

Spring Boot, Apache CXF 3.2.5 with MTOM sends empty attachment

I'm having a weird issue with Apache CXF and large (375MB) MTOM attachments are empty.
Running it locally in Eclipse produces the desired results, but deploying it to our server just gives an empty attachment.
The server is written in .NET and doesn't support chunking. With Chunking enabled the client works, but when i disable cunking it fails.
Sadly i'm unable to debug on the server, so i'm restricted to trace logging.
I've tried every trick i've been able to google.
Disable schema validation (CXF-4551) (CXF-7758)
Manually copying the file to java.io.tmpdir before sending, to ensure it can be read.
Custom DataSource
Disable WS-Security
Disable logging interceptor
Nothing seems to make a difference.
Every run i just get something like the following
</soap:Body></soap:Envelope>
--uuid:40ef745b-ac3c-4013-bbe7-a9cc28880423
Content-Type: application/xml
Content-Transfer-Encoding: binary
Content-ID: <7611ca0a-22f8-4637-b4f7-a5dfe7f20b81-3#www.somewhere.dk>
Content-Disposition: attachment;name="32_2018-03-28_output.xml"
--uuid:40ef745b-ac3c-4013-bbe7-a9cc28880423
Trying with a smaller (2KB) file on the server works just fine. A 75MB file gets attached correctly, but results in a HTTP 400 from the receiver (which i suspect is because the file is not fully transferred)
Does anyone have any ideas as to what might be causing this ?
After much trial & error, i finally managed to "solve" this. I enabled schema validation, and the data now appears. This is the exact issue that both bugs in my original question claims to fix.
Client client = ClientProxy.getClient(port);
BindingProvider bp = ((BindingProvider) port);
bp.getRequestContext().put("schema-validation-enabled", "true");
I can't add a comment so I'm posting this as an answer.
Jimmy could you perhaps comment on the latest CXF issue and provide some more details? Which version of CXF, what kind of client you are using, real code samples ideally, client logs?

How does one enable or verify the REST interface of ActiveMQ?

I setup ActiveMQ 5.8.0 on a Windows 2003 virtual server for development purposes. I understand that there is suppose to be a REST interface for reading from and writing to queues and such. But, I can't seem to track down how to do it exactly. Port 8161 can be used to access the admin console, but every URL I try from Firefox Poster returns a 404. I tried URLs like these:
http://localhost:8161/queues <-- 404
http://localhost:61616/queues <-- some default message
http://localhost:61616/queue/inbox <-- same default message
http://localhost:8161/queue/inbox <-- 404
The documentation mentions mapping a URI to the servlet, but I'm not sure how or if I need to do this. The /demo feature is disabled by default, which is fine by me. How do I enable REST for my queues? Thanks!
As /demo is disabled, it been moved to /api
http://localhost:8161/api/message/
this is the path for all REST operations

Apache ProxyRemote with Proxy-Authorization (over connect/HTTPS)

It's easy to use the "RequestHeader append Proxy-Authorization" to create a forward proxy with no authentication that bounce over a password protected one.
But this header is not append to CONNECT requests...
I'm aware of the patch suggested at https://issues.apache.org/bugzilla/show_bug.cgi?id=37355, but it does not seems to be integrated in the trunk/release branch
Is there another way to configure the remote proxy authorization credentials (and could be used in CONNECT transactions) ?
I ported the patch from the 2005 mailing list message to the apache 2.2.X branch (last 2.2) and successfully test it.
Usage :
ProxyRemote * http://[user]:[pswd]#host:port/
(replace also the need of RequestHeader)
https://gist.github.com/131/2a5ffedc2acf61061cf39e966def2ff2

(WCF) .svc call returning the wrong mime type (works locally, not in production)

So I've been developing an app on my dev box for a while and it's time to put it in production. My Service has a method which returns Xml.
This all works locally but when I copy the files over to the web server and try to connect to my WCS using a browser I get this message:
The content type text/html of the response message does not match the content type of the binding (text/xml; charset=utf-8).
Why does it work locally? Has my hosting provider setup something wrong? Have I messed up some config or other? Thanks in advance.
Has the production environment been properly set up?
If not, run ServiceModelReg.exe to register WCF http modules / mappings etc.
http://msdn.microsoft.com/en-us/library/ms732012.aspx
--larsw