[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.<init>(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 [EMAIL PROTECTED]: key id 0x92082481 [EMAIL PROTECTED]: key id 0x5E4B731F
<?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="urn:HelloService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:impl="urn:HelloService-impl" xmlns:intf="urn:HelloService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <wsdl:message name="ReadNumberRequest"> </wsdl:message> <wsdl:message name="WriteNumberResponse"> </wsdl:message> <wsdl:message name="ReadNumberResponse"> <wsdl:part name="return" type="xsd:int"/> </wsdl:message> <wsdl:message name="WriteNumberRequest"> <wsdl:part name="in0" type="xsd:int"/> </wsdl:message> <wsdl:portType name="HelloService"> <wsdl:operation name="ReadNumber"> <wsdl:input message="intf:ReadNumberRequest"/> <wsdl:output message="intf:ReadNumberResponse"/> </wsdl:operation> <wsdl:operation name="WriteNumber" parameterOrder="in0"> <wsdl:input message="intf:WriteNumberRequest"/> <wsdl:output message="intf:WriteNumberResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="HelloSoapBinding" type="intf:HelloService"> <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="ReadNumber"> <wsdlsoap:operation soapAction=""/> <wsdl:input> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="ReadNumber" use="encoded"/> </wsdl:input> <wsdl:output> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:HelloService" use="encoded"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="WriteNumber"> <wsdlsoap:operation soapAction=""/> <wsdl:input> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="WriteNumber" use="encoded"/> </wsdl:input> <wsdl:output> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:HelloService" use="encoded"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="HelloServiceService"> <wsdl:port binding="intf:HelloSoapBinding" name="Hello"> <wsdlsoap:address location="http://localhost:8080/axis/services/Hello"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
signature.asc
Description: This is a digitally signed message part