eclipse-ee4j / metro-xmlstreambuffer

Metro xmlstreambuffer
BSD 3-Clause "New" or "Revised" License
1 stars 5 forks source link

CLONE - Streambuffer cannot parse namespaces presented in the SOAP envelope level #5

Open Tomas-Kraus opened 10 years ago

Tomas-Kraus commented 10 years ago

We're using the below code snippet to parse SOAP header:

private ServiceContext getDeltaContext (SOAPMessageContext context)

{ Object[] jaxbServiceContext = context.getHeaders(new QName(DFS_CONTEXT_NAMESPACE, "ServiceContext"), SERVICE_CONTEXT_JAXB_CONTEXT, false); ... }

The above code will finally depend on streambuffer to parse the SOAP message. However, we hit the below exception when parsing the attached SOAP message (note that the namespaces are in the envelope level):

Caused by: javax.xml.bind.JAXBException

After initial investigation, we found this should be caused by a streambuffer bug. If we update the implementation of com.sun.xml.stream.buffer.stax.StreamReaderBufferProcessor.setXMLStreamBuffer(XMLStreamBuffer buffer) like below, the issue can be resolved: public void setXMLStreamBuffer(XMLStreamBuffer buffer) throws XMLStreamException { setBuffer(buffer,buffer.isFragment());

_completionState = PARSING; _namespaceAIIsEnd = buffer.getInscopeNamespaces().size(); Set<Entry<String, String>> entries = buffer.getInscopeNamespaces().entrySet(); Iterator<Entry<String, String>> it = entries.iterator(); int i = 0; while(it.hasNext() && i < _namespaceAIIsEnd)

{ Entry<String, String> entry = it.next(); _namespaceAIIsPrefix[i] = entry.getKey(); _namespaceAIIsNamespaceName[i] = entry.getValue(); i++; }

_characters = null; _charSequence = null; _eventType = START_DOCUMENT; }

Streambuffer 1.1 also has this bug.

Btw, at first we were using SOAPMessageContext.getMessage().getSOAPHeader()to parse the SOAP header but there is OOM issue with large MTOM message.

Environment

NA

Affected Versions

[1.5.2]

Tomas-Kraus commented 6 years ago
Tomas-Kraus commented 10 years ago

@glassfishrobot Commented Reported by giriyv

Tomas-Kraus commented 10 years ago

@glassfishrobot Commented giriyv said:

  1. I have created a simple test case by modifying the sample program provided in javaee tutorial5 jaxws module.
  2. Added a HandlerChain(helloservice.endpoint.HeaderHandler) for ‘Hello’ webservice.
  3. Invoking the below code in HeaderHandler to parse the header element.

JAXBContext.newInstance(ServiceContext.class); private static final String DFS_CONTEXT_NAMESPACE = "http://context.core.datamodel.fs.documentum.emc.com/"; jaxbServiceContext = context.getHeaders(new QName(DFS_CONTEXT_NAMESPACE, "ServiceContext"), SERVICE_CONTEXT_JAXB_CONTEXT, false);

Getting the exception “prefix dfsdmcorecontext is not bound to a namespace]” when the following SOAP message is passed through SOAPUI tool. Here namespace is declared at soapenv element.

Test..*** message * * * It is working fine when namespace is declared at ServiceContext element. Test..*** message
Tomas-Kraus commented 10 years ago

@glassfishrobot Commented giriyv said: I would like to attach a sample .war file which can be deployed on tomcat and test it through SOAPUI tool. Please let me know how can I attach the war file and sample test source code.

Thanks, Venkatesh

Tomas-Kraus commented 10 years ago

@glassfishrobot Commented giriyv said: Attaching the exception stacktrace

javax.xml.ws.WebServiceException: javax.xml.bind.JAXBException

Tomas-Kraus commented 10 years ago

@glassfishrobot Commented giriyv said: Hi Martin,

Any update on this?. Please let me know how I can upload the test web application. It is around 11MB.

Thanks, Venkatesh

Tomas-Kraus commented 10 years ago

@glassfishrobot Commented Issue-Links: clones XMLSTREAMBUFFER-4

Tomas-Kraus commented 10 years ago

@glassfishrobot Commented Was assigned to snajper

Tomas-Kraus commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA XMLSTREAMBUFFER-5