You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Andreas Veithen <an...@gmail.com> on 2009/07/25 17:27:27 UTC

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<Su...@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
>
>
>
>
>
>
>

Re: The entity name must immediately follow the '&' in the entity reference

Posted by Andreas Veithen <an...@gmail.com>.
There is clearly something wrong with the serialization of the JAXB
object to XML. Can you check the content that is written to the
ByteArrayOutputStream?

Andreas

On Sat, Jul 25, 2009 at 18:04, Sumit Shah<Su...@cgifederal.com> wrote:
> 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<Su...@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<Su...@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
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>

RE: The entity name must immediately follow the '&' in the entity reference

Posted by Sumit Shah <Su...@cgifederal.com>.
Also, looking at the stack trace do you think its trying to escape the '&' in the '&amp;' again?

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)


Thanks
Sumit 

-----Original Message-----
From: Sumit Shah [mailto:Sumit.Shah@cgifederal.com] 
Sent: Saturday, July 25, 2009 4:31 PM
To: axis-dev@ws.apache.org
Subject: RE: The entity name must immediately follow the '&' in the entity reference

Hi Andreas,

The SOAP Message I sent you earlier is the same message that gets to the SOAPMessageFormatter. I would appreciate if you could take a look at it and let me know if you think there is some issue with the message itself.  I am guessing that the message is somehow getting altered between the SOAPMessageFormatter and the org.apache.axiom.om.impl.llom.OMStAXWrapper.next() call.

I don't know why it's complaining when the SOAP message looks correct when it gets to the SOAPMessageFormatter.

Thanks
Sumit

-----Original Message-----
From: Andreas Veithen [mailto:andreas.veithen@gmail.com] 
Sent: Saturday, July 25, 2009 3:40 PM
To: axis-dev@ws.apache.org
Subject: Re: The entity name must immediately follow the '&' in the entity reference

The exception that you get indicates that Axiom is doing deferred
parsing. This means that even if the exception is thrown inside
SOAPMessageFormatter, it is not a problem inside Axis2 or Axiom, but
most probably in the layer that you have built on top of it. You will
have to debug that code to determine where the character entities are
lost.

Andreas

