axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Ling" <jeffl...@google.com>
Subject temp fix for NTML authentication & axiom serialization error
Date Fri, 02 Jun 2006 05:22:06 GMT
Hi guys,

I had to make my client work, so I digged into the code and "fixed" it. It's
just something for me to bypass the problem. Maybe someone could take a look
and provide a real fix?

Basically, first is "NTLM scheme can't use UsernamepasswordCredential"
error.
I changed the AbstractHttpSender.java. I use NTCredential when there is
"realm" defined. I am sure there is
        if (basicAuthentication.getRealm() == null)
        {
           defaultCredentials = new UsernamePasswordCredentials(
                basicAuthentication.getUsername(),
                basicAuthentication.getPassword());
        }else
        {
          defaultCredentials = new NTCredentials(
            basicAuthentication.getUsername (),
            basicAuthentication.getPassword(),
            basicAuthentication.getHost(),
            basicAuthentication.getRealm());
            agent.getState().setCredentials(new AuthScope(
              basicAuthentication.getHost(),
              basicAuthentication.getPort(),
              null), defaultCredentials);

            return;
        }


However, I still got this error.

ERROR [main] (WSS.java:53) - 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!


The error came from the handshake (The second time call to
HttpMethodDirector.java inside HttpClient package)  After further digging, I
found it's not really Axis core module's issue. The error came from Axiom.
It failed in  StAXBuilder.java:

    public Object getParser() {
        if (parserAccessed) {
            throw new IllegalStateException(
                    "Parser already accessed!");
        }
I really don't want to find out why, but tried to see whether serializing
into a string would work. So I added the following call to
org.apache.axiom.om.impl.llom.OMElementImpl.java::internalSerialize();

              try
              {
              ByteArrayOutputStream buffer = new ByteArrayOutputStream();

              this.serialize(buffer);
              buffer.close();
              System.out.println(buffer.toString());
              }catch(Exception e)
              {
                System.out.println(e.getMessage());
              }

Magically, it "fixed" the problem! Now the authentication went through and
everything works fine!


Here I attached the two files. Can someone please look into the problem?

Mime
View raw message