Open glassfishrobot opened 12 years ago
Reported by gadams00
@lukasj said: this looks to be a JAXB issue. Turning tt>@SchemaValidation</tt feature on shows that the message sent by service is not valid according to the schema generated by wsgen which uses JAXB behind the scenes.
[org.xml.sax.SAXParseException; lineNumber: 0; columnNumber: 0;
cvc-complex-type.2.4.a: Invalid content was found starting with element 'child'.
One of '{"http://child.schema.wstest.test.com":child, name}' is expected.]
Problem is that each element is defined in its own namespace but in message which is sent only one namespace is used:
...
<ns4:getParentResponse
xmlns:child="http://child.schema.wstest.test.com"
xmlns:parent="http://parent.schema.wstest.test.com"
xmlns:ns4="http://service.wstest.test.com/">
<return>
<child>
<name>ChildName</name>
<parent>
<name>ParentName</name>
</parent>
</child>
<name>ParentName</name>
</return>
</ns4:getParentResponse>
...
File: wstest.zip Attached By: gadams00
Was assigned to yaroska
This issue was imported from java.net JIRA JAX_WS-1053
I've run into an issue with metro 2.1 and 2.2 that's not present in metro 2.0 where if a service endpoint references a complex type twice in the dependency graph that has @XmlRootElement annotation, Metro generates ref elements in generated schema. I believe this only applies to top-down (or java first) web service development. I believe the problem is that at marshaling time, the namespace on the ref element does not match, so JAX-WS clients do not receive the intended data (POJO properties incorrectly marshaled as null where the ref elements are located).
I've attached a test case zip, which contains 2 maven projects, wstestserver and wstestclient. To reproduce run "mvn jetty:run" in wstestserver and once jetty is up and running, run "mvn test" in wstestclient. A junit assertion will fail in wstestclient because a child element is null. If you merely switch the dependency in wstestserver pom.xml to
the problem goes away.
Environment
Windows 7, Java 1.6.0_22
Affected Versions
[2.2.6]