Back Forum Reply New

Webservice client with JAXB2 and namespace

Hi,

I have a client using Spring WS, all is working fine.
it is fantastic !!!!

I use WebServiceTemplate plus JAXB2 to marshal an unmarshal

it marshals the objects perfectly. although when I look at my log file I see the following:

2008-05-05 20:43:42,294 TRACE [org..ws.client.MessageTracing.sent] - Sent request [lt;SOAP-ENV:Envelope xmlns:SOAP-ENV=quot;soap/envelope/quot;gt;lt;SOAP-ENV:Header/gt;lt;SOAP-ENV:Bodygt;ltrocessRetailDeliveryReporting xmlns=quot;quot;gt;

Somehow an empty namespace declaration gets into the root element of this message, this causes validation error on the other end.

I know this is not Spring specific , it is JAXB, although could someone give me a hint where to look, what configuration should I look at ,

This is the only problem I have, and I have not been able to figure it out how to get around, and it wouold be a great help for me !!!!

Any suggestion is welcome !!!!!

I marshalled the same data with JAXB2 and it did not generate this in my testcase

1, is it Spring
2, is it JAXB2 ( maybe spring calls it with different params )
3, is it SAAJ ? I am using 1.3 with SOAP 1.1

Thanks a lot,

istvan

ps: I have my local test case to generate an xml based on the same jaxb mapping, it generates the xml file with NO xmlns=quot;quot; in the root tag.

Hi Istvan,

I you are using xjc generated classes, make sure to include package-info.java when you compile. This source file contains a package level annotation that binds all the classes (in the package) to the corresponding namespace.
Otherwise, you can specify the namespace for each class separately as an attribute of the @XmlRootElement annotation.

Hi,

thanks for the idea,

I do not have this file, that can be the problem.

although I do not need any namespace there at all,

also on my windows machine, it works fine when I deploy it to the server ( linux ) it starts appearing.

I am little bit lost, I am trying to reproduce it on my locale computer...

Can I use this package-info.java to specify that I want to REMOVE this namespace declaration from the root element.

yet I got the following result on the linux box:

ltrocessRetailDeliveryReporting xmlns=quot;quot;gt;

on the windows box it is all fine:

ltrocessRetailDeliveryReportinggt;

really confusing.

my root element looks like this:
@XmlRootElement(name = quotrocessRetailDeliveryReportingquot;)

Hi,

I find out it is xerces / Xalan

if I use the xercesImpl-2.8.1.jar and the Xalan which is shipped with Spring ws
I got the same problem on windows as well,

if I move back to the one shipped with tomcat 5.0 I do not receive the namespace declaration.

is there a way I can instruct SAAJ not to be namespace aware when creating the message, or it is JAXB2 which is doing it, I am still not sure what is the setting or instruction that results in this.

ANY idea?


Originally Posted by istvanoalthough I do not need any namespace there at all,

You probably do need a namespace in the payload of your message. Otherwise, your soap message is not interoperable.


Originally Posted by Arjen PoutsmaYou probably do need a namespace in the payload of your message. Otherwise, your soap message is not interoperable.

Thanks for the info but and sending a message to an old prop SOS service that forwards it again if I define any namespace it dies if it receives an empty one it converts it to an other one that fails the validation on the other end

My solution was to copy some line from original jaxb sun installation and now there is no empty nespace declaration

Allthoigh just for my information could u tell me why does that
empty namespace shows up? What is the reason for that?

Thanks again
¥
Back Forum Reply New