You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Vassilis Virvilis <v....@biovista.com> on 2013/04/05 11:29:28 UTC

cxf-2.7.4: configuring woodstox limits.

Hello,

We have updated to cxf-2.7.4 and our internal test suite had hit the 
50000 limit of cxf configuration for the woodstox xml parser. 
Furthermore woodstox in this release is a hard requirement so we can't 
get rid of it.

So far we have found (after digging in the source) the following system 
property that does the trick
         System.setProperty("org.apache.cxf.stax.maxChildElements", 
"100000");

We can live with this client side but not server side since the setting 
is global and affects the whole jvm, other servlets, other endpoints etc

So I have two questions.

1) Server side: How I can configure the limits from the spring 
configuration. Is it possible to do it per endpoint? per servlet?
2) Client side: How I can configure the limits programmatically?

Before you suggest to use attachments read below:

Why we don't use attachments?
-----------------------------

The burden of handling attachments and the loss of portability does not 
justify their use for the specific function which generally returns a 
small number of elements back but rarely it can exceeds the cxf imposed 
woodstox limits.

	Vassilis


-- 

__________________________________

Vassilis Virvilis Ph.D.
Head of IT
Biovista Inc.

US Offices
2421 Ivy Road
Charlottesville, VA 22903
USA
T: +1.434.971.1141
F: +1.434.971.1144

European Offices
34 Rodopoleos Street
Ellinikon, Athens 16777
GREECE
T: +30.210.9629848
F: +30.210.9647606

www.biovista.com

Biovista is a privately held biotechnology company that finds novel uses 
for existing drugs, and profiles their side effects using their 
mechanism of action. Biovista develops its own pipeline of drugs in CNS, 
oncology, auto-immune and rare diseases. Biovista is collaborating with 
biopharmaceutical companies on indication expansion and de-risking of 
their portfolios and with the FDA on adverse event prediction.



Re: cxf-2.7.4: configuring woodstox limits.

Posted by Sergey Beryozkin <sb...@gmail.com>.
These are the legacy properties affecting the actual StaxUtils as far as 
I recall, have a look please at StaxUtils.setRestrictionProperties

Sergey
On 09/04/13 09:40, Vassilis Virvilis wrote:
> Any idea on this one?
>
> On 04/05/2013 03:28 PM, Vassilis Virvilis wrote:
>> Daniel thanks for the quick reply. Still I cannot solve it server side.
>>
> ...
>>
>> But how? ... I tried
>>
>> <simple:server id="my_service_id" address="/MyService" ...>
>> <simple:dataBinding>
>> <bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
>> </simple:dataBinding>
>>
>> <simple:properties>
>> <entry key="org.apache.cxf.stax.maxChildElements" value="1000000" />
>> </simple:properties>
>> ...
>>
>> but it doesn't work. Where should I put it and where is the spring magic
>> property I should set? Any snippet would be of great help. Thanks...
>>
>>>
>>
>>
>>
>


Re: cxf-2.7.4: configuring woodstox limits.

Posted by Vassilis Virvilis <v....@biovista.com>.
Any idea on this one?

On 04/05/2013 03:28 PM, Vassilis Virvilis wrote:
> Daniel thanks for the quick reply. Still I cannot solve it server side.
>
...
>
> But how? ... I tried
>
> <simple:server id="my_service_id" address="/MyService" ...>
> <simple:dataBinding>
> <bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
> </simple:dataBinding>
>
> <simple:properties>
> <entry key="org.apache.cxf.stax.maxChildElements" value="1000000" />
> </simple:properties>
> ...
>
> but it doesn't work. Where should I put it and where is the spring magic
> property I should set? Any snippet would be of great help. Thanks...
>
>>
>
>
>

-- 
    Vassilis

Re: cxf-2.7.4: configuring woodstox limits.

Posted by Vassilis Virvilis <v....@biovista.com>.
Daniel thanks for the quick reply. Still I cannot solve it server side.

