You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Se...@intego-group.com on 2008/12/04 16:56:52 UTC
Exception while marshalling
I have some hibernate objects what should be marshaled, and if i get
error during this process - for example in lazy loading - i get very
strange output:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:findByCriteriaResponse xmlns:ns1="http://ws.pc2.takecharge.com/">
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Marshalling Error: No row with the given
identifier exists: [com.data.alert.AlertType#10]</faultstring>
</soap:Fault>
</ns1:findByCriteriaResponse>
</soap:Body>
</soap:Envelope>
Is there any ability to create normal response - Fault element inside
Body - not in sub tags:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Marshalling Error: No row with the given
identifier exists: [com.data.alert.AlertType#10]</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
--
----
Best regards,
Sergey Pulyaev
Java Technical Lead
Intego Group
43/2 Gagarina prospect,
Kharkov, 61001, Ukraine
phone: 1-407-641-4260
Sergey.Pulyaev@intego-group.com
www.intego-group.com
--------
This data is for general information only and shall not be used to produce documents of any kind without same being submitted to, reviewed by, and approved by Intego in writing. All data is subject to change. User assumes all liability relating to the use of this data and agrees to release, indemnify, and hold harmless Intego from any and all claims relating said use. User is responsible to check for any viruses before use.
Re: Exception while marshalling
Posted by Sergey Pulyaev INTEGO <SP...@intego-group.com>.
Now i have got the same situation again - after switching to version 2.2.3.
Now StaxOutInterceptor.getXMLOutputFactory always returns NULL - so i
have no way to specify this flag anymore.
How can i setup XMLStreamWriter to
AUTOMATIC_EMPTY_ELEMENTS = OFF ?
Sergey Pulyaev wrote:
> I have found the solution:
> in one of interceptors before the WrappedOutInterceptor
> i set "auto empty elements" property of xml writer to false
> XMLOutputFactory outputFactory =
> StaxOutInterceptor.getXMLOutputFactory(message);
>
> if(WstxOutputFactory.class.isAssignableFrom(outputFactory.getClass())){
> WstxOutputFactory of = (WstxOutputFactory)outputFactory;
>
> of.getConfig().setProperty(XMLOutputFactory2.P_AUTOMATIC_EMPTY_ELEMENTS,
> false);
> }
>
>
> Sergey Pulyaev wrote:
>
>> Ok, i have switched to 2.0.9.
>> But now - when i use code in line 76 - i mean CachingXmlEventWriter - i
>> get invalid response text:
>> previously i get response from function with result List<Long> like that:
>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>> <soap:Body>
>> <ns1:getUserRolesResponse
>> xmlns:ns1="http://ws.pc2.takecharge.com/"></ns1:getUserRolesResponse></soap:Body>
>> </soap:Envelope>
>>
>>
>
>
--------
This data is for general information only and shall not be used to produce documents of any kind without same being submitted to, reviewed by, and approved by Intego in writing. All data is subject to change. User assumes all liability relating to the use of this data and agrees to release, indemnify, and hold harmless Intego from any and all claims relating said use. User is responsible to check for any viruses before use.
Re: Exception while marshalling
Posted by Sergey Pulyaev <Se...@intego-group.com>.
I have found the solution:
in one of interceptors before the WrappedOutInterceptor
i set "auto empty elements" property of xml writer to false
XMLOutputFactory outputFactory =
StaxOutInterceptor.getXMLOutputFactory(message);
if(WstxOutputFactory.class.isAssignableFrom(outputFactory.getClass())){
WstxOutputFactory of = (WstxOutputFactory)outputFactory;
of.getConfig().setProperty(XMLOutputFactory2.P_AUTOMATIC_EMPTY_ELEMENTS,
false);
}
Sergey Pulyaev wrote:
>
> Ok, i have switched to 2.0.9.
> But now - when i use code in line 76 - i mean CachingXmlEventWriter - i
> get invalid response text:
> previously i get response from function with result List<Long> like that:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <ns1:getUserRolesResponse
> xmlns:ns1="http://ws.pc2.takecharge.com/"></ns1:getUserRolesResponse></soap:Body>
> </soap:Envelope>
>
--
View this message in context: http://www.nabble.com/Exception-while-marshalling-tp20836363p21049494.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Exception while marshalling
Posted by Sergey Pulyaev <Se...@intego-group.com>.
Ok, i have switched to 2.0.9.
But now - when i use code in line 76 - i mean CachingXmlEventWriter - i get
invalid response text:
previously i get response from function with result List<Long> like that:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:getUserRolesResponse
xmlns:ns1="http://ws.pc2.takecharge.com/"></ns1:getUserRolesResponse></soap:Body>
</soap:Envelope>
But now i receive
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:getUserRolesResponse xmlns:ns1="http://ws.pc2.takecharge.com/" />
</soap:Body>
</soap:Envelope>
That result in NULL result, instead of empty list.
Any suggestions?
dkulp wrote:
>
>
> Probably not. I think the buffering for validation was added for 2.0.8,
> maybe 2.0.7.
>
> Dan
>
>
--
View this message in context: http://www.nabble.com/Exception-while-marshalling-tp20836363p21038233.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Exception while marshalling
Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 16 December 2008 11:06:35 am Sergey Pulyaev wrote:
> CXF cxf-api-2.0.6
> Server: Jetty 6.1.9
>
> I use CXF 2.0.6 - where is no string
> if (shouldValidate(message) && !isRequestor(message)) {
> in AbstractOutDatabindingInterceptor.
>
> Is there any solution for CXF 2.0.6 ?
Probably not. I think the buffering for validation was added for 2.0.8,
maybe 2.0.7.
Dan
>
> dkulp wrote:
> > If schema validation is turned on, we now (starting with 2.1.3) "cache"
> > the
> > xml events until the very end and then write them all out if no
> > exceptions are thrown during mashalling. Thus, one fix for you would be
> > to just turn
> > on schema validation. Obviously, the schema validation invokes some
> > extra
> > overhead. Thus, we probably could introduce a new flag to turn on the
> > buffering. If you would like to tackle that, a patch to
> > AbstractOutDatbindingInterceptor would be all that is needed.
> > On line 75, there is:
> > if (shouldValidate(message) && !isRequestor(message)) {
> > that would just need to be updated to check extra flags.
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Re: Exception while marshalling
Posted by Sergey Pulyaev <Se...@intego-group.com>.
CXF cxf-api-2.0.6
Server: Jetty 6.1.9
I use CXF 2.0.6 - where is no string
if (shouldValidate(message) && !isRequestor(message)) {
in AbstractOutDatabindingInterceptor.
Is there any solution for CXF 2.0.6 ?
dkulp wrote:
>
>
> If schema validation is turned on, we now (starting with 2.1.3) "cache"
> the
> xml events until the very end and then write them all out if no exceptions
> are thrown during mashalling. Thus, one fix for you would be to just
> turn
> on schema validation. Obviously, the schema validation invokes some
> extra
> overhead. Thus, we probably could introduce a new flag to turn on the
> buffering. If you would like to tackle that, a patch to
> AbstractOutDatbindingInterceptor would be all that is needed.
> On line 75, there is:
> if (shouldValidate(message) && !isRequestor(message)) {
> that would just need to be updated to check extra flags.
>
--
View this message in context: http://www.nabble.com/Exception-while-marshalling-tp20836363p21036036.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Exception while marshalling
Posted by Daniel Kulp <dk...@apache.org>.
This comes down to the way CXF prioritizes streaming for performance. In
order to properly stream data, we have to make the assumption that writing
the object graph out will succeed. In your case, that's not true. There
is another case that also breaks it the same way: schema validation on
writes.
If schema validation is turned on, we now (starting with 2.1.3) "cache" the
xml events until the very end and then write them all out if no exceptions
are thrown during mashalling. Thus, one fix for you would be to just turn
on schema validation. Obviously, the schema validation invokes some extra
overhead. Thus, we probably could introduce a new flag to turn on the
buffering. If you would like to tackle that, a patch to
AbstractOutDatbindingInterceptor would be all that is needed.
On line 75, there is:
if (shouldValidate(message) && !isRequestor(message)) {
that would just need to be updated to check extra flags.
Dan
On Thursday 04 December 2008 10:56:52 am Sergey.Pulyaev@intego-group.com
wrote:
> I have some hibernate objects what should be marshaled, and if i get
> error during this process - for example in lazy loading - i get very
> strange output:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <ns1:findByCriteriaResponse
> xmlns:ns1="http://ws.pc2.takecharge.com/"> <soap:Fault>
> <faultcode>soap:Server</faultcode>
> <faultstring>Marshalling Error: No row with the given
> identifier exists: [com.data.alert.AlertType#10]</faultstring>
> </soap:Fault>
> </ns1:findByCriteriaResponse>
> </soap:Body>
> </soap:Envelope>
>
> Is there any ability to create normal response - Fault element inside
> Body - not in sub tags:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <soap:Fault>
> <faultcode>soap:Server</faultcode>
> <faultstring>Marshalling Error: No row with the given
> identifier exists: [com.data.alert.AlertType#10]</faultstring>
> </soap:Fault>
> </soap:Body>
> </soap:Envelope>
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog