DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9826>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9826

Doc message's operation not identified

           Summary: Doc message's operation not identified
           Product: Axis
           Version: beta-2
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Basic Architecture
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I showed this problem to Glen Daniels and he knows what fix is needed. 

The error can be reproduced with the following JUnit test acting as the client: 

package xp2002.exercise.webservices.test;

import java.util.Vector;

import junit.framework.TestCase;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.message.SOAPBodyElement;
import org.apache.axis.utils.XMLUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;

public class ForecastWebServiceTest extends TestCase {

        public ForecastWebServiceTest(String name) {
                super(name);
        }

        public static void main(String[] args) {
                junit.awtui.TestRunner.run(ForecastWebServiceTest.class);
        }

        public void testGetForecast() throws Exception {

                Element cityXML =
                        XMLUtils.StringToElement
("http://xp2002.exercise.forecast";, "CITY", "Apex");
                SOAPBodyElement forecastXML = callGetForecast(cityXML);

                assertNotNull(
                        "forecastResult",
                        forecastXML.getAsDOM().getElementsByTagName
("ForecastResult"));
                NodeList itemList = forecastXML.getAsDOM().getElementsByTagName
("CITY");
                Node item = itemList.item(0);
                assertTrue("forecastResult", "Apex".equals(item.getFirstChild
().toString()));

        }
        public SOAPBodyElement callGetForecast(Element cityXML) throws 
Exception {

                String endpoint 
= "http://localhost:8080/axis/services/ForecastService";;

                Service service = new Service();
                Call call = (Call) service.createCall();

                call.setTargetEndpointAddress(new java.net.URL(endpoint));
                SOAPBodyElement[] input = new SOAPBodyElement[1];

                SOAPBodyElement soap = new SOAPBodyElement(cityXML);

                input[0] = soap;

                Vector elems = (Vector) call.invoke(input);

                return (SOAPBodyElement) elems.elementAt(0);

        }

}


To a service implemented by the following bean (with code removed)

package xp2002.exercise.forecast.service;

import org.w3c.dom.Document;

public class Forecaster {
        
        private ForecastTable forecasts = new ForecastTable();

        public Forecaster() {
                super();
        }
        
        
        public Document getForecast(Document cityDoc){
                
                //simplified code to just return back the document recieved
                
                return cityDoc;
                
        }       
                
}


The deploy.wsdd file is 

  <deployment name="test" xmlns="http://xml.apache.org/axis/wsdd/"; 
            xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";
            xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance";>
  <service name="ForecastService" provider="java:MSG">
    <parameter name="className" 
value="xp2002.exercise.forecast.service.Forecaster" />
    <parameter name="allowedMethods" value="getForecast" />
  </service>
</deployment>


The service on the wire is:

POST /axis/services/ForecastService HTTP/1.0

Content-Length: 340

Host: localhost

Content-Type: text/xml; charset=utf-8

SOAPAction: ""



<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
 <SOAP-ENV:Body><ns1:CITY 
xmlns:ns1="http://xp2002.exercise.forecast";>Apex</ns1:CITY> </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The error being generated on the server side is:

java.lang.NullPointerException
        at org.apache.axis.AxisFault.makeFault(AxisFault.java:116)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:433)
        at org.apache.axis.Message.getSOAPEnvelope(Message.java:306)
        at org.apache.axis.handlers.soap.SOAPService$SOAPRequestHandler.invoke
(SOAPService.java:138)
        at org.apache.axis.strategies.InvocationStrategy.visit
(InvocationStrategy.java:71)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:154)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:121)
        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:288)
        at org.apache.axis.transport.http.AxisServlet.doPost
(AxisServlet.java:576)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:243)
        at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:190)
        at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
        at org.apache.catalina.valves.CertificatesValve.invoke
(CertificatesValve.java:246)
        at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
        at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2343)
        at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:180)
        at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
        at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:170)
        at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
        at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:170)
        at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
        at org.apache.catalina.valves.AccessLogValve.invoke
(AccessLogValve.java:468)
        at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
        at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:174)
        at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.connector.http.HttpProcessor.process
(HttpProcessor.java:1012)
        at org.apache.catalina.connector.http.HttpProcessor.run
(HttpProcessor.java:1107)
        at java.lang.Thread.run(Thread.java:536)
Caused by: java.lang.NullPointerException
        at org.apache.axis.message.BodyBuilder.onStartChild
(BodyBuilder.java:134)
        at org.apache.axis.encoding.DeserializationContextImpl.startElement
(DeserializationContextImpl.java:831)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1488)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507)
        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
        at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
        at org.apache.axis.encoding.DeserializationContextImpl.parse
(DeserializationContextImpl.java:202)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:428)
        ... 39 more

I believe the problem is in the following code in BodyBuilder.onStartChild when 
it is trying to identify whether the element being analyzed is a non-Root 
element or a non-RPC service. 

       } else if (!gotRPCElement) {
            if (isRoot &&
                (operations == null ||
                 (operations[0].getStyle() !=
                  ServiceDesc.STYLE_MESSAGE))) {
                gotRPCElement = true;
                element = new RPCElement(namespace, localName, prefix,
                                         attributes, context, operations);

Inspecting the variables as this code is walked through shows that the 
operations are null which causes the �if� to be true and calls the new 
RPCElement(..) which then errors out. 

Running the samples.message example also causes the new RPCElement to be 
executed, but does not cause the fault to occur. I don't know what difference 
between the 2 tests is causing the sample to pass and mine to fall.

Reply via email to