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 David Werner <da...@uni-koblenz.de> on 2005/02/07 15:34:36 UTC
Can't invoke method with multiple arguments
Hi,
I haven't realized the whole problem, when I submitted the mail with subject
'Problem with deserealizing boolean'. In fact, I can't invoke any method
with more than a single argument, independent of the arguments' (simple)
type! A java.lang.IllegalArgumentException is thrown, because only the first
value can be deseserialized:
"Tried to invoke method public java.lang.String
test.server.TestSoapBindingImpl.printLongs(long,long) with arguments
java.lang.Long,null. The arguments do not match the signature."
Here's an example of a simple web service, that takes two longs and should
return a string.
At the end of the mail I copied a part of Axis' log file, where only the
first argument of printLongs is properly converted before the exception is
thrown.
I would be really glad, if someone could give me a hint of what I'm doing
wrong. ;-)
BTW, I'm using Axis 1.2RC2, Tomcat 5.0.19 and JDK 1.5 on Win XP.
Bye, Dave
-------------------------
service implementation
------------------------
public class TestSoapBindingImpl implements test.server.Test{
public String printLongs(long long_1, long long_2){
return "long_1 = " +long_1 +", long_2 = " +long_2;
}
}
--------------------
client
--------------------
public class TestClient {
public static void main (String[] args) throws Exception {
TestService service = new TestServiceLocator();
Test testProxy = service.gettest();
long longVal = 1L;
response = testProxy.printLongs(longVal, longVal);
System.out.println(response);
}
}
--------------------
SOAP messsage
--------------------
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<in6 xmlns="urn:TestNS">1</in6>
<in7 xmlns="urn:TestNS">1</in7>
</soapenv:Body>
</soapenv:Envelope>
-----------------
Axis' log file
-----------------
...
17555 org.apache.axis.message.SAXOutputter
- SAXOutputter.startElement ['urn:TestNS' in6]
17555 org.apache.axis.i18n.ProjectResourceBundle
- org.apache.axis.i18n.resource::handleGetObject(startElem00)
17555 org.apache.axis.encoding.SerializationContext
- Start element [urn:TestNS]:in6
17555 org.apache.axis.message.SAXOutputter
- SAXOutputter.characters ['1']
17766 org.apache.axis.message.SAXOutputter
- SAXOutputter.endElement ['urn:TestNS' in6]
17766 org.apache.axis.i18n.ProjectResourceBundle
- org.apache.axis.i18n.resource::handleGetObject(endElem00)
17766 org.apache.axis.encoding.SerializationContext
- End element in6
17766 org.apache.axis.i18n.ProjectResourceBundle
- org.apache.axis.i18n.resource::handleGetObject(empty00)
17766 org.apache.axis.utils.NSStack
- NSPop (empty)
17766 org.apache.axis.i18n.ProjectResourceBundle
- org.apache.axis.i18n.resource::handleGetObject(bodyIs00)
17766 org.apache.axis.providers.java.RPCProvider
- body is <in6 xmlns="urn:TestNS">1</in6>
17766 org.apache.axis.i18n.ProjectResourceBundle
- org.apache.axis.i18n.resource::handleGetObject(pushHandler00)
17766 org.apache.axis.encoding.DeserializationContext
- Pushing handler org.apache.axis.message.RPCHandler@82d210
17766 org.apache.axis.encoding.DeserializationContext
- Enter: DeserializationContext::startPrefixMapping(, urn:TestNS)
17766 org.apache.axis.utils.NSStack
- NSPush (32)
17766 org.apache.axis.utils.NSStack
- NSPush (32)
17766 org.apache.axis.encoding.DeserializationContext
- Exit: DeserializationContext::startPrefixMapping()
17766 org.apache.axis.encoding.DeserializationContext
- Enter: DeserializationContext::startElement(urn:TestNS, in6)
17766 org.apache.axis.message.RPCHandler
- Enter: RPCHandler.onStartChild()
17766 org.apache.axis.i18n.ProjectResourceBundle
- org.apache.axis.i18n.resource::handleGetObject(typeFromAttr00)
17766 org.apache.axis.message.RPCHandler
- Type from attributes is: null
17876 org.apache.axis.message.RPCHandler
- Exit: RPCHandler.onStartChild()
17886 org.apache.axis.i18n.ProjectResourceBundle
- org.apache.axis.i18n.resource::handleGetObject(pushHandler00)
17886 org.apache.axis.encoding.DeserializationContext
- Pushing handler
org.apache.axis.encoding.ser.SimpleDeserializer@2c9103
17886 org.apache.axis.encoding.DeserializationContext
- Exit: DeserializationContext::startElement()
17886 org.apache.axis.encoding.DeserializationContext
- Enter: DeserializationContext::endElement(urn:TestNS, in6)
17886 org.apache.axis.i18n.ProjectResourceBundle
- org.apache.axis.i18n.resource::handleGetObject(popHandler00)
17886 org.apache.axis.encoding.DeserializationContext
- Popping handler
org.apache.axis.encoding.ser.SimpleDeserializer@2c9103
17886 org.apache.axis.i18n.ProjectResourceBundle
- org.apache.axis.i18n.resource::handleGetObject(setValueInTarget00)
17886 org.apache.axis.encoding.DeserializerImpl
- Set value 1 in target
org.apache.axis.encoding.MethodTarget@1e46a68
17886 org.apache.axis.i18n.ProjectResourceBundle
- org.apache.axis.i18n.resource::handleGetObject(empty00)
17886 org.apache.axis.utils.NSStack
- NSPop (empty)
17886 org.apache.axis.encoding.DeserializationContext
- Popped element stack to org.apache.axis.message.SOAPBody:Body
17886 org.apache.axis.encoding.DeserializationContext
- Exit: DeserializationContext::endElement()
17886 org.apache.axis.i18n.ProjectResourceBundle
- org.apache.axis.i18n.resource::handleGetObject(convert00)
17886 org.apache.axis.utils.JavaUtils
- Trying to convert java.lang.Long to long
17886 org.apache.axis.i18n.ProjectResourceBundle
- org.apache.axis.i18n.resource::handleGetObject(value00)
17886 org.apache.axis.providers.java.RPCProvider
- value: 1
17886 org.apache.axis.i18n.ProjectResourceBundle
- org.apache.axis.i18n.resource::handleGetObject(dispatchIAE00)
17986 org.apache.axis.providers.java.RPCProvider
- Tried to invoke method public java.lang.String
test.server.TestSoapBindingImpl.printLongs(long,long) with arguments
java.lang.Long,null. The arguments do not match the signature.
java.lang.IllegalArgumentException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:384
)
at
org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:2
81)
at
org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:319)
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.handlers.soap.SOAPService.invoke(SOAPService.java:450)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:285)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:653)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:
301)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
...
RE: Can't invoke method with multiple arguments
Posted by David Werner <da...@uni-koblenz.de>.
Hallo,
I also tried to invoke the same service with a Call object and explicitly
set the type of the parameters. This time I got anothter exception:
"org.xml.sax.SAXException: SimpleDeserializer encountered a child element,
which is NOT expected, in something it was trying to deserialize."
Does anyone have an idea ...?
Bye, Dave
--------------------
client code
--------------------
public class TestClient2
{
public static void main(String [] args) {
try {
String endpoint =
"http://localhost:1234/axis1.2rc2/services/test";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("urn:TestNS", "printLongs") );
call.addParameter("in6",
org.apache.axis.Constants.XSD_LONG,
javax.xml.rpc.ParameterMode.IN);
call.addParameter("in7",
org.apache.axis.Constants.XSD_LONG,
javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.Constants.XSD_STRING);
String response = (String) call.invoke( new Object[] { 1L, 1L } );
System.out.println(response);
} catch (Exception e) {
System.err.println(e.toString());
}
}
}
--------------------
exception
--------------------
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a
child element, which is NOT expected, in something it was trying to
deserialize.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException:
SimpleDeserializer encountered a child element, which is NOT expected, in
something it was trying to deserialize.
at
org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeseriali
zer.java:143)
at
org.apache.axis.encoding.DeserializationContext.startElement(Deserialization
Context.java:1031)
at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
1140)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:238)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
at
org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:1
48)
at
org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:319)
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.handlers.soap.SOAPService.invoke(SOAPService.java:450)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:285)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:653)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:
301)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
....
> -----Original Message-----
> From: David Werner [mailto:dave@uni-koblenz.de]
> Sent: Monday, February 07, 2005 3:35 PM
> To: Axis-User@Ws. Apache. Org
> Subject: Can't invoke method with multiple arguments
>
>
> Hi,
>
> I haven't realized the whole problem, when I submitted the mail
> with subject
> 'Problem with deserealizing boolean'. In fact, I can't invoke any method
> with more than a single argument, independent of the arguments' (simple)
> type! A java.lang.IllegalArgumentException is thrown, because
> only the first
> value can be deseserialized:
>
> "Tried to invoke method public java.lang.String
> test.server.TestSoapBindingImpl.printLongs(long,long) with arguments
> java.lang.Long,null. The arguments do not match the signature."
>
> Here's an example of a simple web service, that takes two longs and should
> return a string.
> At the end of the mail I copied a part of Axis' log file, where only the
> first argument of printLongs is properly converted before the exception is
> thrown.
> I would be really glad, if someone could give me a hint of what I'm doing
> wrong. ;-)
>
> BTW, I'm using Axis 1.2RC2, Tomcat 5.0.19 and JDK 1.5 on Win XP.
>
> Bye, Dave
>
> -------------------------
> service implementation
> ------------------------
> public class TestSoapBindingImpl implements test.server.Test{
>
> public String printLongs(long long_1, long long_2){
> return "long_1 = " +long_1 +", long_2 = " +long_2;
> }
>
> }
>
> --------------------
> client
> --------------------
> public class TestClient {
>
> public static void main (String[] args) throws Exception {
> TestService service = new TestServiceLocator();
> Test testProxy = service.gettest();
>
> long longVal = 1L;
> response = testProxy.printLongs(longVal, longVal);
> System.out.println(response);
> }
> }
>
> --------------------
> SOAP messsage
> --------------------
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soapenv:Body>
> <in6 xmlns="urn:TestNS">1</in6>
> <in7 xmlns="urn:TestNS">1</in7>
> </soapenv:Body>
> </soapenv:Envelope>
>
>
> -----------------
> Axis' log file
> -----------------
> ...
> 17555 org.apache.axis.message.SAXOutputter
> - SAXOutputter.startElement ['urn:TestNS' in6]
> 17555 org.apache.axis.i18n.ProjectResourceBundle
> - org.apache.axis.i18n.resource::handleGetObject(startElem00)
> 17555 org.apache.axis.encoding.SerializationContext
> - Start element [urn:TestNS]:in6
> 17555 org.apache.axis.message.SAXOutputter
> - SAXOutputter.characters ['1']
> 17766 org.apache.axis.message.SAXOutputter
> - SAXOutputter.endElement ['urn:TestNS' in6]
> 17766 org.apache.axis.i18n.ProjectResourceBundle
> - org.apache.axis.i18n.resource::handleGetObject(endElem00)
> 17766 org.apache.axis.encoding.SerializationContext
> - End element in6
> 17766 org.apache.axis.i18n.ProjectResourceBundle
> - org.apache.axis.i18n.resource::handleGetObject(empty00)
> 17766 org.apache.axis.utils.NSStack
> - NSPop (empty)
> 17766 org.apache.axis.i18n.ProjectResourceBundle
> - org.apache.axis.i18n.resource::handleGetObject(bodyIs00)
> 17766 org.apache.axis.providers.java.RPCProvider
> - body is <in6 xmlns="urn:TestNS">1</in6>
> 17766 org.apache.axis.i18n.ProjectResourceBundle
> - org.apache.axis.i18n.resource::handleGetObject(pushHandler00)
> 17766 org.apache.axis.encoding.DeserializationContext
> - Pushing handler org.apache.axis.message.RPCHandler@82d210
> 17766 org.apache.axis.encoding.DeserializationContext
> - Enter: DeserializationContext::startPrefixMapping(, urn:TestNS)
> 17766 org.apache.axis.utils.NSStack
> - NSPush (32)
> 17766 org.apache.axis.utils.NSStack
> - NSPush (32)
> 17766 org.apache.axis.encoding.DeserializationContext
> - Exit: DeserializationContext::startPrefixMapping()
> 17766 org.apache.axis.encoding.DeserializationContext
> - Enter: DeserializationContext::startElement(urn:TestNS, in6)
> 17766 org.apache.axis.message.RPCHandler
> - Enter: RPCHandler.onStartChild()
> 17766 org.apache.axis.i18n.ProjectResourceBundle
> - org.apache.axis.i18n.resource::handleGetObject(typeFromAttr00)
> 17766 org.apache.axis.message.RPCHandler
> - Type from attributes is: null
> 17876 org.apache.axis.message.RPCHandler
> - Exit: RPCHandler.onStartChild()
> 17886 org.apache.axis.i18n.ProjectResourceBundle
> - org.apache.axis.i18n.resource::handleGetObject(pushHandler00)
> 17886 org.apache.axis.encoding.DeserializationContext
> - Pushing handler
> org.apache.axis.encoding.ser.SimpleDeserializer@2c9103
> 17886 org.apache.axis.encoding.DeserializationContext
> - Exit: DeserializationContext::startElement()
> 17886 org.apache.axis.encoding.DeserializationContext
> - Enter: DeserializationContext::endElement(urn:TestNS, in6)
> 17886 org.apache.axis.i18n.ProjectResourceBundle
> - org.apache.axis.i18n.resource::handleGetObject(popHandler00)
> 17886 org.apache.axis.encoding.DeserializationContext
> - Popping handler
> org.apache.axis.encoding.ser.SimpleDeserializer@2c9103
> 17886 org.apache.axis.i18n.ProjectResourceBundle
> -
> org.apache.axis.i18n.resource::handleGetObject(setValueInTarget00)
> 17886 org.apache.axis.encoding.DeserializerImpl
> - Set value 1 in target
> org.apache.axis.encoding.MethodTarget@1e46a68
> 17886 org.apache.axis.i18n.ProjectResourceBundle
> - org.apache.axis.i18n.resource::handleGetObject(empty00)
> 17886 org.apache.axis.utils.NSStack
> - NSPop (empty)
> 17886 org.apache.axis.encoding.DeserializationContext
> - Popped element stack to org.apache.axis.message.SOAPBody:Body
> 17886 org.apache.axis.encoding.DeserializationContext
> - Exit: DeserializationContext::endElement()
> 17886 org.apache.axis.i18n.ProjectResourceBundle
> - org.apache.axis.i18n.resource::handleGetObject(convert00)
> 17886 org.apache.axis.utils.JavaUtils
> - Trying to convert java.lang.Long to long
> 17886 org.apache.axis.i18n.ProjectResourceBundle
> - org.apache.axis.i18n.resource::handleGetObject(value00)
> 17886 org.apache.axis.providers.java.RPCProvider
> - value: 1
> 17886 org.apache.axis.i18n.ProjectResourceBundle
> - org.apache.axis.i18n.resource::handleGetObject(dispatchIAE00)
> 17986 org.apache.axis.providers.java.RPCProvider
> - Tried to invoke method public java.lang.String
> test.server.TestSoapBindingImpl.printLongs(long,long) with arguments
> java.lang.Long,null. The arguments do not match the signature.
> java.lang.IllegalArgumentException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorIm
> pl.java:39
> )
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc
> cessorImpl
> .java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at
> org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvide
> r.java:384
> )
> at
> org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvi
> der.java:2
> 81)
> at
> org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:319)
> at
> org.apache.axis.strategies.InvocationStrategy.visit(InvocationStra
> tegy.java:
> 32)
> at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> at
> org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:450)
> at org.apache.axis.server.AxisServer.invoke(AxisServer.java:285)
> at
> org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:653)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
> at
> org.apache.axis.transport.http.AxisServletBase.service(AxisServlet
> Base.java:
> 301)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> ...
>