On Sat, Jul 25, 2009 at 18:58, Sumit Shah<Su...@cgifederal.com> wrote:
>
>
> For brevity:
>
>
>
> We have our own JAXBMessageReceiver that extends the
> org.apache.axis2.rpc.receivers.RPCMessageReceiver. In the
> invokeBusinessLogic() method we invoke the integrating system that sends us
> an XML response that gets converted into a JAVA object for further
> processing. Once the processing is complete we serialize the JAVA object
> using the Code snippet I sent earlier.
>
>
>
> Then the result of the builder.getDocumentElement() gets set on the envelope
>
> where:
>
>
>
> bodyContent = builder.getDocumentElement();
>
>
>
> envelope.getBody().addChild(bodyContent);
>
>
>
> After that we set the envelope on the outMessage in the JAXBMessageReceiver.
>
>
>
> outMessage.setEnvelope(envelope);
>
>
>
> Then I think it would just follow Axis2 message processing.
>
>
>
> Thanks
>
> Sumit
>
>
>
>
>
> Here is the code snippet for that message receiver:
>
>
>
> public class JAXBMessageReceiver extends RPCMessageReceiver {
>
>     private static Log log = LogFactory.getLog(JAXBMessageReceiver.class);
>
>
>
>
>
>     public void invokeBusinessLogic(MessageContext inMessage, MessageContext
> outMessage) throws AxisFault {
>
>         Method method = null;
>
>
>
>         try {
>
>             // get the implementation class for the Web Service
>
>             Object obj = getTheImplementationObject(inMessage);
>
>
>
>             Class ImplClass = obj.getClass();
>
>
>
>             AxisOperation op =
> inMessage.getOperationContext().getAxisOperation();
>
>             method = (Method)(op.getParameterValue("myMethod"));
>
>
>
>             AxisService service = inMessage.getAxisService();
>
>             OMElement methodElement =
> inMessage.getEnvelope().getBody().getFirstElement();
>
>             AxisMessage inAxisMessage =
> op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
>
>             String messageNameSpace = null;
>
>
>
>             if (method == null) {
>
>                 String methodName = op.getName().getLocalPart();
>
>                 Method[] methods = ImplClass.getMethods();
>
>
>
>                 for (int i = 0; i < methods.length; i++) {
>
>                     if (methods[i].getName().equals(methodName)) {
>
>                         method = methods[i];
>
>                         op.addParameter("myMethod", method);
>
>
>
>                         break;
>
>                     }
>
>                 }
>
>
>
>                 if (method == null) {
>
>                     throw new AxisFault("No such method '" + methodName + "'
> in class " + ImplClass.getName());
>
>                 }
>
>             }
>
>
>
>             Object resObject = null;
>
>
>
>             if (inAxisMessage != null) {
>
>                 resObject =
> JAXBMessageUtil.invokeServiceClass(inAxisMessage, method, obj,
> messageNameSpace, methodElement, inMessage);
>
>             }
>
>
>
>             SOAPFactory fac = getSOAPFactory(inMessage);
>
>
>
>             // Handling the response
>
>             AxisMessage outaxisMessage =
> op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
>
>
>
>             if (outaxisMessage != null && outaxisMessage.getElementQName()
> != null) {
>
>                 messageNameSpace =
> outaxisMessage.getElementQName().getNamespaceURI();
>
>             }
>
>             else {
>
>                 messageNameSpace = service.getTargetNamespace();
>
>             }
>
>
>
>             OMNamespace ns = fac.createOMNamespace(messageNameSpace,
> service.getSchemaTargetNamespacePrefix());
>
>             SOAPEnvelope envelope = fac.getDefaultEnvelope();
>
>
> envelope.declareNamespace(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, new
> NamespaceContext().getPrefix(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI));
>
>
>
>             OMElement bodyContent = null;
>
>
>
>             if
> (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(op.getMessageExchangePattern()))
> {
>
>                 OMElement bodyChild =
> fac.createOMElement(outMessage.getAxisMessage().getName(), ns);
>
>                 envelope.getBody().addChild(bodyChild);
>
>                 outMessage.setEnvelope(envelope);
>
>
>
>                 return;
>
>             }
>
>
>
>             Parameter generateBare =
> service.getParameter(Java2WSDLConstants.DOC_LIT_BARE_PARAMETER);
>
>
>
>             if (generateBare != null &&
> "true".equals(generateBare.getValue())) {
>
>                 JAXBMessageUtil.processResonseAsDocLitBare(resObject,
> service, method, envelope, fac, ns, bodyContent, outMessage);
>
>             }
>
>             else {
>
>                 JAXBMessageUtil.processResponseAsDocLitWrapped(resObject,
> service, method, envelope, fac, ns, bodyContent, outMessage);
>
>             }
>
>
>
>             outMessage.setEnvelope(envelope);
>
>         }
>
>
>
>
>
>
>
>
>
>
>
> -----Original Message-----
> From: Andreas Veithen [mailto:andreas.veithen@gmail.com]
> Sent: Saturday, July 25, 2009 12:31 PM
> To: axis-dev@ws.apache.org
> Subject: Re: The entity name must immediately follow the '&' in the entity
> reference
>
>
>
> 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<Su...@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<Su...@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<Su...@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
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>

RE: The entity name must immediately follow the '&' in the entity reference

Posted by Sumit Shah <Su...@cgifederal.com>.
Hi Andreas,

The SOAP Message I sent you earlier is the same message that gets to the SOAPMessageFormatter. I would appreciate if you could take a look at it and let me know if you think there is some issue with the message itself.  I am guessing that the message is somehow getting altered between the SOAPMessageFormatter and the org.apache.axiom.om.impl.llom.OMStAXWrapper.next() call.

I don't know why it's complaining when the SOAP message looks correct when it gets to the SOAPMessageFormatter.

Thanks
Sumit

-----Original Message-----
From: Andreas Veithen [mailto:andreas.veithen@gmail.com] 
Sent: Saturday, July 25, 2009 3:40 PM
To: axis-dev@ws.apache.org
Subject: Re: The entity name must immediately follow the '&' in the entity reference

The exception that you get indicates that Axiom is doing deferred
parsing. This means that even if the exception is thrown inside
SOAPMessageFormatter, it is not a problem inside Axis2 or Axiom, but
most probably in the layer that you have built on top of it. You will
have to debug that code to determine where the character entities are
lost.

Andreas

On Sat, Jul 25, 2009 at 18:58, Sumit Shah<Su...@cgifederal.com> wrote:
>
>
> For brevity:
>
>
>
> We have our own JAXBMessageReceiver that extends the
> org.apache.axis2.rpc.receivers.RPCMessageReceiver. In the
> invokeBusinessLogic() method we invoke the integrating system that sends us
> an XML response that gets converted into a JAVA object for further
> processing. Once the processing is complete we serialize the JAVA object
> using the Code snippet I sent earlier.
>
>
>
> Then the result of the builder.getDocumentElement() gets set on the envelope
>
> where:
>
>
>
> bodyContent = builder.getDocumentElement();
>
>
>
> envelope.getBody().addChild(bodyContent);
>
>
>
> After that we set the envelope on the outMessage in the JAXBMessageReceiver.
>
>
>
> outMessage.setEnvelope(envelope);
>
>
>
> Then I think it would just follow Axis2 message processing.
>
>
>
> Thanks
>
> Sumit
>
>
>
>
>
> Here is the code snippet for that message receiver:
>
>
>
> public class JAXBMessageReceiver extends RPCMessageReceiver {
>
>     private static Log log = LogFactory.getLog(JAXBMessageReceiver.class);
>
>
>
>
>
>     public void invokeBusinessLogic(MessageContext inMessage, MessageContext
> outMessage) throws AxisFault {
>
>         Method method = null;
>
>
>
>         try {
>
>             // get the implementation class for the Web Service
>
>             Object obj = getTheImplementationObject(inMessage);
>
>
>
>             Class ImplClass = obj.getClass();
>
>
>
>             AxisOperation op =
> inMessage.getOperationContext().getAxisOperation();
>
>             method = (Method)(op.getParameterValue("myMethod"));
>
>
>
>             AxisService service = inMessage.getAxisService();
>
>             OMElement methodElement =
> inMessage.getEnvelope().getBody().getFirstElement();
>
>             AxisMessage inAxisMessage =
> op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
>
>             String messageNameSpace = null;
>
>
>
>             if (method == null) {
>
>                 String methodName = op.getName().getLocalPart();
>
>                 Method[] methods = ImplClass.getMethods();
>
>
>
>                 for (int i = 0; i < methods.length; i++) {
>
>                     if (methods[i].getName().equals(methodName)) {
>
>                         method = methods[i];
>
>                         op.addParameter("myMethod", method);
>
>
>
>                         break;
>
>                     }
>
>                 }
>
>
>
>                 if (method == null) {
>
>                     throw new AxisFault("No such method '" + methodName + "'
> in class " + ImplClass.getName());
>
>                 }
>
>             }
>
>
>
>             Object resObject = null;
>
>
>
>             if (inAxisMessage != null) {
>
>                 resObject =
> JAXBMessageUtil.invokeServiceClass(inAxisMessage, method, obj,
> messageNameSpace, methodElement, inMessage);
>
>             }
>
>
>
>             SOAPFactory fac = getSOAPFactory(inMessage);
>
>
>
>             // Handling the response
>
>             AxisMessage outaxisMessage =
> op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
>
>
>
>             if (outaxisMessage != null && outaxisMessage.getElementQName()
> != null) {
>
>                 messageNameSpace =
> outaxisMessage.getElementQName().getNamespaceURI();
>
>             }
>
>             else {
>
>                 messageNameSpace = service.getTargetNamespace();
>
>             }
>
>
>
>             OMNamespace ns = fac.createOMNamespace(messageNameSpace,
> service.getSchemaTargetNamespacePrefix());
>
>             SOAPEnvelope envelope = fac.getDefaultEnvelope();
>
>
> envelope.declareNamespace(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, new
> NamespaceContext().getPrefix(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI));
>
>
>
>             OMElement bodyContent = null;
>
>
>
>             if
> (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(op.getMessageExchangePattern()))
> {
>
>                 OMElement bodyChild =
> fac.createOMElement(outMessage.getAxisMessage().getName(), ns);
>
>                 envelope.getBody().addChild(bodyChild);
>
>                 outMessage.setEnvelope(envelope);
>
>
>
>                 return;
>
>             }
>
>
>
>             Parameter generateBare =
> service.getParameter(Java2WSDLConstants.DOC_LIT_BARE_PARAMETER);
>
>
>
>             if (generateBare != null &&
> "true".equals(generateBare.getValue())) {
>
>                 JAXBMessageUtil.processResonseAsDocLitBare(resObject,
> service, method, envelope, fac, ns, bodyContent, outMessage);
>
>             }
>
>             else {
>
>                 JAXBMessageUtil.processResponseAsDocLitWrapped(resObject,
> service, method, envelope, fac, ns, bodyContent, outMessage);
>
>             }
>
>
>
>             outMessage.setEnvelope(envelope);
>
>         }
>
>
>
>
>
>
>
>
>
>
>
> -----Original Message-----
> From: Andreas Veithen [mailto:andreas.veithen@gmail.com]
> Sent: Saturday, July 25, 2009 12:31 PM
> To: axis-dev@ws.apache.org
> Subject: Re: The entity name must immediately follow the '&' in the entity
> reference
>
>
>
> 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<Su...@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<Su...@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<Su...@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
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>

Re: The entity name must immediately follow the '&' in the entity reference

Posted by Andreas Veithen <an...@gmail.com>.
The exception that you get indicates that Axiom is doing deferred
parsing. This means that even if the exception is thrown inside
SOAPMessageFormatter, it is not a problem inside Axis2 or Axiom, but
most probably in the layer that you have built on top of it. You will
have to debug that code to determine where the character entities are
lost.

Andreas

On Sat, Jul 25, 2009 at 18:58, Sumit Shah<Su...@cgifederal.com> wrote:
>
>
> For brevity:
>
>
>
> We have our own JAXBMessageReceiver that extends the
> org.apache.axis2.rpc.receivers.RPCMessageReceiver. In the
> invokeBusinessLogic() method we invoke the integrating system that sends us
> an XML response that gets converted into a JAVA object for further
> processing. Once the processing is complete we serialize the JAVA object
> using the Code snippet I sent earlier.
>
>
>
> Then the result of the builder.getDocumentElement() gets set on the envelope
>
> where:
>
>
>
> bodyContent = builder.getDocumentElement();
>
>
>
> envelope.getBody().addChild(bodyContent);
>
>
>
> After that we set the envelope on the outMessage in the JAXBMessageReceiver.
>
>
>
> outMessage.setEnvelope(envelope);
>
>
>
> Then I think it would just follow Axis2 message processing.
>
>
>
> Thanks
>
> Sumit
>
>
>
>
>
> Here is the code snippet for that message receiver:
>
>
>
> public class JAXBMessageReceiver extends RPCMessageReceiver {
>
>     private static Log log = LogFactory.getLog(JAXBMessageReceiver.class);
>
>
>
>
>
>     public void invokeBusinessLogic(MessageContext inMessage, MessageContext
> outMessage) throws AxisFault {
>
>         Method method = null;
>
>
>
>         try {
>
>             // get the implementation class for the Web Service
>
>             Object obj = getTheImplementationObject(inMessage);
>
>
>
>             Class ImplClass = obj.getClass();
>
>
>
>             AxisOperation op =
> inMessage.getOperationContext().getAxisOperation();
>
>             method = (Method)(op.getParameterValue("myMethod"));
>
>
>
>             AxisService service = inMessage.getAxisService();
>
>             OMElement methodElement =
> inMessage.getEnvelope().getBody().getFirstElement();
>
>             AxisMessage inAxisMessage =
> op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
>
>             String messageNameSpace = null;
>
>
>
>             if (method == null) {
>
>                 String methodName = op.getName().getLocalPart();
>
>                 Method[] methods = ImplClass.getMethods();
>
>
>
>                 for (int i = 0; i < methods.length; i++) {
>
>                     if (methods[i].getName().equals(methodName)) {
>
>                         method = methods[i];
>
>                         op.addParameter("myMethod", method);
>
>
>
>                         break;
>
>                     }
>
>                 }
>
>
>
>                 if (method == null) {
>
>                     throw new AxisFault("No such method '" + methodName + "'
> in class " + ImplClass.getName());
>
>                 }
>
>             }
>
>
>
>             Object resObject = null;
>
>
>
>             if (inAxisMessage != null) {
>
>                 resObject =
> JAXBMessageUtil.invokeServiceClass(inAxisMessage, method, obj,
> messageNameSpace, methodElement, inMessage);
>
>             }
>
>
>
>             SOAPFactory fac = getSOAPFactory(inMessage);
>
>
>
>             // Handling the response
>
>             AxisMessage outaxisMessage =
> op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
>
>
>
>             if (outaxisMessage != null && outaxisMessage.getElementQName()
> != null) {
>
>                 messageNameSpace =
> outaxisMessage.getElementQName().getNamespaceURI();
>
>             }
>
>             else {
>
>                 messageNameSpace = service.getTargetNamespace();
>
>             }
>
>
>
>             OMNamespace ns = fac.createOMNamespace(messageNameSpace,
> service.getSchemaTargetNamespacePrefix());
>
>             SOAPEnvelope envelope = fac.getDefaultEnvelope();
>
>
> envelope.declareNamespace(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, new
> NamespaceContext().getPrefix(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI));
>
>
>
>             OMElement bodyContent = null;
>
>
>
>             if
> (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(op.getMessageExchangePattern()))
> {
>
>                 OMElement bodyChild =
> fac.createOMElement(outMessage.getAxisMessage().getName(), ns);
>
>                 envelope.getBody().addChild(bodyChild);
>
>                 outMessage.setEnvelope(envelope);
>
>
>
>                 return;
>
>             }
>
>
>
>             Parameter generateBare =
> service.getParameter(Java2WSDLConstants.DOC_LIT_BARE_PARAMETER);
>
>
>
>             if (generateBare != null &&
> "true".equals(generateBare.getValue())) {
>
>                 JAXBMessageUtil.processResonseAsDocLitBare(resObject,
> service, method, envelope, fac, ns, bodyContent, outMessage);
>
>             }
>
>             else {
>
>                 JAXBMessageUtil.processResponseAsDocLitWrapped(resObject,
> service, method, envelope, fac, ns, bodyContent, outMessage);
>
>             }
>
>
>
>             outMessage.setEnvelope(envelope);
>
>         }
>
>
>
>
>
>
>
>
>
>
>
> -----Original Message-----
> From: Andreas Veithen [mailto:andreas.veithen@gmail.com]
> Sent: Saturday, July 25, 2009 12:31 PM
> To: axis-dev@ws.apache.org
> Subject: Re: The entity name must immediately follow the '&' in the entity
> reference
>
>
>
> 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<Su...@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<Su...@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<Su...@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
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>

RE: The entity name must immediately follow the '&' in the entity reference

Posted by Sumit Shah <Su...@cgifederal.com>.
 

For brevity:

 

We have our own JAXBMessageReceiver that extends the
org.apache.axis2.rpc.receivers.RPCMessageReceiver. In the
invokeBusinessLogic() method we invoke the integrating system that sends
us an XML response that gets converted into a JAVA object for further
processing. Once the processing is complete we serialize the JAVA object
using the Code snippet I sent earlier. 

 

Then the result of the builder.getDocumentElement() gets set on the
envelope 

where: 

 

bodyContent = builder.getDocumentElement();

 

envelope.getBody().addChild(bodyContent);

 

After that we set the envelope on the outMessage in the
JAXBMessageReceiver.

 

outMessage.setEnvelope(envelope);

 

Then I think it would just follow Axis2 message processing.

 

Thanks

Sumit

 

 

Here is the code snippet for that message receiver:

 

public class JAXBMessageReceiver extends RPCMessageReceiver {

    private static Log log =
LogFactory.getLog(JAXBMessageReceiver.class);

 

    

    public void invokeBusinessLogic(MessageContext inMessage,
MessageContext outMessage) throws AxisFault {

        Method method = null;

 

        try {

            // get the implementation class for the Web Service

            Object obj = getTheImplementationObject(inMessage);

 

            Class ImplClass = obj.getClass();

 

            AxisOperation op =
inMessage.getOperationContext().getAxisOperation();

            method = (Method)(op.getParameterValue("myMethod"));

 

            AxisService service = inMessage.getAxisService();

            OMElement methodElement =
inMessage.getEnvelope().getBody().getFirstElement();

            AxisMessage inAxisMessage =
op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);

            String messageNameSpace = null;

 

            if (method == null) {

                String methodName = op.getName().getLocalPart();

                Method[] methods = ImplClass.getMethods();

 

                for (int i = 0; i < methods.length; i++) {

                    if (methods[i].getName().equals(methodName)) {

                        method = methods[i];

                        op.addParameter("myMethod", method);

 

                        break;

                    }

                }

 

                if (method == null) {

                    throw new AxisFault("No such method '" + methodName
+ "' in class " + ImplClass.getName());

                }

            }

 

            Object resObject = null;

 

            if (inAxisMessage != null) {

                resObject =
JAXBMessageUtil.invokeServiceClass(inAxisMessage, method, obj,
messageNameSpace, methodElement, inMessage);

            }

 

            SOAPFactory fac = getSOAPFactory(inMessage);

 

            // Handling the response

            AxisMessage outaxisMessage =
op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);

 

            if (outaxisMessage != null &&
outaxisMessage.getElementQName() != null) {

                messageNameSpace =
outaxisMessage.getElementQName().getNamespaceURI();

            }

            else {

                messageNameSpace = service.getTargetNamespace();

            }

 

            OMNamespace ns = fac.createOMNamespace(messageNameSpace,
service.getSchemaTargetNamespacePrefix());

            SOAPEnvelope envelope = fac.getDefaultEnvelope();

 
envelope.declareNamespace(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI,
new
NamespaceContext().getPrefix(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI
));

 

            OMElement bodyContent = null;

 

            if
(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(op.getMessageExchangePatte
rn())) {

                OMElement bodyChild =
fac.createOMElement(outMessage.getAxisMessage().getName(), ns);

                envelope.getBody().addChild(bodyChild);

                outMessage.setEnvelope(envelope);

 

                return;

            }

 

            Parameter generateBare =
service.getParameter(Java2WSDLConstants.DOC_LIT_BARE_PARAMETER);

 

            if (generateBare != null &&
"true".equals(generateBare.getValue())) {

                JAXBMessageUtil.processResonseAsDocLitBare(resObject,
service, method, envelope, fac, ns, bodyContent, outMessage);

            }

            else {

 
JAXBMessageUtil.processResponseAsDocLitWrapped(resObject, service,
method, envelope, fac, ns, bodyContent, outMessage);

            }

 

            outMessage.setEnvelope(envelope);

        }

        

 

 

 

 

-----Original Message-----
From: Andreas Veithen [mailto:andreas.veithen@gmail.com] 
Sent: Saturday, July 25, 2009 12:31 PM
To: axis-dev@ws.apache.org
Subject: Re: The entity name must immediately follow the '&' in the
entity reference

 

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<Su...@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<Su...@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:Head
er

> 

>> 

>>
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"></SOAP-ENV:He
ader><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(SOAPMessage
Formatter.java:83)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutp
utStream(CommonsHTTPTransportSender.java:330)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Common
sHTTPTransportSender.java:213)

> 

>> 

> 

>>                 at

> 

>> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLo
gic(AbstractInOutMessageReceiver.java:43)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessa
geReceiver.java:100)

> 

>> 

> 

>>                 at

> 

>> org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReques
t(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(St
ubSecurityHelper.java:227)

> 

>> 

> 

>>                 at

> 

>> 

>>
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityH
elper.java:125)

> 

>> 

> 

>>                 at

> 

>> 

>>
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:2
92)

> 

>> 

> 

>>                 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(Authentic
ationFilter.java:111)

> 

>> 

> 

>>                 at

> 

>> 

>>
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:
42)

> 

>> 

> 

>>                 at

> 

>> 

>>
com.ams.core.ui.filters.ClientIPAddressFilter.doFilter(ClientIPAddressFi
lter.java:80)

> 

>> 

> 

>>                 at

> 

>> 

>>
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:
42)

> 

>> 

> 

>>                 at

> 

>> 

>>
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.r
un(WebAppServletContext.java:3496)

> 

>> 

> 

>>                 at

> 

>> 

>>
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSu
bject.java:321)

> 

>> 

> 

>>                 at
weblogic.security.service.SecurityManager.runAs(Unknown

> 

>> Source)

> 

>> 

> 

>>                 at

> 

>> 

>>
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServ
letContext.java:2180)

> 

>> 

> 

>>                 at

> 

>> 

>>
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletCont
ext.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(S
treamingOMSerializer.java:100)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(Strea
mingOMSerializer.java:68)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(Strea
mingOMSerializer.java:57)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMS
erializerUtil.java:548)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPE
nvelopeImpl.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(SOAPMessage
Formatter.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<Su...@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>ParseEr
ror

> 

>> 

> 

>>> 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(SOAPMessage
Formatter.java:83)

> 

>> 

> 

>>> 

> 

>> 

> 

>>>                 at

> 

>> 

> 

>>> 

> 

>>> 

>>>
org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutp
utStream(CommonsHTTPTransportSender.java:330)

> 

>> 

> 

>>> 

> 

>> 

> 

>>>                 at

> 

>> 

> 

>>> 

> 

>>> 

>>>
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Common
sHTTPTransportSender.java:213)

> 

>> 

> 

>>> 

> 

>> 

> 

>>>                 at

> 

>> 

> 

>>> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)

> 

>> 

> 

>>> 

> 

>> 

> 

>>>                 at

> 

>> 

> 

>>> 

> 

>>> 

>>>
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLo
gic(AbstractInOutMessageReceiver.java:43)

> 

>> 

> 

>>> 

> 

>> 

> 

>>>                 at

> 

>> 

> 

>>> 

> 

>>> 

>>>
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessa
geReceiver.java:100)

> 

>> 

> 

>>> 

> 

>> 

> 

>>>                 at

> 

>> 

> 

>>> org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)

> 

>> 

> 

>>> 

> 

>> 

> 

>>>                 at

> 

>> 

> 

>>> 

> 

>>> 

>>>
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReques
t(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

> 

>> 

> 

>>> 

> 

>> 

> 

>>> 

> 

>> 

> 

>>> 

> 

>> 

> 

>>> 

> 

>> 

> 

>>> 

> 

>> 

> 

>>> 

> 

>> 

> 

>>> 


Re: The entity name must immediately follow the '&' in the entity reference

Posted by Andreas Veithen <an...@gmail.com>.
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<Su...@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<Su...@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<Su...@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
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>

RE: The entity name must immediately follow the '&' in the entity reference

Posted by Sumit Shah <Su...@cgifederal.com>.
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<Su...@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:Head
er

>
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"></SOAP-ENV:He
ader><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(SOAPMessage
Formatter.java:83)

> 

>                 at

>
org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutp
utStream(CommonsHTTPTransportSender.java:330)

> 

>                 at

>
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Common
sHTTPTransportSender.java:213)

> 

>                 at

> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)

> 

>                 at

>
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLo
gic(AbstractInOutMessageReceiver.java:43)

> 

>                 at

>
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessa
geReceiver.java:100)

> 

>                 at

> org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)

> 

>                 at

>
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReques
t(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(St
ubSecurityHelper.java:227)

> 

>                 at

>
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityH
elper.java:125)

> 

>                 at

>
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:2
92)

> 

>                 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(Authentic
ationFilter.java:111)

> 

>                 at

>
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:
42)

> 

>                 at

>
com.ams.core.ui.filters.ClientIPAddressFilter.doFilter(ClientIPAddressFi
lter.java:80)

> 

>                 at

>
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:
42)

> 

>                 at

>
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.r
un(WebAppServletContext.java:3496)

> 

>                 at

>
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSu
bject.java:321)

> 

>                 at
weblogic.security.service.SecurityManager.runAs(Unknown

> Source)

> 

>                 at

>
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServ
letContext.java:2180)

> 

>                 at

>
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletCont
ext.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(S
treamingOMSerializer.java:100)

> 

>                 at

>
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(Strea
mingOMSerializer.java:68)

> 

>                 at

>
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(Strea
mingOMSerializer.java:57)

> 

>                 at

>
org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMS
erializerUtil.java:548)

> 

>                 at

>
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPE
nvelopeImpl.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(SOAPMessage
Formatter.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<Su...@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>ParseEr
ror

> 

>> 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(SOAPMessage
Formatter.java:83)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutp
utStream(CommonsHTTPTransportSender.java:330)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Common
sHTTPTransportSender.java:213)

> 

>> 

> 

>>                 at

> 

>> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLo
gic(AbstractInOutMessageReceiver.java:43)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessa
geReceiver.java:100)

> 

>> 

> 

>>                 at

> 

>> org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReques
t(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

> 

>> 

> 

>> 

> 

>> 

> 

>> 

> 

>> 

> 

>> 

> 

>> 


RE: The entity name must immediately follow the '&' in the entity reference

Posted by Sumit Shah <Su...@cgifederal.com>.
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<Su...@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:Head
er

>
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"></SOAP-ENV:He
ader><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(SOAPMessage
Formatter.java:83)

> 

>                 at

>
org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutp
utStream(CommonsHTTPTransportSender.java:330)

> 

>                 at

>
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Common
sHTTPTransportSender.java:213)

> 

>                 at

> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)

> 

>                 at

>
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLo
gic(AbstractInOutMessageReceiver.java:43)

> 

>                 at

>
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessa
geReceiver.java:100)

