You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Sreejith Sreekumar <Sr...@ibsplc.com> on 2009/09/29 08:29:31 UTC
Default namespace and xsi:schemaLocation in response
Hi
I am trying out a CXF sample. I need to ensure that the content in the
SOAP response is valid as per an XSD.
The response I get now looks like
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Abcd xmlns:ns2="http://www.example.com/Schemas/myspace">
<ns2:Efgh kjml="1234">
...........
What I really need is as below. The addition being the xmlns, xmlns:xsi
and xsi:schemaLocation attributes.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Abcd xmlns:ns2="http://www.avienttech.com/Schemas/myspace
"
xmlns=http://www.avienttech.com/Schemas/myspace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.avienttech.com/Schemas/myspace mysample.xsd">
<ns2:Efgh kjml="1234">
...........
Any idea on how I can put in
1. The default namespace (xmlns) or ensure that the namespace prefix ns2
is applied on the root element also Eg: <ns2:Abcd ...?
2. How can I specify the xmlns:xsi and xsi:schemaLocation attributes ?
Thanks
Sreejith
DISCLAIMER:
"The information in this e-mail and any attachment is intended only for
the person to whom it is addressed and may contain confidential and/or
privileged material. If you have received this e-mail in error, kindly
contact the sender and destroy all copies of the original communication.
IBS makes no warranty, express or implied, nor guarantees the accuracy,
adequacy or completeness of the information contained in this email or any
attachment and is not liable for any errors, defects, omissions, viruses
or for resultant loss or damage, if any, direct or indirect."
Re: Default namespace and xsi:schemaLocation in response
Posted by Daniel Kulp <dk...@apache.org>.
Most likely, you would need to write a XMLStreamWriter wrapper or similar and
an Interceptor that would wrapper the default XMLStreamWriter we have with
yours that, upon the startElement call, would add extra attributes for the
xsi:type and schema location. We pretty much just write out whatever jaxb
gives us.
Dan
On Tue September 29 2009 2:29:31 am Sreejith Sreekumar wrote:
> Hi
>
> I am trying out a CXF sample. I need to ensure that the content in the
> SOAP response is valid as per an XSD.
>
> The response I get now looks like
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <Abcd xmlns:ns2="http://www.example.com/Schemas/myspace">
> <ns2:Efgh kjml="1234">
> ...........
>
>
> What I really need is as below. The addition being the xmlns, xmlns:xsi
> and xsi:schemaLocation attributes.
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <Abcd xmlns:ns2="http://www.avienttech.com/Schemas/myspace
> "
> xmlns=http://www.avienttech.com/Schemas/myspace"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
> http://www.avienttech.com/Schemas/myspace mysample.xsd">
> <ns2:Efgh kjml="1234">
> ...........
>
>
> Any idea on how I can put in
>
> 1. The default namespace (xmlns) or ensure that the namespace prefix ns2
> is applied on the root element also Eg: <ns2:Abcd ...?
> 2. How can I specify the xmlns:xsi and xsi:schemaLocation attributes ?
>
>
> Thanks
> Sreejith
>
>
>
>
>
>
> DISCLAIMER:
>
> "The information in this e-mail and any attachment is intended only for
> the person to whom it is addressed and may contain confidential and/or
> privileged material. If you have received this e-mail in error, kindly
> contact the sender and destroy all copies of the original communication.
> IBS makes no warranty, express or implied, nor guarantees the accuracy,
> adequacy or completeness of the information contained in this email or any
> attachment and is not liable for any errors, defects, omissions, viruses
> or for resultant loss or damage, if any, direct or indirect."
>
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog