Hello Axis Development team,

I stumbled across a situation I think it is a defect, but it could also be 
that the way we are using Axis is not correct. The problem manifested 
itself as a IndexOutOfBoundsException (see attached stacktrace) which 
popped up "miraculously" after some time. After some investigation I came 
to the following findings.

We are using Axis 1.4. (for completeness Java 1.6.0_10-beta-b14 and Tomcat 
5.0.28)
We used message style SOAP without defining namespaces in both the service 
description and the request
Sniplet server-config.wsdd:
        <service name="ActionHandler" provider="java:MSG" style="message"
                use="literal">
                <parameter name="allowedMethods"
                        value="preCreationCheck preSendCheck" />
                <parameter name="className"
 
value="org.epo.cassius.server.servicesweb.dispatch.business.ActionHandlerDispatcher"
 
/>
        </service>

The ActionHandler contains the methods :
public SOAPBodyElement[] preCreationCheck(SOAPBodyElement[] payload) 
throws AxisFault
public SOAPBodyElement[] preSendCheck(SOAPBodyElement[] payload) throws 
AxisFault

The message that I used looks like this
<soap-env:Envelope xmlns:soap-encoding="UTF-8" xmlns:soap-env="
http://schemas.xmlsoap.org/soap/envelope/";>
<soap-env:Header>....some security data ...
</soap-env:Header>
<soap-env:Body>
<preSendCheck>
<parameters>
.... some data...
</parameters>
</preSendCheck>
</soap-env:Body>
</soap-env:Envelope>

Initially the request are processed correctly. But after the WSDL has been 
generated because of a ActionHandler?wsdl request , the SOAP requests fail 
with the reported stacktrace.

Because the stacktrace report the problem in 
JavaServiceDesc.getOperationsByQName, I debug this file and noticed the 
following:
- Because of having no namespace in the request the code does not find a 
match based on the QName
- Before the WSDL generation it tries to resolve it using the localPart 
and suceeds (style=Message and namespaceMappings=null, thus 
DefaultNamespace=null)
            if (name2OperationsMap != null) {
                if ((isWrapped() ||
                     ((style == Style.MESSAGE) &&
                      (getDefaultNamespace() == null)))) {
                    // Try ignoring the namespace....?
==>                    overloads = (ArrayList) 
name2OperationsMap.get(qname.getLocalPart());
                } else {
                    // TODO the above code is weird: a JavaServiceDesc can 
 be document or rpc and
                    // still define a WSDL operation using a wrapper style 
 mapping.
                    // The following code handles this case.
                    Object ops = 
name2OperationsMap.get(qname.getLocalPart());
                    if (ops != null) {
                        overloads = new ArrayList((Collection) ops);
                        for (Iterator iter = overloads.iterator(); 
iter.hasNext();) {
                            OperationDesc operationDesc = (OperationDesc) 
iter.next();
                            if (Style.WRAPPED != operationDesc.getStyle()) 
{
                                iter.remove();
                            }
                        }
                    }
                }
            }
- After the WSDL generation it executes the ELSE part, because now it has 
entries in the namespaceMapping. Given the documentation I don't think 
this is correct.
- The ops is assigned a list with 1 entry with the correct operation, but 
it is removed from "overloads" list, because the 
operationDesc.getStyle()=serviceDesc.getStyle=Style.MESSAGE
- The reason why if doesn't crash if the service contains only 1 operation 
is because of the following piece of code. Question: If this is discarding 
previously gathered information why is this quick fallthrough not done 
earlier?
           // Handle the case where a single Message-style operation wants
            // to accept anything.
            if ((style == Style.MESSAGE) && (messageServiceDefaultOp != 
null))
                return new OperationDesc [] { messageServiceDefaultOp };
- If there are not candidates the code exits the method using the 
following piece of code. This is a problem, because of the iter.remove() 
it can be an empty list
            if (overloads == null)
                return null;
- Correctly the following statement reports the IndexOutOfBoundsException 
in case of the empty list
       getSyncedOperationsForName(implClass,
 ((OperationDesc)overloads.get(0)).getName());

A minimal fix should be " if (overloads==null||overloads.size()==0)".

Since I'm not familiar with the requirements on the usage of namespace, I 
can not say whether removing the "(getDefaultNamespace()==null)" and 
making sure that the JavaServiceDesc object does not get changed as the 
result from the ?wsdl request are good code changes as well. For now I 
have it working in our project by putting namespace on the 
servicedefinition and the requests 




Best regards / Mit freundlichen Grüßen / Sincères salutations

Erwin Streur
External Administrative Employee Examination/Cassius Group | Dir. 2.7.1.2
European Patent Office
Patentlaan 3-9 | 2288 EE Rijswijk | The Netherlands
Tel. +31 (0)70 340 9928
[EMAIL PROTECTED]
http://www.epo.org
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0  
at java.util.ArrayList.RangeCheck(ArrayList.java:507)   
at java.util.ArrayList.get(ArrayList.java:324)  
at 
org.apache.axis.description.JavaServiceDesc.getOperationsByQName(JavaServiceDesc.java:520)
   
at 
org.apache.axis.MessageContext.getPossibleOperationsByQName(MessageContext.java:243)
 
at org.apache.axis.message.BodyBuilder.onStartChild(BodyBuilder.java:132)       
at 
org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
       
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)     
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown 
Source)     
at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
 Source)     
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
Source)   
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)   
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)   
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)    
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)    
at javax.xml.parsers.SAXParser.parse(Unknown Source)    
at 
org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
       
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)        
at org.apache.axis.SOAPPart.getEnvelope(SOAPPart.java:1003)     
at org.apache.axis.Message.getSOAPBody(Message.java:555)        
at 
org.epo.cassius.server.servicesweb.security.SecurityAuthorizationHandler.doRequest(SecurityAuthorizationHandler.java:59)
     
at 
org.epo.cassius.server.servicesweb.security.SecurityAuthorizationHandler.invoke(SecurityAuthorizationHandler.java:42)
        
at 
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) 
     
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) 
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)      
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:249)        
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)      
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) 
at 
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
     
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
    
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
  
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)  
at 
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
  
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
  
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)  
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)   
     
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)   
     
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)  
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)  
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)        
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)      
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)   
at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
   
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)   
at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
   
at java.lang.Thread.run(Thread.java:534)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to