> 

>                 at

> org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)

> 

>                 at

>
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReques
t(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(St
ubSecurityHelper.java:227)

> 

>                 at

>
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityH
elper.java:125)

> 

>                 at

>
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:2
92)

> 

>                 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(Authentic
ationFilter.java:111)

> 

>                 at

>
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:
42)

> 

>                 at

>
com.ams.core.ui.filters.ClientIPAddressFilter.doFilter(ClientIPAddressFi
lter.java:80)

> 

>                 at

>
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:
42)

> 

>                 at

>
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.r
un(WebAppServletContext.java:3496)

> 

>                 at

>
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSu
bject.java:321)

> 

>                 at
weblogic.security.service.SecurityManager.runAs(Unknown

> Source)

> 

>                 at

>
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServ
letContext.java:2180)

> 

>                 at

>
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletCont
ext.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(S
treamingOMSerializer.java:100)

> 

>                 at

>
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(Strea
mingOMSerializer.java:68)

> 

>                 at

>
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(Strea
mingOMSerializer.java:57)

> 

>                 at

>
org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMS
erializerUtil.java:548)

> 

>                 at

>
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPE
nvelopeImpl.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(SOAPMessage
Formatter.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<Su...@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>ParseEr
ror

> 

>> 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(SOAPMessage
Formatter.java:83)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutp
utStream(CommonsHTTPTransportSender.java:330)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Common
sHTTPTransportSender.java:213)

