Problem using OMSourcedElement/CustomBuilder for SOAP Headers
-------------------------------------------------------------

                 Key: WSCOMMONS-276
                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-276
             Project: WS-Commons
          Issue Type: Bug
          Components: AXIOM
            Reporter: David Illsley
            Assignee: Rich Scheuerle


I've just tried to get the CustomBuilder stuff working for SOAP Headers and 
I've run into a problem.
I've reduced it to a simplified testcase which could be added to the 
CustomBuilderTest class.

The test method is:

   public void testHeaderCustomBuilder() throws Exception{
       XMLStreamReader parser =
           XMLInputFactory.newInstance().createXMLStreamReader(new
FileReader(getTestResourceFile(TestConstants.SOAP_SOAPMESSAGE)));
       StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(parser, null);
       builder.registerCustomBuilder(new
QName("http://schemas.xmlsoap.org/ws/2004/03/addressing","To";), 3, new
ByteArrayCustomBuilder("utf-8"));
       SOAPEnvelope sourceEnv = (SOAPEnvelope) builder.getDocumentElement();
       SOAPHeader header = sourceEnv.getHeader();
       ArrayList al =
header.getHeaderBlocksWithNSURI("http://schemas.xmlsoap.org/ws/2004/03/addressing";);
       for(int i=0;i<al.size();i++){
               SOAPHeaderBlock shb = (SOAPHeaderBlock)al.get(i);
               if("To".equals(shb.getLocalName())){
                       assertNotNull(shb.getDataSource());
               }
       }
   }


The error is:
org.apache.axiom.om.OMException: java.lang.IllegalStateException:
Current state not START_ELEMENT
       at 
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:241)
       at 
org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:583)
       at 
org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:135)
       at 
org.apache.axiom.soap.impl.llom.SOAPHeaderImpl.getHeaderBlocksWithNSURI(SOAPHeaderImpl.java:363)
       at 
org.apache.axiom.om.impl.builder.CustomBuilderTest.testHeaderCustomBuilder(CustomBuilderTest.java:134)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
       at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:615)
       at junit.framework.TestCase.runTest(TestCase.java:164)
       at junit.framework.TestCase.runBare(TestCase.java:130)
       at junit.framework.TestResult$1.protect(TestResult.java:106)
       at junit.framework.TestResult.runProtected(TestResult.java:124)
       at junit.framework.TestResult.run(TestResult.java:109)
       at junit.framework.TestCase.run(TestCase.java:120)
       at junit.framework.TestSuite.runTest(TestSuite.java:230)
       at junit.framework.TestSuite.run(TestSuite.java:225)
       at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
       at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
       at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
       at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
       at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
       at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.IllegalStateException: Current state not START_ELEMENT
       at 
com.ctc.wstx.sr.BasicStreamReader.getAttributeCount(BasicStreamReader.java:591)
       at 
org.apache.axiom.om.impl.builder.StAXBuilder.processAttributes(StAXBuilder.java:194)
       at 
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:350)
       at 
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:208)
       at 
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:190)
       at 
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:164)
       ... 22 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to