I have a .NET web service that returns XML, and I'd like to compress this before it is sent.
There's a couple of ways that I can do this, but I'd rather not have to do it in code.
Can I set up IIS to gzip all content returned by my WebService? It's not being called from a browser.
The other question is if this web service is being consumed by a Java client - will that affect anything?
I imagine that the client proxy will still need to decompress, but there shouldn't be any problem if I use gzip - that is a universal protocol, right?
The standard way to do this kind of thing is to use gzip compression over HTTP since it's directly supported by the protocol. As long as your client supports that then you should be good to go.
If you are writing the client from scratch with more fundamental tools you may need to add handling for this yourself: a good example of this is shown here (python).
I would expect a lot of SOAP client libraries to have built-in support for this but you'll have to try yours to be sure: if they lean on a lower level HTTP library to do their work, in all likelihood it should Just Work.
you can configure metabase.xml in iis for better control over compression. you may want redefine your web application format (.asp,.asmx,...) to metabase if it is not already included.
you can see below:
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/25d2170b-09c0-45fd-8da4-898cf9a7d568.mspx?mfr=true
and also
http://www.businessanyplace.net/?p=wscompress
Related
I've been asked to look into adding an LDAP interface to an existing Java web application - that is, to make it possible for LDAP clients to connect to the application as if it's an LDAP server. I could write code to listen on a dedicated port and implement the LDAP protocol, and hook that into the existing database... but I'd have to understand the protocol first and then there are potential security issues if I write that from the ground up (not to mention the time it could take).
What I'm looking for is a library of existing code - something that handles the ports and protocols, and lets me focus on writing just the back end. There are plenty of client-side libraries out there, as you'd expect, but I've had no luck in finding something to help with server-side development. So the question is, does anyone here know of such a library that would help with this?
Yes you will most probably find many more client implementations than server, however LDAP is a request response protocol, so with a bit of playing around you should be able to use the same classes and their serialization capabilities. Instead of sending the request you would be receiving it, and responding with the response you would otherwise expect from the client.
You could look at the Apache Directory. https://directory.apache.org/api/
It has an embedded directory server project as part of it, which claims to be extensible and embeddable in your application. https://directory.apache.org/apacheds/
So maybe that could be the answer to your needs.
I'm trying to combine these articles: http://java.sun.com/developer/technicalArticles/RMI/rmi_corba/ and http://netbeans.org/kb/docs/javaee/entappclient.html to make simple client-server app using Glassfish, in which I could send a file from (local) client to a directory on the (local) server. This is something new for me and I feel a little overwhelmed at the moment. Any advice, please?
You're kind of in the wrong area. The things you're looking at are for support of RPC sessions. In theory you could send over an enormous byte array, but it is likely unwise to do so.
What would be preferable is to create a simple web app and push the file over HTTP.
Or you could try using a WS Web Service that's configured for MTOM -- it will handle large payloads as well. You can look here for an article of streaming MTOM messages. It's for WebLogic, but it's basically Sun JAX-WS so it should work on Glassfish out of the box.
An advantage of the Web Service is you can host it in an EJB, rather than having to deploy a separate WAR for this facility. What you want to watch out for is having the payload being all stored in RAM. For example, if you want to send a 10Gb file, the actual traffic is going to be the same, but done naively, you will end up holding all 10Gb in the heap on the client and/or the server, which obviously is not desirable.
In the end either way will work. The Web Service had the downside of having to dig in to the shadowy corners of the Web Service stack, where as with a generic Servlet and web app, it's more out in the open, however you will likely be diving in to the inner depths of HTTP to pull that off. For example, if you wanted to use Apache HTTP Client, you would need to create a custom RequestEntity to handle the streaming for you.
All possible, it's just less used and not the default, out of the box, 2 lines of code tutorial example.
One desktop application needs to get some services from server.
For example sending some parameters and receiving some result.
Imagine implementing a solution by Java Servlets, in a way that the app sends the parameters to the servlet (POST) and receives the result in XML.
Does this approach have any security issue in compare with web-services (Soap / Restful) ?
Thanks and sorry if the question is a bit general.
I don't think so. But personally I would still go over REST, mainly because it would be easier to maintain and update if needed. Also probably easier to test and implement.
As long as your solution has suitable authentication (username/password) and takes place over SSL, it's no less secure than Web Services/SOAP. And indeed you might find it a simpler solution to implement.
The security issue is the same for both solutions because it's http but I won't do the post thing because it's not structured properly, meaning it's client dependent and not using a standard. If you don't like XML, you can try JSON.
I am building an ESB (enterprise Service Bus). This means i need to
set up tcp connections and communicate with JSON (well not NEED.. but json is light and easy)
I made a server who is able to set up a TCP socket and receive json. This is all very nice but i need to be able to call methods via a tcp connection.
so for example to call a method:
{server:pictures, method:changeImage('name')}
This is just an example and could change.
my question is: Is there a framework that is able to:
set up tcp server
receive json messages and call the appropriate method
return an answer (in json).
of course json could also be xml but i would rather use json (much cleaner)
thanxs in advance!
A Web Server serving RESTful web services is exactly what you're asking about..
If I were you, I would look into using SOAP based messaging and the WS-* Standards. Things like WS-Federation and WS-AtomicTransactions will allow you to build a more robust ESB.
Any modern Servlet container, perhaps? Running DWR or jabsorb? Have you looked at the modern ESB implementations? Sounds like you have a lot of wheel I've seen before here.
Why do you need to create your own ESB? As I understand it's a quite complex task. Have you considered using existing open-source solutions?
From Apache, you can use the "mod_jk" module to send HTTP requests to Tomcat using the "AJP" protocol, which is far more efficient that HTTP itself.
I want to do the same, but from a Java program. I want to use "AJP" because of its good performances (and Tomcat is not bad after all).
Does someone know about a Java implementation of the client side of "AJP" ?
Doesn't the tomcat-ajp.jar present in %TOMCAT_HOME%/server/lib have the AJP implementation?
There's open source Apache ajp-client available if someone needs it:
This is a java implementation of an ajp13 client, allowing to send requests to a servlet container using this protocol.
Whithout any real idea, but have you looked into Tomcat's source code, yet? Maybe Tomcat doesn't just implement the receiving end of AJP.