> 

>> 

> 

>>                 at

> 

>> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLo
gic(AbstractInOutMessageReceiver.java:43)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessa
geReceiver.java:100)

> 

>> 

> 

>>                 at

> 

>> org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)

> 

>> 

> 

>>                 at

> 

>> 

>>
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReques
t(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

> 

>> 

> 

>> 

> 

>> 

> 

>> 

> 

>> 

> 

>> 

> 

>> 


Re: The entity name must immediately follow the '&' in the entity reference

Posted by Andreas Veithen <an...@gmail.com>.
How do you transform this response and how do you add it to the SOAP
response sent by Axis2?

Andreas

On Sat, Jul 25, 2009 at 17:58, Sumit Shah<Su...@cgifederal.com> wrote:
> 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<Su...@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<Su...@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
>>
>>>
>>
>>>
>>
>>>
>>
>>>
>>
>>>
>>
>>>
>>
>>>
>

RE: The entity name must immediately follow the '&' in the entity reference

Posted by Sumit Shah <Su...@cgifederal.com>.
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<Su...@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<Su...@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
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>

Re: The entity name must immediately follow the '&' in the entity reference

Posted by Andreas Veithen <an...@gmail.com>.
How do you build the uniqueIdentity element?

Andreas

On Sat, Jul 25, 2009 at 17:48, Sumit Shah<Su...@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<Su...@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
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>

RE: The entity name must immediately follow the '&' in the entity reference

Posted by Sumit Shah <Su...@cgifederal.com>.
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:Head
er
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"></SOAP-ENV:He
ader><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(SOAPMessage
Formatter.java:83)

                at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutp
utStream(CommonsHTTPTransportSender.java:330)

                at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Common
sHTTPTransportSender.java:213)

                at
