You need to actually configure the feature, too. This page gives some
examples of how you do that: http://cxf.apache.org/docs/features.html
- Dennis
On 05/11/2012 01:01 PM, Steve Kim wrote:
Dennis,
Thanks for your help on this.
I assume that TransformInInterceptor will be called once I set the rule on spring.xml, right? I set a break point on handleMessage function, but not stopping it. So as soap message body is not being changed. Is there anything I need to do to add this interceptor?
Thanks,
________________________________
From: Dennis Sosnoski<[email protected]>
To: [email protected]
Sent: Friday, May 11, 2012 9:08 AM
Subject: Re: [javax.xml.bind.UnmarshalException: unexpected element
Looks close, but you need to give the actual namespace rather than the prefix in the key and the values
are the new element names. So like this:<entry
key="{http://xxx.com/common/general/2010/1/1/platformServiceResult}id"
value="id"/>
- Dennis
On 05/11/2012 12:00 PM, Steve Kim wrote:
Dennis, I really appreciate that you direct me to this direction. Would it be
the right rule to add to spring.xml?
Thanks,
<beanid="transformFeature"class="org.apache.cxf.feature.StaxTransformFeature">
<propertyname="inTransformElements"> <entrykey="{ns2}id"value="{ns2}id=id"/>
<entrykey="{ns2}status"value="{ns2}status=status"/>
<entrykey="{ns2}systemId"value="{ns2}systemId=systemId"/> </map>
</property></bean> <map>
If I want to transform from
<platformServiceResult>
<ns2:status>SUCCESS</ns2:status>
<ns2:systemId>ebilprodapp103</ns2:systemId>
to
<id>9faa0d0e-1932-4064-95ec-6a0e10da4c60</id>
<status>SUCCESS</status>
<systemId>ebilprodapp103</systemId>
</platformServiceResult>
________________________________
From: Dennis Sosnoski<[email protected]>
To: [email protected]
Sent: Friday, May 11, 2012 8:25 AM
Subject: Re: [javax.xml.bind.UnmarshalException: unexpected element
You should be able to use the Transformation feature to modify the response
before it's passed to JAXB:
http://cxf.apache.org/docs/transformationfeature.html
- Dennis
On 05/11/2012 11:17 AM, Steve Kim wrote:
That's also my findings. However, this response is from 3rd party. 3rd party
won't be able to update within a short period of time. Only options at this
point is that we have to do something about it. Someone recommended to
manually update package-info.java to include as below:
However, this will cause not to put the name space on the request, 3rd party
can not use the request. I'm using cxf2.4.6 with jaxb-impl.2.1.7. Is there
any workaround so that I can resolve this?
@
elementFormDefault=XmlNsForm.javax.xml.bind.annotation.XmlSchema(namespace =
"http://xxx.com/binders/general/2010/1/1", QUALIFIED)
________________________________
From: Dennis Sosnoski<[email protected]>
To: [email protected]
Sent: Saturday, May 12, 2012 8:02 AM
Subject: Re: [javax.xml.bind.UnmarshalException: unexpected element
Hi Steve,
The schema and message are somewhat garbled, but judging from the error message
the problem is that the response has a namespace for the id element (and
presumably others) while your code expects this not to have a namespace. It
looks like the schema matches your code, since it does not specify
elementFormDefault='qualified' and without this child elements do not use
namespaces.
- Dennis
Dennis M. Sosnoski
Java SOA and Web Services Consulting<http://www.sosnoski.com/consult.html>
CXF and Web Services Security Training<http://www.sosnoski.com/training.html>
Web Services Jump-Start<http://www.sosnoski.com/jumpstart.html>