OK, I've sanitized the urls and stuff so it won't disclose the project
I'm working on.
The only thing different that I can think of might be classpaths and
classloaders. Thanks in advance for any help you can provide...
Here's a JUnit test that passes when it runs stand-alone:
@Test
public void unmarshallStateXml() throws Exception {
String data = <... the XML I'm processing - see it posted
below ...>
ByteArrayInputStream source = new
ByteArrayInputStream(data.getBytes());
source.reset();
JAXBContext jc =
JAXBContext.newInstance("com.radsoft.client.wsclasses");
Unmarshaller u = jc.createUnmarshaller();
Object obj = u.unmarshal(source);
assertTrue(obj.toString().startsWith("ArrayOfSetting"));
}
I put the exact same code above running into a Play controller
method. When I hit the Controller action from a web browser, I get
this exception:
Java exception
RuntimeException occured : javax.xml.bind.UnmarshalException:
unexpected element (uri:"
http://xml.radsoft.com/services",
local:"ArrayOfSetting"). Expected elements are <{http://
schemas.datacontract.org/2004/07/BusinessObjects.Common}
AccountStatus>,<{
http://schemas.datacontract.org/2004/07/
BusinessObjects.Common}AccountType>,<{}Address>,<{http://
xml.radsoft.com/services}Address>,<{
http://schemas.datacontract.org/
2004/07/BusinessObjects.Common}AddressType>,<{}
AddressValidation>,<{
http://xml.radsoft.com/services}
AddressValidation>,<{}ArrayOfAddress>,<{
http://xml.radsoft.com/
services}ArrayOfAddress>,<{}ArrayOfProductCategory>,<{http://
xml.radsoft.com/services}ArrayOfProductCategory>,<{}
ArrayOfProductContributor>,<{
http://xml.radsoft.com/services}
ArrayOfProductContributor>,<{}ArrayOfProductReview>,<{http://
xml.radsoft.com/services}ArrayOfProductReview>,<{}
ArrayOfProductRightsTerritory>,<{
http://xml.radsoft.com/services}
ArrayOfProductRightsTerritory>,<{}ArrayOfProductSubmission>,<{http://
xml.radsoft.com/services}ArrayOfProductSubmission>,<{}
ArrayOfSetting>,<{
http://schemas.datacontract.org/2004/07/
BusinessObjects.SettingsDataMgr}ArrayOfSetting>,<{}Contact>,<{http://
xml.radsoft.com/services}Contact>,<{
http://xml.radsoft.com/services}
FileConversionStatus>,<{}FileConvertData>,<{
http://xml.radsoft.com/
services}FileConvertData>,<{}FinancialInfo>,<{
http://xml.radsoft.com/
services}FinancialInfo>,<{
http://schemas.datacontract.org/2004/07/
BusinessObjects.Common}GovtIdType>,<{
http://xml.radsoft.com/services}
ImageConversionStatus>,<{}Invite>,<{
http://xml.radsoft.com/services}
Invite>,<{}ProductCategory>,<{
http://xml.radsoft.com/services}
ProductCategory>,<{}ProductContributor>,<{
http://xml.radsoft.com/
services}ProductContributor>,<{}ProductReview>,<{http://
xml.radsoft.com/services}ProductReview>,<{}
ProductRightsTerritory>,<{
http://xml.radsoft.com/services}
ProductRightsTerritory>,<{}ProductSubmission>,<{
http://xml.radsoft.com/
services}ProductSubmission>,<{}PubAgreement>,<{
http://xml.radsoft.com/
services}PubAgreement>,<{}PubItResponse>,<{
http://xml.radsoft.com/
services}PubItResponse>,<{}Publisher>,<{
http://xml.radsoft.com/
services}Publisher>,<{}Setting>,<{
http://schemas.datacontract.org/
2004/07/BusinessObjects.SettingsDataMgr}Setting>,<{}
StringData>,<{
http://xml.radsoft.com/services}StringData>,<{http://
xml.radsoft.com/services}SubmissionStatus>
Finally, here's the XML I'm processing
<?xml version="1.0"?>
<ArrayOfSetting xmlns="
http://xml.radsoft.com/services"
xmlns:i="
http://www.w3.org/2001/XMLSchema-instance">
<Setting>
<SettingId>AL</SettingId>
<SettingValue>Alabama</SettingValue>
</Setting>
<Setting>
<SettingId>AK</SettingId>
<SettingValue>Alaska</SettingValue>
</Setting>
<Setting>
<SettingId>AS</SettingId>
<SettingValue>American Samoa</SettingValue>
</Setting>
<Setting>
<SettingId>WI</SettingId>
<SettingValue>Wisconsin</SettingValue>
</Setting>
<Setting>
<SettingId>WY</SettingId>
<SettingValue>Wyoming</SettingValue>
</Setting>
</ArrayOfSetting>