javax.xml.stream.XMLStreamException: problem accessing the parser when using 
NTLM and stubs generated by xmlbeans
-----------------------------------------------------------------------------------------------------------------

                 Key: AXIS2-1820
                 URL: http://issues.apache.org/jira/browse/AXIS2-1820
             Project: Apache Axis 2.0 (Axis2)
          Issue Type: Bug
    Affects Versions: 1.1
         Environment: jdk 1.5.0_8. Windows xp servicepack 2
            Reporter: Tor Jonsson
            Priority: Critical


When generating a java client with xmlbeans NTLM authentication breaks:

WSDL (Test.wsdl):

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:tns="http://www.example.org/Test/"; 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; name="Test" 
targetNamespace="http://www.example.org/Test/";>
<wsdl:types>
<xsd:schema targetNamespace="http://www.example.org/Test/";>
<xsd:element name="NewOperation">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="in" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="NewOperationResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="out" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="NewOperationRequest">
<wsdl:part element="tns:NewOperation" name="parameters"/>
</wsdl:message>
<wsdl:message name="NewOperationResponse">
<wsdl:part element="tns:NewOperationResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="Test">
<wsdl:operation name="NewOperation">
<wsdl:input message="tns:NewOperationRequest"/>
<wsdl:output message="tns:NewOperationResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TestSOAP" type="tns:Test">
<soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="NewOperation">
<soap:operation soapAction="http://www.example.org/Test/NewOperation"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Test">
<wsdl:port binding="tns:TestSOAP" name="TestSOAP">
<soap:address location="http://www.host.com/Services.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>



Command to generate Java cllient stubs:

wsdl2java -uri Test.wsdl -d xmlbeans

ClientTest.java
package com.volvo.ums.test;

import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.List;

import org.apache.axis2.client.Options;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.transport.http.HttpTransportProperties;
import org.example.www.test.NewOperationDocument;
import org.example.www.test.NewOperationResponseDocument;
import org.example.www.test.TestStub;
import org.example.www.test.NewOperationDocument.NewOperation;

public class ClientTest {

        public static void main(String[] args) {
                ClientTest cli = new ClientTest();
                
                try {
                        cli.doTest();
                } catch (RemoteException e) {
                        e.printStackTrace();
                }

        }

        public void doTest( )throws RemoteException
        {
                TestStub stub = new TestStub( 
"http://www.host.com/Services.asmx"; );

                Options opts = stub._getServiceClient().getOptions();
                HttpTransportProperties.Authenticator auth = 
getAuthProperties();
                opts.setProperty(HTTPConstants.AUTHENTICATE, auth );

                NewOperationDocument doc = 
NewOperationDocument.Factory.newInstance();

                NewOperation operation = doc.addNewNewOperation();
                operation.setIn( "Hello" );

                NewOperationResponseDocument resp = stub.NewOperation( doc );

        }

        /**
         * generates the properties needed for NTLM authentication 
         * 
         */
        public HttpTransportProperties.Authenticator getAuthProperties()
        {
                HttpTransportProperties.Authenticator auth = new 
HttpTransportProperties.Authenticator();

                List<String> l = new ArrayList<String>();
                l.add( HttpTransportProperties.Authenticator.NTLM );
                auth.setAuthSchemes(l);
                auth.setUsername( "username" );
                auth.setPassword("password");
                auth.setDomain( "domain" );
                auth.setHost( "www.host.com" );
                auth.setPort( 80 );
                return auth;
        }
}



StackTrace:

org.apache.axis2.AxisFault: problem accessing the parser. Parser already 
accessed!; nested exception is: 
        javax.xml.stream.XMLStreamException: problem accessing the parser. 
Parser already accessed!; nested exception is: 
        org.apache.axis2.AxisFault: problem accessing the parser. Parser 
already accessed!; nested exception is: 
        javax.xml.stream.XMLStreamException: problem accessing the parser. 
Parser already accessed!; nested exception is: 
        org.apache.axis2.AxisFault: problem accessing the parser. Parser 
already accessed!; nested exception is: 
        javax.xml.stream.XMLStreamException: problem accessing the parser. 
Parser already accessed!; nested exception is: 
        org.apache.axis2.AxisFault: problem accessing the parser. Parser 
already accessed!; nested exception is: 
        javax.xml.stream.XMLStreamException: problem accessing the parser. 
Parser already accessed!
        at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:670)
        at 
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:365)
        at 
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:295)
        at org.example.www.test.TestStub.NewOperation(TestStub.java:141)
        at com.volvo.ums.test.ClientTest.doTest(ClientTest.java:86)
        at com.volvo.ums.test.ClientTest.main(ClientTest.java:28)
Caused by: org.apache.axis2.AxisFault: problem accessing the parser. Parser 
already accessed!; nested exception is: 
        javax.xml.stream.XMLStreamException: problem accessing the parser. 
Parser already accessed!; nested exception is: 
        org.apache.axis2.AxisFault: problem accessing the parser. Parser 
already accessed!; nested exception is: 
        javax.xml.stream.XMLStreamException: problem accessing the parser. 
Parser already accessed!
        at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:340)
        at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:205)
        ... 6 more
Caused by: org.apache.axis2.AxisFault: problem accessing the parser. Parser 
already accessed!; nested exception is: 
        javax.xml.stream.XMLStreamException: problem accessing the parser. 
Parser already accessed!
        at 
org.apache.axis2.transport.http.SOAPOverHTTPSender$AxisSOAPRequestEntity.writeRequest(SOAPOverHTTPSender.java:246)
        at 
org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:495)
        at 
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1973)
        at 
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
        at 
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
        at 
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
        at 
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
        at 
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
        at 
org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:534)
        at 
org.apache.axis2.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java:119)
        at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:334)
        ... 7 more
Caused by: javax.xml.stream.XMLStreamException: problem accessing the parser. 
Parser already accessed!
        at 
org.apache.axiom.om.impl.llom.OMStAXWrapper.next(OMStAXWrapper.java:897)
        at 
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeNode(StreamingOMSerializer.java:74)
        at 
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(StreamingOMSerializer.java:59)
        at 
org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMSerializerUtil.java:469)
        at 
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:812)
        at 
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:837)
        at 
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:808)
        at 
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:177)
        at 
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:837)
        at 
org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:411)
        at 
org.apache.axis2.transport.http.SOAPOverHTTPSender$AxisSOAPRequestEntity.handleOMOutput(SOAPOverHTTPSender.java:190)
        at 
org.apache.axis2.transport.http.SOAPOverHTTPSender$AxisSOAPRequestEntity.writeRequest(SOAPOverHTTPSender.java:232)
        ... 17 more



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Reply via email to