You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Matthew Gamble <mg...@primustel.ca> on 2010/02/24 16:47:25 UTC

xsi:type stripped under Tomcat?

I¹m new to XMLBeans and have been trying to use it to create an XML document
as part of a web service.  When I run my code as a standard Java
application, the XML is correctly generated:

<?xml version="1.0" encoding="UTF-8"?>
<c:BroadsoftDocument protocol="OCI" xmlns:c="C">
<sessionId>000000001</sessionId>
<command xsi:type="AuthenticationRequest"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<userId>admin</userId></command>
</c:BroadsoftDocument>

However, when the exact same code is run under Tomcat in a servlet I get:

<?xml version="1.0" encoding="UTF-8"?>
<c:BroadsoftDocument protocol="OCI" xmlns:c="C">
<sessionId>000000001</sessionId>
<command>
<userId>admin</userId></command>
</c:BroadsoftDocument>

This of course isn¹t valid ­ the xsi:type of the ³command² element is
stripped when the code is run under Tomcat.

Does anyone have any suggestions of what I could be doing wrong that would
cause this type of issue only when running under Tomcat?

Thanks!



--------------------------------------------------------------------------
 This electronic message contains information from Primus Telecommunications Canada Inc. ("PRIMUS") , which may be legally privileged and confidential. The information is intended to be for the use of the individual(s) or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this electronic message in error, please notify us by telephone or e-mail (to the number or address above) immediately. Any views, opinions or advice expressed in this electronic message are not necessarily the views, opinions or advice of PRIMUS. It is the responsibility of the recipient to ensure that any attachments are virus free and PRIMUS bears no responsibility for any loss or damage arising in any way from the use thereof.The term "PRIMUS" includes its affiliates.
--------------------------------------------------------------------------
 Pour la version en français de ce message, veuillez voir
http://www.primustel.ca/fr/legal/cs.htm
This message (and any associated files) is intended only for the 
use of the individual or entity to which it is addressed and may 
contain information that is confidential, subject to copyright or
constitutes a trade secret. If you are not the intended recipient 
you are hereby notified that any dissemination, copying or 
distribution of this message, or files associated with this message, 
is strictly prohibited. If you have received this message in error, 
please notify us immediately by replying to the message and deleting 
it from your computer. Messages sent to and from us may be monitored. 

Internet communications cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, arrive 
late or incomplete, or contain viruses. Therefore, we do not accept 
responsibility for any errors or omissions that are present in this 
message, or any attachment, that have arisen as a result of e-mail 
transmission. If verification is required, please request a hard-copy 
version. Any views or opinions presented are solely those of the author 
and do not necessarily represent those of the company.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: xsi:type stripped under Tomcat?

Posted by Richard Lavoie <la...@gmail.com>.
I've had that problem a month ago. After digging into Xml beans code, I
discovered a really weird act. What happens in XML beans is when it tries to
get a hold on it's xsb file to put the attributes into the XML, it literally
calls Thread.currentThread().getContextClassLoader() to find it's xsb files,
what I did to solve it was :

ClassLoader mainLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
try {
   your calls for xml beans and axis
...
} finally {
    Thread.currentThread().setContextClassLoader(mainLoader);
}

This put the current contextclassloader to the webappclassloader so xmlbeans
can find the xsb files in the correct classloader;

Hope it solves your problem.

On Thu, Feb 25, 2010 at 3:09 PM, Wing Yew Poon <wi...@oracle.com>wrote:

