I just tried with Jboss 5.1.0.GA as well and I still see the same issue. Any
thoughts or recommendations would be greatly appreciated.
jp4 wrote:
>
> I am seeing a similar behavior where the xsi:type causes the
> UndeclaredPrefix error. Initially I was running CXF 2.2 with JDK 1.5 on
> Jboss 4.2.3.GA. I have since upgraded to Java 6. I send a sample request
> through SOAPUI and I still see the same error below... If I attempt to
> validate the same file from within the container using a servlet and the
> code below, it validates just fine. Any idea what could be causing the
> discrepancy? Also, it's important to note that if I turn off validation
> (as suggested in a previous post) it works fine.
>
> Source source = new
> StreamSource(getClass().getResourceAsStream("/request.xml"));
> source = toDOMSource(source);
> validator.validate(source);
>
> - with linked exception:
> [org.xml.sax.SAXParseException: UndeclaredPrefix: Cannot resolve
> 'ns3:PayPalFundingSourceType' as a QName: the prefix 'ns3' is not
> declared.]
> at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:425)
> at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:362)
> at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:339)
> at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:607)
> ... 57 more
> Caused by: org.xml.sax.SAXParseException: UndeclaredPrefix: Cannot resolve
> 'ns3:PayPalFundingSourceType' as a QName: the prefix 'ns3' is not
> declared.
> at
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
> Source)
> at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> at
> org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown
> Source)
> at
> org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown
> Source)
> at
> org.apache.xerces.impl.xs.XMLSchemaValidator.getAndCheckXsiType(Unknown
> Source)
> at
> org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
> Source)
> at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown
> Source)
> at
> org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.startElement(Unknown
> Source)
> at
> com.sun.xml.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.startElement(ValidatingUnmarshaller.java:89)
> at
> com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:275)
> at
> com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:209)
> at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
>
>
> dkulp wrote:
>>
>>
>> Did some snooping... The RI seems to have the same problem:
>> http://forums.java.net/jive//message.jspa?messageID=268876
>>
>> And they mention its a bug in the JDK:
>> https://jaxp.dev.java.net/issues/show_bug.cgi?id=46
>>
>> The workaround seems to be to use the latest 1.6 JDK or get the latest
>> sun jaxp parser
>> (http://download.java.net/maven/1/com.sun.xml.parsers/jars/
>> ) and throw it in your endorsed dir.
>>
>> Dan
>>
>>
>>
>> On Jun 18, 2008, at 2:16 PM, [email protected] wrote:
>>
>>> Hi,
>>>
>>> looks like the same problem i have. But my response is invalid also
>>> according to soapUI validation.
>>>
>>> I'm not using any additional interceptors, only default cxfServlet,
>>> default bus config etc, without security, attachments etc. and I'm
>>> using
>>> jaxWS+jaxB
>>>
>>> This is response, which is problem in my case (cxf is client in this
>>> case)
>>>
>>> <soapenv:Envelope
>>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>> <soapenv:Body>
>>> <locationSearchReply
>>> xmlns="http://www.deltavista.at/schema/locationsearch">
>>> <foundLocation>
>>> <street>Stephansplatz</street>
>>> <houseNumber>1</houseNumber>
>>> <city>Wien</city>
>>> <zip xsi:type="xsd:string">1010</zip>
>>> <country xsi:type="xsd:string">AUT</country>
>>> <locationMatch>4</locationMatch>
>>> <similarity>92</similarity>
>>> <confidence>98</confidence>
>>> </foundLocation>
>>> </locationSearchReply>
>>> </soapenv:Body>
>>> </soapenv:Envelope>
>>>
>>> i have a problem with xsd:string inside reply.
>>>
>>> pieces of xsd:
>>> <element name="zip"
>>> type="locationsearch:Zip" minOccurs="1"/>
>>> <simpleType name="Zip">
>>> <restriction base="string">
>>> <minLength value="4"/>
>>> <maxLength value="7"/>
>>> </restriction>
>>> </simpleType>
>>>
>>> when i turn off validation, everything works
>>>
>>> best regards
>>> jano
>>>
>>>
>>>
>>>
>>> Daniel Kulp <[email protected]>
>>> 06/18/2008 20:05
>>> Bitte antworten an
>>> [email protected]
>>>
>>>
>>> An
>>> [email protected]
>>> Kopie
>>>
>>> Thema
>>> Re: Unmarshalling Error: UndeclaredPrefix: Cannot resolve 'ns0:Xxx'
>>> as a
>>> QName: the prefix 'ns0' is not declared [Virus checked]
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Very strange. The message is definitely valid.
>>>
>>> Could questions:
>>> 1) Do you have any SAAJ type handlers/interceptors on the chain (jaxws
>>> SOAPHandler, ws-security things, etc...)?
>>>
>>> 2) I noticed you have a xerces jar... can you try removing that and
>>> seeing if the JDK built-in parser will work? Also, check if you have
>>> a xalan jar installed and remove that as well.
>>>
>>> 3) Can you turn off validation. It looks like it's the validator
>>> having an issue, not the unmarshaller. If it unmarshalls OK that
>>> way, we at least know the parser is giving it the correct data. If
>>> that still fails, we'll need to dig in more.
>>>
>>> Dan
>>>
>>>
>>>
>>> On Jun 17, 2008, at 12:33 PM, Urciolo, Kevin wrote:
>>>
>>>> I am running in to an issue when a Java 5 client using JWSDP is
>>>> sending
>>>> a request to my CXF (2.1.1 SNAPSHOT) service. I get an exception,
>>>> Unmarshalling Error: UndeclaredPrefix: Cannot resolve 'ns0:Xxx' as a
>>>> QName: the prefix 'ns0' is not declared, as shown below. The type
>>>> is an
>>>> extension from a base type. I am assuming this is why "xsi:type" is
>>>> generated by the client since it is not used in other places.
>>>>
>>>> Is there a reason why CXF is having trouble with this?
>>>>
>>>> Type From Schema:
>>>>
>>>> <xs:complexType name="Xxx">
>>>> <xs:complexContent>
>>>> <xs:extension base="tns:Base">
>>>> <xs:sequence>
>>>> <xs:element
>>>> minOccurs="1"
>>>>
>>>> name="a"
>>>> nillable="false" type="xs:boolean" />
>>>> <xs:element
>>>> minOccurs="1"
>>>>
>>>> name="b"
>>>> nillable="false" type="xs:boolean" />
>>>> </xs:sequence>
>>>> </xs:extension>
>>>> </xs:complexContent>
>>>> </xs:complexType>
>>>>
>>>> ------------------------------------------------------------------------
>>>> ------------------------------------------------------------------------
>>>> -----
>>>>
>>>> XML Generated:
>>>>
>>>> <?xml version="1.0"?>
>>>> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
>>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
>>>> xmlns:ns0="http://mdc.com">
>>>> <env:Body>
>>>> <ns0:createXxxRequest>
>>>> <ns0:xxx xsi:type="ns0:Xxx">
>>>> <ns0:name>xxx</ns0:name>
>>>> </ns0:xxx>
>>>> </ns0:createXxxRequest>
>>>> </env:Body>
>>>> </env:Envelope>
>>>>
>>>> ------------------------------------------------------------------------
>>>> ------------------------------------------------------------------------
>>>> -----
>>>>
>>>> Exception In Log:
>>>>
>>>> INFO: Interceptor has thrown exception, unwinding now
>>>> org.apache.cxf.interceptor.Fault: Unmarshalling Error:
>>>> UndeclaredPrefix:
>>>> Cannot resolve 'ns0:Xxx' as a QName: the prefix 'ns0' is not
>>>> declared.
>>>> at
>>>> org
>>>> .apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.jav
>>>> a:643)
>>>> at
>>>> org
>>>> .apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.jav
>>>> a:555)
>>>> at
>>>> org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:64)
>>>> at
>>>> org
>>>> .apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLite
>>>> ralInInterceptor.java:183)
>>>> at
>>>> org
>>>> .apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
>>>> hain.java:221)
>>>> at
>>>> org
>>>> .apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiati
>>>> onObserver.java:78)
>>>> at
>>>> org
>>>> .apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestin
>>>> ation.java:92)
>>>> at
>>>> org
>>>> .apache.cxf.transport.servlet.ServletController.invokeDestination(Ser
>>>> vletController.java:279)
>>>> at
>>>> org
>>>> .apache.cxf.transport.servlet.ServletController.invoke(ServletControl
>>>> ler.java:161)
>>>> at
>>>> org
>>>> .apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFSe
>>>> rvlet.java:174)
>>>> at
>>>> org
>>>> .apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFSe
>>>> rvlet.java:152)
>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>>>> at
>>>> org
>>>> .apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
>>>> tionFilterChain.java:252)
>>>> at
>>>> org
>>>> .apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
>>>> erChain.java:173)
>>>> at
>>>> org
>>>> .jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilte
>>>> r.java:96)
>>>> at
>>>> org
>>>> .apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
>>>> tionFilterChain.java:202)
>>>> at
>>>> org
>>>> .apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
>>>> erChain.java:173)
>>>> at
>>>> org
>>>> .apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
>>>> e.java:213)
>>>> at
>>>> org
>>>> .apache.catalina.core.StandardContextValve.invoke(StandardContextValv
>>>> e.java:178)
>>>> at
>>>> org
>>>> .jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAs
>>>> sociationValve.java:175)
>>>> at
>>>> org
>>>> .jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.j
>>>> ava:74)
>>>> at
>>>> org
>>>> .apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
>>>> :126)
>>>> at
>>>> org
>>>> .apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
>>>> :105)
>>>> at
>>>> org
>>>> .jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnecti
>>>> onValve.java:156)
>>>> at
>>>> org
>>>> .apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
>>>> java:107)
>>>> at
>>>> org
>>>> .apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1
>>>> 48)
>>>> at
>>>> org
>>>> .apache.coyote.http11.Http11Processor.process(Http11Processor.java:86
>>>> 9)
>>>> at
>>>> org.apache.coyote.http11.Http11BaseProtocol
>>>> $Http11ConnectionHandler.proc
>>>> essConnection(Http11BaseProtocol.java:664)
>>>> at
>>>> org
>>>> .apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint
>>>> .java:527)
>>>> at
>>>> org
>>>> .apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorker
>>>> Thread.java:112)
>>>> at java.lang.Thread.run(Thread.java:619)
>>>> Caused by: javax.xml.bind.UnmarshalException
>>>> - with linked exception:
>>>> [org.xml.sax.SAXParseException: UndeclaredPrefix: Cannot resolve
>>>> 'ns0:Xxx' as a QName: the prefix 'ns0' is not declared.]
>>>> at
>>>> com
>>>> .sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamEx
>>>> ception(UnmarshallerImpl.java:396)
>>>> at
>>>> com
>>>> .sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Unm
>>>> arshallerImpl.java:335)
>>>> at
>>>> com
>>>> .sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unma
>>>> rshallerImpl.java:312)
>>>> at
>>>> org
>>>> .apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.jav
>>>> a:628)
>>>> ... 31 more
>>>> Caused by: org.xml.sax.SAXParseException: UndeclaredPrefix: Cannot
>>>> resolve 'ns0:Xxx' as a QName: the prefix 'ns0' is not declared.
>>>> at
>>>> org
>>>> .apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unkno
>>>> wn Source)
>>>> at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown
>>>> Source)
>>>> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
>>>> Source)
>>>> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
>>>> Source)
>>>> at
>>>> org.apache.xerces.impl.xs.XMLSchemaValidator
>>>> $XSIErrorReporter.reportErro
>>>> r(Unknown Source)
>>>> at
>>>> org
>>>> .apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown
>>>> Source)
>>>> at
>>>> org
>>>> .apache.xerces.impl.xs.XMLSchemaValidator.getAndCheckXsiType(Unknown
>>>> Source)
>>>> at
>>>> org
>>>> .apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
>>>> Source)
>>>> at
>>>> org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown
>>>> Source)
>>>> at
>>>> org
>>>> .apache.xerces.jaxp.validation.ValidatorHandlerImpl.startElement(Unkn
>>>> own Source)
>>>> at
>>>> com
>>>> .sun.xml.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.startEle
>>>> ment(ValidatingUnmarshaller.java:73)
>>>> at
>>>> com
>>>> .sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStart
>>>> Element(StAXStreamConnector.java:238)
>>>> at
>>>> com
>>>> .sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAX
>>>> StreamConnector.java:172)
>>>> at
>>>> com
>>>> .sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Unm
>>>> arshallerImpl.java:333)
>>>> ... 33 more
>>>
>>> ---
>>> Daniel Kulp
>>> [email protected]
>>> http://www.dankulp.com/blog
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>> ---
>> Daniel Kulp
>> [email protected]
>> http://www.dankulp.com/blog
>>
>>
>>
>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/Unmarshalling-Error%3A-UndeclaredPrefix%3A-Cannot-resolve-%27ns0%3AXxx%27-as-a-QName%3A-the-prefix-%27ns0%27-is-not-declared-tp17918441p24414577.html
Sent from the cxf-user mailing list archive at Nabble.com.