axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Veithen <andreas.veit...@gmail.com>
Subject Re: The entity name must immediately follow the '&' in the entity reference
Date Sat, 25 Jul 2009 16:31:10 GMT
Can you explain that in more detail? What do you do exactly with the
result of builder.getDocumentElement()?

Andreas

On Sat, Jul 25, 2009 at 18:15, Sumit Shah<Sumit.Shah@cgifederal.com> wrote:
> I forgot to add that this is on the SOAP response. After we create the
> envelope we just hand it over to our message receiver that just relays it to
> Axis2 processing as seen in the stack trace.
>
>
>
> Sumit
>
>
>
> ________________________________
>
> From: Sumit Shah [mailto:Sumit.Shah@cgifederal.com]
> Sent: Saturday, July 25, 2009 12:04 PM
>
> To: axis-dev@ws.apache.org
> Subject: RE: The entity name must immediately follow the '&' in the entity
> reference
>
>
>
> We basically construct a JAVA object from this response and then do some
> processing and then serialize it using the following code:
>
>
>
> JAXBContext jaxbContext = ContextFactory.createContext(new Class<?>[]
> {response.getClass()}, properties);
>
>             Marshaller m = jaxbContext.createMarshaller();
>
>             m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
>
>             m.setProperty("com.sun.xml.bind.namespacePrefixMapper", new
> NamespacePrefixMapper());
>
>
>
>             ByteArrayOutputStream os = new ByteArrayOutputStream();
>
>             XMLStreamWriterWithOS writer = new XMLStreamWriterWithOS(os,
> "utf-8");
>
>             writer.setNamespaceContext(new NamespaceContext());
>
>             m.marshal(response, writer);
>
>
>
>             ByteArrayInputStream bais = new
> ByteArrayInputStream(os.toByteArray());
>
>             XMLStreamReader reader = StAXUtils.createXMLStreamReader(bais,
> "utf-8");
>
>             StAXOMBuilder builder = new StAXOMBuilder(reader);
>
>
>
>             return builder.getDocumentElement();
>
>
>
> We then just set the ‘builder.getDocumentElement()’ as the envelope’s body
> using : envelope.getBody().addChild(bodyContent); where bodyContent is the
> returned ‘builder.getDocumentElement()’.
>
>
>
> Is there something wrong in the way are serializing it?
>
>
>
> Sumit
>
>
>
> -----Original Message-----
> From: Sumit Shah [mailto:Sumit.Shah@cgifederal.com]
> Sent: Saturday, July 25, 2009 11:58 AM
> To: axis-dev@ws.apache.org
> Subject: RE: The entity name must immediately follow the '&' in the entity
> reference
>
>
>
> I get it as an XML response from another integrating system. The response
> from that system looks something like this:
>
>
>
> <select editMode="Select" withChildren="TRUE">
>
>   <identity class="AcctgStripTemplate">
>
>     <aspect name="uniqueIdentity"><![CDATA[&amp;1280&amp;CP_1]]></aspect>
>
>   </identity>
>
> </select>
>
>
>
> Do you know what might be causing this failure?
>
>
>
>
>
> Thanks
>
> Sumit
>
>
>
> -----Original Message-----
>
> From: Andreas Veithen [mailto:andreas.veithen@gmail.com]
>
> Sent: Saturday, July 25, 2009 11:53 AM
>
> To: axis-dev@ws.apache.org
>
> Subject: Re: The entity name must immediately follow the '&' in the entity
> reference
>
>
>
> How do you build the uniqueIdentity element?
>
>
>
> Andreas
>
>
>
> On Sat, Jul 25, 2009 at 17:48, Sumit Shah<Sumit.Shah@cgifederal.com> wrote:
>
>> Hi Andreas,
>
>>
>
>>
>
>>
>
>> Thanks for your response. Below is the complete stack trace. It's a very
>
>> strange behavior. The SOAP message has the correctly escaped entities.
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>> <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope
>
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header
>
>>
>> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"></SOAP-ENV:Header><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server</faultcode><faultstring>ParseError
>
>> at [row,col]:[1,3137]
>
>>
>
>> Message: The entity name must immediately follow the '&amp;' in the entity
>
>> reference.</faultstring><detail><Exception>org.apache.axis2.AxisFault:
>
>> ParseError at [row,col]:[1,3137]
>
>>
>
>> Message: The entity name must immediately follow the '&amp;' in the entity
>
>> reference.
>
>>
>
>>                 at
>> org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
>
>>
>
>>                 at
>
>>
>> org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:83)
>
>>
>
>>                 at
>
>>
>> org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream(CommonsHTTPTransportSender.java:330)
>
>>
>
>>                 at
>
>>
>> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:213)
>
>>
>
>>                 at
>
>> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)
>
>>
>
>>                 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:227)
>
>>
>
>>                 at
>
>>
>> weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
>
>>
>
>>                 at
>
>>
>> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
>
>>
>
>>                 at
>
>> weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
>
>>
>
>>                 at
>
>>
>> weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
>
>>
>
>>                 at
>
>>
>> com.ams.core.webservices.filters.AuthenticationFilter.doFilter(AuthenticationFilter.java:111)
>
>>
>
>>                 at
>
>>
>> weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
>
>>
>
>>                 at
>
>>
>> com.ams.core.ui.filters.ClientIPAddressFilter.doFilter(ClientIPAddressFilter.java:80)
>
>>
>
>>                 at
>
>>
>> weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
>
>>
>
>>                 at
>
>>
>> weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
>
>>
>
>>                 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:2180)
>
>>
>
>>                 at
>
>>
>> weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
>
>>
>
>>                 at
>
>>
>> weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
>
>>
>
>>                 at
>
>> weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
>
>>
>
>>                 at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
>
>>
>
>> Caused by: com.sun.xml.stream.XMLStreamException2: ParseError at
>
>> [row,col]:[1,3137]
>
>>
>
>> Message: The entity name must immediately follow the '&amp;' in the entity
>
>> reference.
>
>>
>
>>                 at
>
>> com.sun.xml.stream.XMLReaderImpl.next(XMLReaderImpl.java:574)
>
>>
>
>>                 at
>
>> org.apache.axiom.om.impl.llom.OMStAXWrapper.next(OMStAXWrapper.java:981)
>
>>
>
>>                 at
>
>>
>> org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeNode(StreamingOMSerializer.java:100)
>
>>
>
>>                 at
>
>>
>> org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(StreamingOMSerializer.java:68)
>
>>
>
>>                 at
>
>>
>> org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(StreamingOMSerializer.java:57)
>
>>
>
>>                 at
>
>>
>> org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMSerializerUtil.java:548)
>
>>
>
>>                 at
>
>>
>> org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:232)
>
>>
>
>>                 at
>
>>
>> org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:947)
>
>>
>
>>                 at
>
>>
>> org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:471)
>
>>
>
>>                 at
>
>>
>> org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:79)
>
>>
>
>>                 ... 27 more
>
>>
>
>> </Exception></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
>
>>
>
>>
>
>>
>
>> Thanks
>
>>
>
>> Sumit
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>> -----Original Message-----
>
>> From: Andreas Veithen [mailto:andreas.veithen@gmail.com]
>
>> Sent: Saturday, July 25, 2009 11:27 AM
>
>> To: axis-dev@ws.apache.org
>
>> Subject: Re: The entity name must immediately follow the '&' in the entity
>
>> reference
>
>>
>
>>
>
>>
>
>> Can you please check the server logs to get the complete stack trace
>
>>
>
>> (including the root cause of the exception)?
>
>>
>
>>
>
>>
>
>> Andreas
>
>>
>
>>
>
>>
>
>> On Sat, Jul 25, 2009 at 05:52, Sumit Shah<Sumit.Shah@cgifederal.com>
>> wrote:
>
>>
>
>>> Basically this is the stack trace. It seems like the error is thrown by
>
>>> the
>
>>
>
>>> Axis2 SOAPMessageFormatter. I do not know if this is a bug in Axis2 or
>
>>
>
>>> Xerces? I would appreciate if someone could please confirm it and let me
>
>>
>
>>> know if you have any suggestions for a fix.
>
>>
>
>>>
>
>>
>
>>> FYI..This is in Axis2 1.4
>
>>
>
>>>
>
>>
>
>>> Thanks
>
>>
>
>>> Sumit
>
>>
>
>>>
>
>>
>
>>>
>
>>>
>>> <soapenv:Fault><faultcode>soapenv:Server</faultcode><faultstring>ParseError
>
>>
>
>>> at [row,col]:[1,3137]
>
>>
>
>>>
>
>>
>
>>> Message: The entity name must immediately follow the '&amp;' in the
>>> entity
>
>>
>
>>> reference.</faultstring><detail><Exception>org.apache.axis2.AxisFault:
>
>>
>
>>> ParseError at [row,col]:[1,3137]
>
>>
>
>>>
>
>>
>
>>> Message: The entity name must immediately follow the '&amp;' in the
>>> entity
>
>>
>
>>> reference.
>
>>
>
>>>
>
>>
>
>>>                 at
>
>>> org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
>
>>
>
>>>
>
>>
>
>>>                 at
>
>>
>
>>>
>
>>>
>>> org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:83)
>
>>
>
>>>
>
>>
>
>>>                 at
>
>>
>
>>>
>
>>>
>>> org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream(CommonsHTTPTransportSender.java:330)
>
>>
>
>>>
>
>>
>
>>>                 at
>
>>
>
>>>
>
>>>
>>> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:213)
>
>>
>
>>>
>
>>
>
>>>                 at
>
>>
>
>>> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)
>
>>
>
>>>
>
>>
>
>>>                 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)
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> -----Original Message-----
>
>>
>
>>> From: Sumit Shah [mailto:Sumit.Shah@cgifederal.com]
>
>>
>
>>> Sent: Fri 7/24/2009 7:41 PM
>
>>
>
>>> To: axis-dev@ws.apache.org; axis-user@ws.apache.org
>
>>
>
>>> Subject: The entity name must immediately follow the '&' in the entity
>
>>
>
>>> reference
>
>>
>
>>>
>
>>
>
>>> All,
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> My SOAP envelope generated using AXIS2 contains escaped entities but the
>
>>
>
>>> client tools like (SOAP UI, Eclipse, etc.) still fail with the entity
>
>>> error
>
>>
>
>>> message:
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Message: The entity name must immediately follow the '&' in the entity
>
>>
>
>>> reference
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Here is a SOAP response snippet where I have the escaped entities:
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> <ns2:typeOfAgencyTransfer xsi:nil="true"/>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>>
>>> <ns2:uniqueIdentity>&amp;3426&amp;3427&amp;1609&amp;SV&amp;MKH177902&amp;&amp;0&amp;1</ns2:uniqueIdentity>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> <ns2:updateAtHigherLevel>false</ns2:updateAtHigherLevel>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> <ns2:updateExchangeFlag>true</ns2:updateExchangeFlag>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> I have no clue why this should fail. Does it need to be wrapped in CDATA?
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Thanks
>
>>
>
>>>
>
>>
>
>>> Sumit
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>

Mime
View raw message