>  Matthew,
> you might try posting to the Axis2 mailing list.
> - Wing Yew
>
>  ------------------------------
> *From:* Matthew Gamble [mailto:mgamble@primustel.ca]
> *Sent:* Thursday, February 25, 2010 6:48 AM
> *To:* user@xmlbeans.apache.org
> *Subject:* Re: xsi:type stripped under Tomcat?
>
>  Doing some further testing on my own, I've narrowed the issue down to a
> problem when running xmlbeans and Axis2.  Anytime I try to create the XML
> Document inside my Axis2 web service the xsi:type is always stripped as
> below.
>
> I've tried googling for issues with xmlbeans and axis2, but none of the
> results I found appear to apply to my situation.  Does anyone have any
> advice on how to resolve this? I've been banging my head for a week now
> trying to figure out whats going on.
>
>
>
> On 10-02-24 10:47 AM, "Matthew M. Gamble" <mg...@primustel.ca> wrote:
>
> Išm new to XMLBeans and have been trying to use it to create an XML
> document
>
> as part of a web service.  When I run my code as a standard Java
> application, the XML is correctly generated:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <c:BroadsoftDocument protocol="OCI" xmlns:c="C">
> <sessionId>000000001</sessionId>
> <command xsi:type="AuthenticationRequest"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<http://www.w3.org/2001/XMLSchema-instance%22>
> >
> <userId>admin</userId></command>
> </c:BroadsoftDocument>
>
> However, when the exact same code is run under Tomcat in a servlet I get:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <c:BroadsoftDocument protocol="OCI" xmlns:c="C">
> <sessionId>000000001</sessionId>
> <command>
> <userId>admin</userId></command>
> </c:BroadsoftDocument>
>
> This of course isnšt valid ­ the xsi:type of the łcommand˛ element is
>
> stripped when the code is run under Tomcat.
>
> Does anyone have any suggestions of what I could be doing wrong that would
> cause this type of issue only when running under Tomcat?
>
> Thanks!
>
>
>
> --------------------------------------------------------------------------
>  This electronic message contains information from Primus
> Telecommunications Canada Inc. ("PRIMUS") , which may be legally privileged
> and confidential. The information is intended to be for the use of the
> individual(s) or entity named above. If you are not the intended recipient,
> be aware that any disclosure, copying, distribution or use of the contents
> of this information is prohibited. If you have received this electronic
> message in error, please notify us by telephone or e-mail (to the number or
> address above) immediately. Any views, opinions or advice expressed in this
> electronic message are not necessarily the views, opinions or advice of
> PRIMUS. It is the responsibility of the recipient to ensure that any
> attachments are virus free and PRIMUS bears no responsibility for any loss
> or damage arising in any way from the use thereof.The term "PRIMUS" includes
> its affiliates.
> --------------------------------------------------------------------------
>  Pour la version en français de ce message, veuillez voir
> http://www.primustel.ca/fr/legal/cs.htm
> This message (and any associated files) is intended only for the
> use of the individual or entity to which it is addressed and may
> contain information that is confidential, subject to copyright or
> constitutes a trade secret. If you are not the intended recipient
> you are hereby notified that any dissemination, copying or
> distribution of this message, or files associated with this message,
> is strictly prohibited. If you have received this message in error,
> please notify us immediately by replying to the message and deleting
> it from your computer. Messages sent to and from us may be monitored.
>
> Internet communications cannot be guaranteed to be secure or error-free
> as information could be intercepted, corrupted, lost, destroyed, arrive
> late or incomplete, or contain viruses. Therefore, we do not accept
> responsibility for any errors or omissions that are present in this
> message, or any attachment, that have arisen as a result of e-mail
> transmission. If verification is required, please request a hard-copy
> version. Any views or opinions presented are solely those of the author
> and do not necessarily represent those of the company.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
> This message (and any associated files) is intended only for the
> use of the individual or entity to which it is addressed and may
> contain information that is confidential, subject to copyright or
> constitutes a trade secret. If you are not the intended recipient
> you are hereby notified that any dissemination, copying or
> distribution of this message, or files associated with this message,
> is strictly prohibited. If you have received this message in error,
> please notify us immediately by replying to the message and deleting
> it from your computer. Messages sent to and from us may be monitored.
>
> Internet communications cannot be guaranteed to be secure or error-free
> as information could be intercepted, corrupted, lost, destroyed, arrive
> late or incomplete, or contain viruses. Therefore, we do not accept
> responsibility for any errors or omissions that are present in this
> message, or any attachment, that have arisen as a result of e-mail
> transmission. If verification is required, please request a hard-copy
> version. Any views or opinions presented are solely those of the author
> and do not necessarily represent those of the company.
>



-- 
Richard Lavoie
IT consultant / consultant en informatique

RE: xsi:type stripped under Tomcat?