On 04/05/2013 02:17 PM, Daniel Kulp wrote:
>
> On Apr 5, 2013, at 5:29 AM, Vassilis Virvilis<v....@biovista.com>  wrote:
>
>>
>> 1) Server side: How I can configure the limits from the spring configuration. Is it possible to do it per endpoint? per servlet?
>
> You should be able to set the same property as an endpoint property in the spring config or a Bus property, etc..

But how? ... I tried

	<simple:server id="my_service_id" address="/MyService" ...>
		<simple:dataBinding>
			<bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
		</simple:dataBinding>

		<simple:properties>
			<entry key="mtom-enabled" value="true" />
			<entry key="org.apache.cxf.stax.maxChildElements" value="1000000" />
		</simple:properties>
	...

but it doesn't work. Where should I put it and where is the spring magic 
property I should set? Any snippet would be of great help. Thanks...

>
> I need to test a bit on the client side.   Ideally, you could just set it on the client's request context, but since this applies to the response, I'm not 100% sure it would get picked up.   Worst case, you can do ClientProxy.getClient(proxy).getEndpoint().put("org.ap….", 100000);
>

Yep the 
ClientProxy.getClient(proxy).getEndpoint().put("org.apache.cxf.stax.maxChildElements", 
"100000") trick works. Thanks



	Vassilis




Re: cxf-2.7.4: configuring woodstox limits.

Posted by Daniel Kulp <dk...@apache.org>.
On Apr 5, 2013, at 5:29 AM, Vassilis Virvilis <v....@biovista.com> wrote:

> Hello,
> 
> We have updated to cxf-2.7.4 and our internal test suite had hit the 50000 limit of cxf configuration for the woodstox xml parser. Furthermore woodstox in this release is a hard requirement so we can't get rid of it.
> 
> So far we have found (after digging in the source) the following system property that does the trick
>        System.setProperty("org.apache.cxf.stax.maxChildElements", "100000");
> 
> We can live with this client side but not server side since the setting is global and affects the whole jvm, other servlets, other endpoints etc
> 
> So I have two questions.
> 
> 1) Server side: How I can configure the limits from the spring configuration. Is it possible to do it per endpoint? per servlet?
> 2) Client side: How I can configure the limits programmatically?

You should be able to set the same property as an endpoint property in the spring config or a Bus property, etc..  

I need to test a bit on the client side.   Ideally, you could just set it on the client's request context, but since this applies to the response, I'm not 100% sure it would get picked up.   Worst case, you can do ClientProxy.getClient(proxy).getEndpoint().put("org.ap….", 100000);

That said, this is good information.   We're trying to find a good balance for defaults that would provide some level of security, but also not affect too many people.   We might tune some of these settings a bit more.   

Dan



> 
> Before you suggest to use attachments read below:
> 
> Why we don't use attachments?
> -----------------------------
> 
> The burden of handling attachments and the loss of portability does not justify their use for the specific function which generally returns a small number of elements back but rarely it can exceeds the cxf imposed woodstox limits.
> 
> 	Vassilis
> 
> 
> -- 
> 
> __________________________________
> 
> Vassilis Virvilis Ph.D.
> Head of IT
> Biovista Inc.
> 
> US Offices
> 2421 Ivy Road
> Charlottesville, VA 22903
> USA
> T: +1.434.971.1141
> F: +1.434.971.1144
> 
> European Offices
> 34 Rodopoleos Street
> Ellinikon, Athens 16777
> GREECE
> T: +30.210.9629848
> F: +30.210.9647606
> 
> www.biovista.com
> 
> Biovista is a privately held biotechnology company that finds novel uses for existing drugs, and profiles their side effects using their mechanism of action. Biovista develops its own pipeline of drugs in CNS, oncology, auto-immune and rare diseases. Biovista is collaborating with biopharmaceutical companies on indication expansion and de-risking of their portfolios and with the FDA on adverse event prediction.
> 
> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com