users@jaxb.java.net

Re: Unmarshal error but XMLSPY says ok

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 06 Dec 2006 15:57:20 -0800

Looking at the error message, JAXB is expecting {}getDocRequest but not
{urn:us:gov:dod:army:cerdec:jbfsa:csds:r1}getDocRequest.

This often happens if somehow package-info.class is not packaged up.
Make sure your binary contains this, or use the -npa option in XJC to
tell XJC not to use package annotations at all.

I also second Kirill that XMLSpy is generally speaking very unreliable
when it comes to validation, but I suspect this particular issue is
unrelated to that.

Frank wrote:
> I have a document that validates just fine in XMLSPY but when I try to
> unmarshal it using JAXB it fails with the following error:
>
> javax.xml.bind.UnmarshalException: unexpected element
> (uri:"urn:us:gov:dod:army:cerdec:jbfsa:csds:r1", local:"getDocRequest").
> Expected elements are
> <{http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod>,<{http://www.w3.org/2000/09/xmldsig#}DSAKeyValue>,<{http://www.w3.org/2000/09/xmldsig#}DigestMethod>,<{http://www.w3.org/2000/09/xmldsig#}DigestValue>,<{http://www.w3.org/2000/09/xmldsig#}KeyInfo>,<{http://www.w3.org/2000/09/xmldsig#}KeyName>,<{http://www.w3.org/2000/09/xmldsig#}KeyValue>,<{http://www.w3.org/2000/09/xmldsig#}Manifest>,<{http://www.w3.org/2000/09/xmldsig#}MgmtData>,<{http://www.w3.org/2000/09/xmldsig#}Object>,<{http://www.w3.org/2000/09/xmldsig#}PGPData>,<{http://www.w3.org/2000/09/xmldsig#}RSAKeyValue>,<{http://www.w3.org/2000/09/xmldsig#}Reference>,<{http://www.w3.org/2000/09/xmldsig#}RetrievalMethod>,<{http://www.w3.org/2000/09/xmldsig#}SPKIData>,<{http://www.w3.org/2000/09/xmldsig#}Signature>,<{http://www.w3.org/2000/09/xmldsig#}SignatureMethod>,<{http://www.w3.org/2000/09/xmldsig#}SignatureProperties>,<{http://www.w3.org/2000/09/xmldsig#}SignatureProperty>,<{http://www.w3.org/2000/09/xmldsig#
}SignatureValue>,<{http://www.w3.org/2000/09/xmldsig#}SignedInfo>,<{http://www.w3.org/2000/09/xmldsig#}Transform>,<{http://www.w3.org/2000/09/xmldsig#}Transforms>,<{http://www.w3.org/2000/09/xmldsig#}X509Data>,<{}exportRegradeFault>,<{}exportRegradeRequest>,<{}exportRegradeResponse>,<{}forwardFault>,<{}forwardRequest>,<{}forwardResponse>,<{}getDocFault>,<{}getDocRequest>,<{}getDocResponse>,<{}getLabelsFault>,<{}getLabelsRequest>,<{}getLabelsResponse>,<{}notifyFault>,<{}notifyRequest>,<{}notifyResponse>,<{}releaseFault>,<{}releaseRequest>,<{}releaseResponse>
> at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:523)
>
>
>
> The document is as follows:
>
> <?xml version=.0" encoding="UTF-8"?>
> <jbfsa:getDocRequest xmlns:ds=ttp://www.w3.org/2000/09/xmldsig#"
> xmlns:ism=rn:us:gov:ic:ism:v2"
> xmlns:jbfsa=rn:us:gov:dod:army:cerdec:jbfsa:csds:r1"
> xmlns:xsi=ttp://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation=rn:us:gov:dod:army:cerdec:jbfsa:csds:r1
> C:\data\JBFSA\r1\csds_src\config\csds_msgs.xsd">
> <jbfsa:Time >2006-12-17T09:30:47.0Z</jbfsa:Time>
> <jbfsa:Item >
> <jbfsa:ReleaseAuth
> nonce=jBsR09EbGhjZ0dTQUxNQUFBUUNBRU1tQ1p0dU1GUXhEUzhi" >
> <jbfsa:AuthorityID >dbs</jbfsa:AuthorityID>
> <jbfsa:RecipientID >mesh_high</jbfsa:RecipientID>
> <jbfsa:DocRef alg=HA-256"
> >UjBsR09EbGhjZ0dTQUxNQUFBUUNBRU1tQ1p0dU1GUXhEUzhi</jbfsa:DocRef>
> <jbfsa:Time >2006-10-25T09:30:47.0Z</jbfsa:Time>
> <ds:Signature ><ds:SignedInfo ><ds:CanonicalizationMethod
> Algorithm=ttp://www.w3.org/2001/10/xml-exc-c14n#WithComments"
> /><ds:SignatureMethod
> Algorithm=ttp://www.w3.org/2000/09/xmldsig#dsa-sha1" /><ds:Reference
> ><ds:Transforms ><ds:Transform
> Algorithm=ttp://www.w3.org/2000/09/xmldsig#enveloped-signature"
> /><ds:Transform Algorithm=ttp://www.w3.org/2002/06/xmldsig-filter2"
> ><ds:XPath Filter=ntersect"
> xmlns:ds=ttp://www.w3.org/2002/06/xmldsig-filter2">jbfsa:ReleaseAuth</ds:XPath></ds:Transform></ds:Transforms><ds:DigestMethod
> Algorithm=ttp://www.w3.org/2000/09/xmldsig#sha1" /><ds:DigestValue
> >2jmj7l5rSw0yVb/vlWAYkK/YBwk=ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue >fHZkk1yEkHj1d+PKlgDtvx6QLexSaiY6u+UPisHyR3/w5xnfrI2H8Q==</ds:SignatureValue><ds:KeyInfo ><ds:KeyName >dbs</ds:KeyName></ds:KeyInfo></ds:Signature></jbfsa:ReleaseAuth>
> </jbfsa:Item>
> </jbfsa:getDocRequest>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
> .
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com