Posted by Wing Yew Poon <wi...@oracle.com>.
Matthew,
you might try posting to the Axis2 mailing list.
- Wing Yew

  _____  

From: Matthew Gamble [mailto:mgamble@primustel.ca] 
Sent: Thursday, February 25, 2010 6:48 AM
To: user@xmlbeans.apache.org
Subject: Re: xsi:type stripped under Tomcat?


Doing some further testing on my own, I've narrowed the issue down to a problem when running xmlbeans and Axis2.  Anytime I try to create the XML Document inside my Axis2 web service the xsi:type is always stripped as below. 

I've tried googling for issues with xmlbeans and axis2, but none of the results I found appear to apply to my situation.  Does anyone have any advice on how to resolve this? I've been banging my head for a week now trying to figure out whats going on.



On 10-02-24 10:47 AM, "Matthew M. Gamble" <mg...@primustel.ca> wrote:



I¹m new to XMLBeans and have been trying to use it to create an XML document
as part of a web service.  When I run my code as a standard Java
application, the XML is correctly generated:

<?xml version="1.0" encoding="UTF-8"?>
<c:BroadsoftDocument protocol="OCI" xmlns:c="C">
<sessionId>000000001</sessionId>
<command xsi:type="AuthenticationRequest"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<userId>admin</userId></command>
</c:BroadsoftDocument>

However, when the exact same code is run under Tomcat in a servlet I get:

<?xml version="1.0" encoding="UTF-8"?>
<c:BroadsoftDocument protocol="OCI" xmlns:c="C">
<sessionId>000000001</sessionId>
<command>
<userId>admin</userId></command>
</c:BroadsoftDocument>

This of course isn¹t valid ­ the xsi:type of the ³command² element is
stripped when the code is run under Tomcat.

Does anyone have any suggestions of what I could be doing wrong that would
cause this type of issue only when running under Tomcat?

Thanks!



--------------------------------------------------------------------------
 This electronic message contains information from Primus Telecommunications Canada Inc. ("PRIMUS") , which may be legally privileged and confidential. The information is intended to be for the use of the individual(s) or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this electronic message in error, please notify us by telephone or e-mail (to the number or address above) immediately. Any views, opinions or advice expressed in this electronic message are not necessarily the views, opinions or advice of PRIMUS. It is the responsibility of the recipient to ensure that any attachments are virus free and PRIMUS bears no responsibility for any loss or damage arising in any way from the use thereof.The term "PRIMUS" includes its affiliates.
--------------------------------------------------------------------------
 Pour la version en français de ce message, veuillez voir
http://www.primustel.ca/fr/legal/cs.htm
This message (and any associated files) is intended only for the
use of the individual or entity to which it is addressed and may
contain information that is confidential, subject to copyright or
constitutes a trade secret. If you are not the intended recipient
you are hereby notified that any dissemination, copying or
distribution of this message, or files associated with this message,
is strictly prohibited. If you have received this message in error,
please notify us immediately by replying to the message and deleting
it from your computer. Messages sent to and from us may be monitored.

Internet communications cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed, arrive
late or incomplete, or contain viruses. Therefore, we do not accept
responsibility for any errors or omissions that are present in this
message, or any attachment, that have arisen as a result of e-mail
transmission. If verification is required, please request a hard-copy
version. Any views or opinions presented are solely those of the author
and do not necessarily represent those of the company.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org




This message (and any associated files) is intended only for the 
use of the individual or entity to which it is addressed and may 
contain information that is confidential, subject to copyright or
constitutes a trade secret. If you are not the intended recipient 
you are hereby notified that any dissemination, copying or 
distribution of this message, or files associated with this message, 
is strictly prohibited. If you have received this message in error, 
please notify us immediately by replying to the message and deleting 
it from your computer. Messages sent to and from us may be monitored. 

Internet communications cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, arrive 
late or incomplete, or contain viruses. Therefore, we do not accept 
responsibility for any errors or omissions that are present in this 
message, or any attachment, that have arisen as a result of e-mail 
transmission. If verification is required, please request a hard-copy 
version. Any views or opinions presented are solely those of the author 
and do not necessarily represent those of the company.

Re: xsi:type stripped under Tomcat?

