PDA

View Full Version : Compression and Web Services


michael1d
05-26-2005, 05:26 AM
Hi,

I was very impressed to see the results of your integration of Web Services into the Spring Framework.

I was wondering whether you have any ideas on how to implement compression of the data sent between the server and client for web service calls?

There are many examples of overriding the GetWebResponse/GetWebRequest methods and then compressing/decompressing the data either manually or using the gzip/deflate capabilities of the web server.

But given that Spring creates a proxy to deal with the underlying .NET framework classes, I wanted to know how I could achieve this.

Thanks in advance,

Mike :D

michael1d
05-26-2005, 07:38 AM
Argh!

I also see that this is coming in 0.7 not the current release - at what stage is the development of this functionality - does the current CVS version contain it? Is it stable? When (the perennial question for you, no doubt) will 0.7 be released?

Cheers again,

Mike :D

Aleks Seovic
05-27-2005, 03:49 PM
Hi Mike,

Web services code is in CVS, along with a lot of other stuff that is not part of the current release. I believe latest interim build also contains web services stuff in a binary format.

As for the compression, proxy could have necessary logic, or it could be added using AOP interceptor (seems like a perfect scenario for it, actually). If you can point me to a good article describing recommended implementation approach I will take a look at it.

Regards,

Aleks

.ben
02-08-2007, 12:18 PM
I'd like to implement this, but what do I need to proxy? :p. The WebServiceExporter and WebServiceClientFactory ?

Bruno Baia
02-08-2007, 02:12 PM
Hi,

If you need to do something on the server side, the aspect should be applied on the service to be exported via WebServiceExporter.

If you need to do something on the client side, the aspect should be applied on the WebServiceClientFactory.


Do you gonna use WSE, WCF or something with http 1.1 compression (if possible) ?
Anyway, there is an example for an authentification aspect using WSE2 integration under "sandbox\Integrations\Spring.Web.Services2".
The approach is the same.

I'll be working soon on the WebServiceClientFactory for the RC1, and will create an WSE3 integration with at least one aspect to show the approach.
Then users will be able to contribute with their own aspects.

Hope this helps,
Bruno

.ben
02-08-2007, 02:54 PM
I know, I've allready used aspects on both to enable security etc.

Now I need to perform compression of the returned / send data, but I don't know how I can get hold of the returned/send xml string to compress it.

Bruno Baia
02-08-2007, 05:26 PM
Take a look to SoapExtension :
http://msdn2.microsoft.com/en-us/library/system.web.services.protocols.soapextension.aspx

Hope this helps,
Bruno

.ben
02-16-2007, 10:03 AM
I think I have it running on the server side. I used this article (http://www.mastercsharp.com/article.aspx?ArticleID=86&&TopicID=7).

Server config:

<object id="AdvertisementWebService" type="Spring.Web.Services.WebServiceExporter, Spring.Web">
<property name="TargetName" value="DistributedAdvertisementWebServiceProxy"/>
<property name="Name" value="AdvertisementWebService"/>
<property name="Namespace" value="http://WebServices"/>
<property name="Description" value="Advertisement Web Service"/>
<property name="Interfaces">
<list>
<value>WebservicesContracts.IAdvertisementWebService</value>
</list>
</property>
<property name="MemberAttributes">
<dictionary>
<entry key="*">
<object type="MasterCSharp.WebServices.CompressionExtensionAttri bute, CompressionExtension"/>
</entry>
</dictionary>
</property>
</object>


The only thing left, is to add some configuration to the clientfactory. Something like mentioned above cfr MemberAttributes. But how?

<object id="AdvertisementWebservice" type="Spring.Web.Services.WebServiceClientFactory, Spring.Services">
<property name="ServiceUrl" value="http://localhost:1332/Webservices/AdvertisementWebService.asmx"></property>
<property name="ServiceInterface" value="WebservicesContracts.IAdvertisementWebService, WebservicesContracts"></property>
</object>

Bruno Baia
02-16-2007, 05:30 PM
Hi,


The only thing left, is to add some configuration to the clientfactory. Something like mentioned above cfr MemberAttributes. But how?

<object id="AdvertisementWebservice" type="Spring.Web.Services.WebServiceClientFactory, Spring.Services">
<property name="ServiceUrl" value="http://localhost:1332/Webservices/AdvertisementWebService.asmx"></property>
<property name="ServiceInterface" value="WebservicesContracts.IAdvertisementWebService, WebservicesContracts"></property>
</object>


I gonna add TypeAttributes & MemberAttributes to be able to add attributes the proxy type and members.
Then we should have something like in the server side.


Bruno

Bruno Baia
02-16-2007, 05:39 PM
Done.
You can get the latest chenge from CVS or wait for the next nightly build (http://www.springframework.net/downloads/nightly/).

Notice that I changed the 'ServiceUrl' property name to 'ServiceUri'.
See this thread (http://forum.springframework.net/showpost.php?p=5350&postcount=5) to know why.

You should get something like that :

<object id="AdvertisementWebservice" type="Spring.Web.Services.WebServiceClientFactory, Spring.Services">
<property name="ServiceUri" value="http://localhost:1332/Webservices/AdvertisementWebService.asmx"></property>
<property name="ServiceInterface" value="WebservicesContracts.IAdvertisementWebService, WebservicesContracts"></property>
<property name="MemberAttributes">
<dictionary>
<entry key="*">
<object type="MasterCSharp.WebServices.CompressionExtensionAttri bute, CompressionExtension"/>
</entry>
</dictionary>
</property>
</object>



Bruno

.ben
02-16-2007, 06:19 PM
Thanks, you're the best!