You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Adrian 'Dagurashibanipal' von Bidder <av...@fortytwo.ch> on 2002/05/28 12:13:29 UTC

jaxrpc and axis (basic question...)

[this list closed to non-subscribers? If not, this comes twice cause
some mailserver has a long delay. sorry]

Hi!

I'm trying to get a bit into jaxrpc, axis, and all the related stuff, so
this is probably a very beginner type of question (or I'm not
understanding what axis is about...).

I have generated a service wsdl from a java class with 

java org.apache.axis.wsdl.Java2WSDL
   -l"http://localhost:8080/axis/services/Hello" -n  "urn:HelloService"
   -p"vbi.xml" "urn:HelloService"  vbi.xml.HelloService

and then generated the java classes with

java org.apache.axis.wsdl.WSDL2Java -S false -Nurn:HelloService=vbi.xml
   -dApplication Hello.wsdl

Then, I edited the generated HelloSoapBindingImpl.java to contain my
'service logic' (at this stage, I just change an private variable of
this class and return the new value with a second method).

This is the client I'm trying to use:

===
    public static void main(String args[]) {

        try{
            HelloService hello =
                new HelloServiceServiceLocator().getHello();

            System.out.print("Setting 2\n");
            hello.writeNumber(2);
            System.out.print("Reading:");
            System.out.print(hello.readNumber());
            System.out.print("\n");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
===

Which only gives me a NullPointerException in hello.writeNumber(2),
apparently while trying to parse the NullPointerException coming from
the Server.

I can, of course, post the whole code, but I'm unsure which parts are
relevant as most of it is generated by WSDL2Java. In any case, the wsdl
file is attached. On the wire, this is seen:
===
POST /axis/services/Hello HTTP/1.0
Content-Length: 498
Host: localhost
Content-Type: text/xml; charset=utf-8
SOAPAction: ""

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
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"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
 <SOAP-ENV:Body>
  <ns1:WriteNumber xmlns:ns1="WriteNumber">
   <in0 xsi:type="xsd:int">2</in0>
  </ns1:WriteNumber>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
===
HTTP/1.0 500 Internal server error
Content-Type: text/xml; charset=utf-8
Content-Length: 2168
Set-Cookie: 2
Set-Cookie2: 2

<?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>
  <SOAP-ENV:Fault>
   <faultcode
xmlns:ns1="http://xml.apache.org/axis/">ns1:Server.userException</faultcode>
   <faultstring>java.lang.NullPointerException</faultstring>
   <detail>
    <ns2:stackTrace
xmlns:ns2="http://xml.apache.org/axis/">java.lang.NullPointerException
        at
org.apache.axis.message.RPCElement.&lt;init&gt;(RPCElement.java:106)
        at
org.apache.axis.message.BodyBuilder.onStartChild(BodyBuilder.java:158)
        at
org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:870)
        at
org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java)
        at
org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java)
        at
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java)
        at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java)
        at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java)
        at
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:217)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:443)
        at org.apache.axis.Message.getSOAPEnvelope(Message.java:308)
        at
org.apache.axis.handlers.soap.SOAPService$SOAPRequestHandler.invoke(SOAPService.java:143)
        at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:286)
        at
org.apache.axis.transport.http.SimpleAxisServer.run(SimpleAxisServer.java:392)
        at
org.apache.axis.transport.http.SimpleAxisServer.main(SimpleAxisServer.java:852)
</ns2:stackTrace>
   </detail>
  </SOAP-ENV:Fault>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
===
and the the HelloClient quits with
===
java.lang.NullPointerException
        at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:134)
        at
org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:917)
        at
org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java)
        at
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java)
        at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java)
        at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java)
        at
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:217)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:443)
        at org.apache.axis.client.Call.invoke(Call.java:1917)
        at org.apache.axis.client.Call.invoke(Call.java:1684)
        at org.apache.axis.client.Call.invoke(Call.java:1612)
        at org.apache.axis.client.Call.invoke(Call.java:1174)
        at
vbi.xml.HelloSoapBindingStub.writeNumber(HelloSoapBindingStub.java:126)
        at vbi.xml.HelloClient.main(HelloClient.java:12)
===

Oh, yes: the same happens with both beta2 and cvs HEAD, I'm using the
SimpleAxisServer and am working on a Linux with a 1.3 JVM.


The problem is that I've not found the one example that demonstrates
exactly what I want (ok, I know, there is never the one example that is
just the software I have to write :-), specifically I don't want to have
to construct Call objects by hand.


anything obvious I missed (sure there is ...)

cheers & thanks
-- vbi


-- 
secure email with gpg            avbidder@fortytwo.ch: key id 0x92082481
                                 avbidder@acter.ch:    key id 0x5E4B731F