Posted by Matthew Gamble <mg...@primustel.ca>.
Doing some further testing on my own, I’ve narrowed the issue down to a
problem when running xmlbeans and Axis2.  Anytime I try to create the XML
Document inside my Axis2 web service the xsi:type is always stripped as
below. 

I’ve tried googling for issues with xmlbeans and axis2, but none of the
results I found appear to apply to my situation.  Does anyone have any
advice on how to resolve this? I’ve been banging my head for a week now
trying to figure out whats going on.



On 10-02-24 10:47 AM, "Matthew M. Gamble" <mg...@primustel.ca> wrote:

> I¹m new to XMLBeans and have been trying to use it to create an XML document
> as part of a web service.  When I run my code as a standard Java
> application, the XML is correctly generated:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <c:BroadsoftDocument protocol="OCI" xmlns:c="C">
> <sessionId>000000001</sessionId>
> <command xsi:type="AuthenticationRequest"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <userId>admin</userId></command>
> </c:BroadsoftDocument>
> 
> However, when the exact same code is run under Tomcat in a servlet I get:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <c:BroadsoftDocument protocol="OCI" xmlns:c="C">
> <sessionId>000000001</sessionId>
> <command>
> <userId>admin</userId></command>
> </c:BroadsoftDocument>
> 
> This of course isn¹t valid ­ the xsi:type of the ³command² element is
> stripped when the code is run under Tomcat.
> 
> Does anyone have any suggestions of what I could be doing wrong that would
> cause this type of issue only when running under Tomcat?
> 
> Thanks!
> 
> 
> 
> --------------------------------------------------------------------------
>  This electronic message contains information from Primus Telecommunications
> Canada Inc. ("PRIMUS") , which may be legally privileged and confidential. The
> information is intended to be for the use of the individual(s) or entity named
> above. If you are not the intended recipient, be aware that any disclosure,
> copying, distribution or use of the contents of this information is
> prohibited. If you have received this electronic message in error, please
> notify us by telephone or e-mail (to the number or address above) immediately.
> Any views, opinions or advice expressed in this electronic message are not
> necessarily the views, opinions or advice of PRIMUS. It is the responsibility
> of the recipient to ensure that any attachments are virus free and PRIMUS
> bears no responsibility for any loss or damage arising in any way from the use
> thereof.The term "PRIMUS" includes its affiliates.
> --------------------------------------------------------------------------
>  Pour la version en français de ce message, veuillez voir
> http://www.primustel.ca/fr/legal/cs.htm
> This message (and any associated files) is intended only for the
> use of the individual or entity to which it is addressed and may
> contain information that is confidential, subject to copyright or
> constitutes a trade secret. If you are not the intended recipient
> you are hereby notified that any dissemination, copying or
> distribution of this message, or files associated with this message,
> is strictly prohibited. If you have received this message in error,
> please notify us immediately by replying to the message and deleting
> it from your computer. Messages sent to and from us may be monitored.
> 
> Internet communications cannot be guaranteed to be secure or error-free
> as information could be intercepted, corrupted, lost, destroyed, arrive
> late or incomplete, or contain viruses. Therefore, we do not accept
> responsibility for any errors or omissions that are present in this
> message, or any attachment, that have arisen as a result of e-mail
> transmission. If verification is required, please request a hard-copy
> version. Any views or opinions presented are solely those of the author
> and do not necessarily represent those of the company.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 
> 


This message (and any associated files) is intended only for the 
use of the individual or entity to which it is addressed and may 
contain information that is confidential, subject to copyright or
constitutes a trade secret. If you are not the intended recipient 
you are hereby notified that any dissemination, copying or 
distribution of this message, or files associated with this message, 
is strictly prohibited. If you have received this message in error, 
please notify us immediately by replying to the message and deleting 
it from your computer. Messages sent to and from us may be monitored. 

Internet communications cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, arrive 
late or incomplete, or contain viruses. Therefore, we do not accept 
responsibility for any errors or omissions that are present in this 
message, or any attachment, that have arisen as a result of e-mail 
transmission. If verification is required, please request a hard-copy 
version. Any views or opinions presented are solely those of the author 
and do not necessarily represent those of the company.