never mind, i upgraded my version of woodstox and its all good Willie Slepecki wrote: > first off, i have a very complex schema. ive implemented the validation > handler to validate xml documents coming in. that works perfectly. the > problem is the way Jibx handles null values that are required is giving > me and my developers heart burn. it returns null exception, we can see > what class the null exception happens in the log file, but it doesn't > say what field is null. so my solution was in my binder file set all > the fields to optional and add outgoing schema validation to my > validation handler. reason for that is hopefully it will generate a > soap fault and tell us exactly what field is wrong just like it does on > incoming requests. > > here's my problem. my schema has over 33 namespaces in it. the way the > binder.xml had to be set up to handle so many namespaces, i had to > declare them all at the top of the file then use the NS attribute to > indicate what namespace a specific element was. the drawback is that > when jibx generates an xml response, it includes all 33 namespaces in > the return when it only needs to return at most four of them (maybe > feature for next version?) > > that brings me to the error im getting on outbound xml validation. i > have everything configured correctly and i get this exception > > 2008-11-06 19:10:09,953 [ACTIVE] ExecuteThread: '1' for queue: > 'weblogic.kernel.Default (self-tuning)' ERROR > org.apache.axis2.transport.http.AxisServlet - 32 > java.lang.ArrayIndexOutOfBoundsException: 32 > at com.ctc.wstx.util.BijectiveNsMap.addMapping(BijectiveNsMap.java:247) > at > com.ctc.wstx.sw.SimpleOutputElement.addPrefix(SimpleOutputElement.java:359) > at > com.ctc.wstx.sw.SimpleNsStreamWriter.doSetPrefix(SimpleNsStreamWriter.java:163) > at > com.ctc.wstx.sw.BaseNsStreamWriter.setPrefix(BaseNsStreamWriter.java:183) > at > org.apache.axiom.om.impl.MTOMXMLStreamWriter.setPrefix(MTOMXMLStreamWriter.java:249) > at > org.apache.axiom.om.impl.util.OMSerializerUtil.generateSetPrefix(OMSerializerUtil.java:636) > at > org.apache.axiom.om.impl.util.OMSerializerUtil.serializeStartpart(OMSerializerUtil.java:296) > at > org.apache.axiom.om.impl.util.OMSerializerUtil.serializeStartpart(OMSerializerUtil.java:197) > at > org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:901) > at > org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:641) > at > org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:889) > at > org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:623) > at > org.apache.axiom.om.impl.llom.OMNodeImpl.serialize(OMNodeImpl.java:450) > at > org.apache.axiom.om.impl.llom.OMSourcedElementImpl.serialize(OMSourcedElementImpl.java:699) > at > org.apache.axiom.om.impl.llom.OMSourcedElementImpl.serialize(OMSourcedElementImpl.java:681) > at > com.sosnoski.axis2.handler.ValidateHandler.invoke(ValidateHandler.java:169) > at org.apache.axis2.engine.Phase.invoke(Phase.java:317) > at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:264) > at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:429) > at > org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:43) > at > org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100) > at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176) > at > org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275) > at > org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:131) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) > at > weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226) > at > weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124) > at > weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283) > at > weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175) > at > weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3370) > at > weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) > at weblogic.security.service.SecurityManager.runAs(Unknown Source) > at > weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2117) > at > weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2023) > at > weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1359) > at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200) > at weblogic.work.ExecuteThread.run(ExecuteThread.java:172) > > here is an example of the xml document that jibx generates that im > trying to validate against > > <?xml version="1.0" encoding="UTF-8"?> > <tccioresp:Response > xmlns:tccioresp="ns1" > xmlns:com="ns2" > xmlns:gcpreq="ns3" > xmlns:gcpresp="ms4" > xmlns:gcvreq="ns5" > xmlns:gcvresp="ns6" > xmlns:giareq="ns7" > xmlns:giaresp="ns8" > xmlns:grreq="ns9" > xmlns:grresp="ns10" > xmlns:gtdreq="ns11" > xmlns:gtdresp="ns12" > xmlns:tavreq="ns13" > xmlns:tavresp="ns14" > xmlns:tccioreq="ns15" > xmlns:tdrreq="ns16" > xmlns:tdrresp="ns17" > xmlns:tereq="ns18" > xmlns:teresp="ns19" > xmlns:titreq="ns20" > xmlns:titresp="ns21" > xmlns:tmmrreq="ns22" > xmlns:tmmrresp="ns23" > xmlns:tprreq="ns24" > xmlns:tprresp="ns25" > xmlns:tstreq="ns26" > xmlns:tstresp="ns27" > xmlns:tvrreq="ns28" > xmlns:tvrresp="ns29" > xmlns:tvtreq="ns30" > xmlns:tvtresp="ns31" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <Response> > <com:TxnRetCode>1</com:TxnRetCode> > <com:TxnSubRetCode>1017</com:TxnSubRetCode> > <com:TxnErrorText>The card number provided is > invalid</com:TxnErrorText> > </Response> > <TranID>0</TranID> > <TranStatus>REJCTD</TranStatus> > <CardNumber>0</CardNumber> > </tccioresp:Response> > > remember, of all those namespaces declared, only 4 of them are actually > needed. the rest are only there for show i guess. > > now here is the line of code that its excepting on > > ByteArrayOutputStream baos = new ByteArrayOutputStream(); > content.build(); > content.serialize(baos); > byte[] bytes = baos.toByteArray(); > > its the content.serialize(baos); line that the exception is occuring on. > > now the REALLY weird thing is i have written into my junits a validation > routine that validates the response from the web service and it works > just fine with all those namespaces. > > import javax.xml.transform.stream.StreamSource; > import javax.xml.validation.Schema; > import javax.xml.validation.SchemaFactory; > import javax.xml.validation.Validator; > > import org.w3c.dom.ls.LSResourceResolver; > import org.xml.sax.SAXException; > import org.xml.sax.SAXParseException; > import org.xml.sax.helpers.DefaultHandler; > > those are the imports for my junit validator > > import org.xml.sax.ErrorHandler; > import org.xml.sax.InputSource; > import org.xml.sax.SAXException; > import org.xml.sax.SAXParseException; > import javax.xml.XMLConstants; > import javax.xml.stream.XMLStreamException; > import javax.xml.transform.sax.SAXSource; > import javax.xml.validation.Schema; > import javax.xml.validation.SchemaFactory; > import javax.xml.validation.Validator; > > those are the imports from my handler. i build the one for the junits > based on the code for the handler so they are virutally identical. the > only major difference is that the handler starts with a context object > and the junits start with a string. why would one work and the other not? > > if you could tell me whats going on here it would help me out a lot. > > thanks > willie > > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > >
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users