org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)

                at
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLo
gic(AbstractInOutMessageReceiver.java:43)

                at
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessa
geReceiver.java:100)

                at
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)

                at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReques
t(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(St
ubSecurityHelper.java:227)

                at
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityH
elper.java:125)

                at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:2
92)

                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(Authentic
ationFilter.java:111)

                at
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:
42)

                at
com.ams.core.ui.filters.ClientIPAddressFilter.doFilter(ClientIPAddressFi
lter.java:80)

                at
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:
42)

                at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.r
un(WebAppServletContext.java:3496)

                at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSu
bject.java:321)

                at
weblogic.security.service.SecurityManager.runAs(Unknown Source)

                at
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServ
letContext.java:2180)

                at
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletCont
ext.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(S
treamingOMSerializer.java:100)

                at
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(Strea
mingOMSerializer.java:68)

                at
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(Strea
mingOMSerializer.java:57)

                at
org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMS
erializerUtil.java:548)

                at
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPE
nvelopeImpl.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(SOAPMessage
Formatter.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<Su...@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>ParseEr
ror

> 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(SOAPMessage
Formatter.java:83)

> 

>                 at

>
org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutp
utStream(CommonsHTTPTransportSender.java:330)

> 

>                 at

>
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Common
sHTTPTransportSender.java:213)

> 

>                 at

> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)

> 

>                 at

>
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLo
gic(AbstractInOutMessageReceiver.java:43)

> 

>                 at

>
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessa
geReceiver.java:100)

> 

>                 at

> org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)

> 

>                 at

>
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReques
t(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

> 

> 

> 

> 

> 

> 

>