1 Reply Latest reply on Mar 30, 2013 9:09 AM by Daniel Cote

    Soap header truncated

    Daniel Cote Newbie

      Hi,

       

      I'm using Jboss 7.1.1final + ...

       

      In a WebService, I configured a SoapHandler that is use to extract information from the incoming transaction.

      Altough it worked fine for usual use cases, it broked when I tried to extract soap header content that was bigger (more than 512 bytes).

       

      Here the extracts from the trace file:

       

      Note the followings:

      • the payload received (logged) demonstrates that the transaction is well received, including the complete content of the wsse:Security header (payload is here irrelevant, just a serie of 0123456789...)
      • the 07:27:34,792 CONF (http-localhost-127.0.0.1-8080-1) com.ibm.ihii.xua.AbstractSAMLValidator.<init> Constructor
        shows that the content, that has been extracted, is truncated ..
      • In debug, I can see that when processing the header, the content that is made available matches the truncated value... The problem is is the handler...
      • Here an extract from the extraction code used by the handler:

       

      static private void extractSoapHeader(SOAPMessageContext soapCtx, CallContext callContext)

          {

       

              SOAPMessage message = soapCtx.getMessage();

              SOAPHeader header;

              try {

                  header = message.getSOAPPart().getEnvelope().getHeader();

              } catch (SOAPException e) {

                  throw new RuntimeException(e);

              }

              Iterator<SOAPHeaderElement> it;

       

              if (header != null) {

                  it = header.examineAllHeaderElements();

                  while (it.hasNext()) {

       

                      SOAPHeaderElement element = it.next();

                      String elementName = element.getLocalName();

                     

                      Node n = element.getFirstChild();

                     

                      String value = n.getTextContent();

       

      The 'value' variable matches the truncated value...

      The SOAPHeader implementation is com.sun.xml.messaging.saaj.soap.ver1_2.Header1_2Impl during the execution.

       

      This code works perfectly in other Appserver...

       

      Any idea??

       

      Thanks

       

       

       

       

       

       

      07:27:34,573 INFO (http-localhost-127.0.0.1-8080-1) com.ibm.ai.xds.webContext.XDSHandler.Msg from: [ 127.0.0.1]  target --> http://localhost:8080/XDSRegistryWS/DocumentRegistry_Service action:[urn:ihe:iti:2007:RegistryStoredQuery]

      07:27:34,573 CONF (http-localhost-127.0.0.1-8080-1) com.ibm.ai.xds.webContext.XDSHandler.logMessage message received... payload:[<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0">&lt;Assertion&gt;&#13;

      1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890&#13;

      1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890&#13;

      1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890&#13;

      1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890&#13;

      1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890&#13;

      1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890&#13;

      &lt;Assertion&gt;&#13;

      </wsse:Security><wsa:Action xmlns:wsa="http://www.w3.org/2005/08/addressing" soap:mustUnderstand="1">urn:ihe:iti:2007:RegistryStoredQuery</wsa:Action><wsa:ReplyTo xmlns:wsa="http://www.w3.org/2005/08/addressing" soap:mustUnderstand="1"><wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address></wsa:ReplyTo><wsa:To xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost:8080/XDSRegistryWS/DocumentRegistry_Service</wsa:To><wsa:MessageID xmlns:wsa="http://www.w3.org/2005/08/addressing">7dd20f4c-c1f7-45cb-befc-c77b257d9df6</wsa:MessageID></soap:Header><soap:Body><ns5:AdhocQueryRequest xmlns="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0" xmlns:ns2="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0" xmlns:ns3="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0" xmlns:ns4="urn:ihe:iti:xds-b:2007" xmlns:ns5="urn:oasis:names:tc:ebxml-regrep:xsd:query:3.0"><ns5:ResponseOption returnComposedObjects="true" returnType="LeafClass"/><AdhocQuery id="urn:uuid:14d4debf-8f97-4251-9a74-a90016b0af0d"><Slot name="$XDSDocumentEntryPatientId"><ValueList><Value>NA5156^^^&amp;1.3.6.1.4.1.21367.2010.1.2.300&amp;ISO</Value></ValueList></Slot><Slot name="$XDSDocumentEntryStatus"><ValueList><Value>urn:oasis:names:tc:ebxml-regrep:StatusType:Approved</Value></ValueList></Slot></AdhocQuery></ns5:AdhocQueryRequest></soap:Body></soap:Envelope>]

      07:27:34,604 WARN (http-localhost-127.0.0.1-8080-1) com.ai.utils.BaseParms.getInstance Instance [OrchestrationConfig.xml] has been updated... Launching refresh

      07:27:34,620 INFO (http-localhost-127.0.0.1-8080-1) com.ibm.ai.xds.registry.webservices.DocumentRegistryImpl.constructor !

      07:27:34,620 INFO (http-localhost-127.0.0.1-8080-1) com.ibm.ai.xds.registry.webservices.DocumentRegistryImpl.constructor !

      07:27:34,620 INFO (http-localhost-127.0.0.1-8080-1) com.ibm.ai.xds.registry.submission.validation.ReferenceDataModel.constructor

      07:27:34,792 CONF (http-localhost-127.0.0.1-8080-1) com.ibm.ihii.xua.AbstractSAMLValidator.<init> Constructor

      <Assertion>

      1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

      1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

      1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

      1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

      1234567890123456789012345678901234567890123456789012345678901234567890123456789

      07:27:34,807 ERRO (http-localhost-127.0.0.1-8080-1) stderr.write [Fatal Error] :6:80: XML document structures must start and end within the same entity.

        • 1. Re: Soap header truncated
          Daniel Cote Newbie

          Ok I found it.

           

          The Woodstox parser, used by CXF, does not return more than 500 bytes when the element is of type  javax.xml.stream.XMLStreamConstants.CHARACTERS.

          (in fact, a 'TOKEN_PARTIAL_SINGLE' value is returned).

           

           

          com.ctc.wstx.util.TextBuffer

          final static int DEF_INITIAL_BUFFER_SIZE = 500;

           

          Now that I know this, I will make sure no such kind oy payload will be sent...

           

          Regards