You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Pablo Caballero <pd...@gmail.com> on 2014/04/09 00:25:25 UTC
Force namespace prefix in request
Hi! I'm using cxf (2.2.10 version) as a WS client. The nasty server side
implementation (I can't change it nor suggest to change it to his owner)
requires:
<blah:hola xmlns:blah="http://lalalala">
..................
</blah:hola>
and the (correct) payload generated by my client is
<hola xmlns="http://lalalala">
..................
</hola>
("blah" can be whatever I want)
I played with the package-info.java file adding:
@javax.xml.bind.annotation.XmlSchema(
namespace = "http://lalalala",
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED,
xmlns = {
@javax.xml.bind.annotation.XmlNs(prefix = "blah",
namespaceURI="http://lalalala")}
)
but it does not seem to work.
Could someone help me?
Thank you very much
Best regards!
Re: Force namespace prefix in request
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
One trick which should work is to pass it via Stax Transform feature,
https://cxf.apache.org/docs/transformationfeature.html#TransformationFeature-Changinginputandoutputelementnamesandnamespaces
set a pair "{http://myns}:*" : "{http://myns}:*"
it is kind of a copy transform, and it should result in the prefixes used
Cheers, Sergey
On 08/04/14 23:25, Pablo Caballero wrote:
> Hi! I'm using cxf (2.2.10 version) as a WS client. The nasty server side
> implementation (I can't change it nor suggest to change it to his owner)
> requires:
>
> <blah:hola xmlns:blah="http://lalalala">
> ..................
> </blah:hola>
>
> and the (correct) payload generated by my client is
>
> <hola xmlns="http://lalalala">
> ..................
> </hola>
>
> ("blah" can be whatever I want)
>
> I played with the package-info.java file adding:
>
> @javax.xml.bind.annotation.XmlSchema(
> namespace = "http://lalalala",
> elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED,
> xmlns = {
> @javax.xml.bind.annotation.XmlNs(prefix = "blah",
> namespaceURI="http://lalalala")}
> )
>
> but it does not seem to work.
>
> Could someone help me?
>
> Thank you very much
>
> Best regards!
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com
Re: Force namespace prefix in request
Posted by Daniel Kulp <dk...@apache.org>.
My only suggestion is to upgrade to a newer version of CXF. If you grab the latest CXF versions, there are several options such as the transform feature, namespace mappings, etc… They wouldn’t be available with something that old.
Dan
On Apr 8, 2014, at 6:25 PM, Pablo Caballero <pd...@gmail.com> wrote:
> Hi! I'm using cxf (2.2.10 version) as a WS client. The nasty server side
> implementation (I can't change it nor suggest to change it to his owner)
> requires:
>
> <blah:hola xmlns:blah="http://lalalala">
> ..................
> </blah:hola>
>
> and the (correct) payload generated by my client is
>
> <hola xmlns="http://lalalala">
> ..................
> </hola>
>
> ("blah" can be whatever I want)
>
> I played with the package-info.java file adding:
>
> @javax.xml.bind.annotation.XmlSchema(
> namespace = "http://lalalala",
> elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED,
> xmlns = {
> @javax.xml.bind.annotation.XmlNs(prefix = "blah",
> namespaceURI="http://lalalala")}
> )
>
> but it does not seem to work.
>
> Could someone help me?
>
> Thank you very much
>
> Best regards!
--
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com