[ https://issues.apache.org/jira/browse/AXIS2-1820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12524713 ]
Patrik Nordwall commented on AXIS2-1820: ---------------------------------------- setAllowedRetry doesn't work for me with basic auth and xmlbeans. I have found this solution: http://www.nabble.com/http-authentication-with-Axis2-tf3436522.html#a9581568 ArrayList<String> authSchemes = new ArrayList<String>(); authSchemes.add(HttpTransportProperties.Authenticator.BASIC); HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator(); auth.setPreemptiveAuthentication(true); auth.setAuthSchemes(authSchemes); auth.setUsername(username); auth.setPassword(password); client.getOptions().setProperty(HTTPConstants.AUTHENTICATE, auth); > javax.xml.stream.XMLStreamException: problem accessing the parser when using > NTLM and stubs generated by xmlbeans > ----------------------------------------------------------------------------------------------------------------- > > Key: AXIS2-1820 > URL: https://issues.apache.org/jira/browse/AXIS2-1820 > Project: Axis 2.0 (Axis2) > Issue Type: Bug > Affects Versions: 1.1 > Environment: jdk 1.5.0_8. Windows xp servicepack 2 > Reporter: Tor Jonsson > Assignee: Deepal Jayasinghe > Priority: Critical > Attachments: SendPageClient.java > > > 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. - 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]