You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Jason Wells <ja...@semanticresearch.com> on 2002/06/20 23:53:33 UTC
Passing primitives into SOAP calls
Hello,
I'm trying to understand how to expose a SOAP service with a method that
takes a primitive data types (such as int) rather than objects (like
Integer). Most of the code examples I've found set up the call's method
arguments like this:
Call call = new Call();
Vector params = new Vector();
params.addElement(new Parameter("caller", String.class, "whatever",
null));
call.setParams(params);
The problem is that the Parameter constructor only takes object-based
parameters (a String in this case), but won't take primitives. I
reviewed the source code for Parameter and I don't see any way to give
it a non-object parameter.
So I began to wonder if it wasn't possible. Then I ran into this
document, "Creating Type Mappings":
http://xml.apache.org/soap/docs/guide/serializer.html
It seems to imply that at least from a XML serialization perspective,
Apache SOAP knows about primitive types. So how do you use one as a call
parameter?
Thanks,
Jason
Re: Passing primitives into SOAP calls
Posted by Jason Wells <ja...@semanticresearch.com>.
Erich,
Ah. I didn't realize that if you gave it this:
params.addElement(new Parameter("ID", Integer.TYPE, new Integer(42),
null));
...that it would know to decompose the Integer object to an int. Works
like a charm.
Thanks,
Jason
On Thursday, June 20, 2002, at 02:57 PM, Erich Izdepski wrote:
> Java has class types for primitives that work with the Parameter class.
> Each
> object wrapper has a static member called TYPE that gives the class of
> the
> associated primitive. For example, the class for int is given by
> Integer.TYPE.
>
> Erich Izdepski
> Senior Software Engineer
> Cysive, Inc.
>
>
> -----Original Message-----
> From: Jason Wells [mailto:jason@semanticresearch.com]
> Sent: Thursday, June 20, 2002 5:54 PM
> To: soap-user@xml.apache.org
> Subject: Passing primitives into SOAP calls
>
>
> Hello,
>
> I'm trying to understand how to expose a SOAP service with a method that
> takes a primitive data types (such as int) rather than objects (like
> Integer). Most of the code examples I've found set up the call's method
> arguments like this:
>
> Call call = new Call();
> Vector params = new Vector();
> params.addElement(new Parameter("caller", String.class, "whatever",
> null));
> call.setParams(params);
>
> The problem is that the Parameter constructor only takes object-based
> parameters (a String in this case), but won't take primitives. I
> reviewed the source code for Parameter and I don't see any way to give
> it a non-object parameter.
>
> So I began to wonder if it wasn't possible. Then I ran into this
> document, "Creating Type Mappings":
>
> http://xml.apache.org/soap/docs/guide/serializer.html
>
> It seems to imply that at least from a XML serialization perspective,
> Apache SOAP knows about primitive types. So how do you use one as a call
> parameter?
>
> Thanks,
> Jason
>
>
> --
> To unsubscribe, e-mail: <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
>
> --
> To unsubscribe, e-mail: <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
Re: Passing primitives into SOAP calls
Posted by Jason Wells <ja...@semanticresearch.com>.
Erich,
Ah. I didn't realize that if you gave it this:
params.addElement(new Parameter("ID", Integer.TYPE, new Integer(42),
null));
...that it would know to decompose the Integer object to an int. Works
like a charm.
Thanks,
Jason
On Thursday, June 20, 2002, at 02:57 PM, Erich Izdepski wrote:
> Java has class types for primitives that work with the Parameter class.
> Each
> object wrapper has a static member called TYPE that gives the class of
> the
> associated primitive. For example, the class for int is given by
> Integer.TYPE.
>
> Erich Izdepski
> Senior Software Engineer
> Cysive, Inc.
>
>
> -----Original Message-----
> From: Jason Wells [mailto:jason@semanticresearch.com]
> Sent: Thursday, June 20, 2002 5:54 PM
> To: soap-user@xml.apache.org
> Subject: Passing primitives into SOAP calls
>
>
> Hello,
>
> I'm trying to understand how to expose a SOAP service with a method that
> takes a primitive data types (such as int) rather than objects (like
> Integer). Most of the code examples I've found set up the call's method
> arguments like this:
>
> Call call = new Call();
> Vector params = new Vector();
> params.addElement(new Parameter("caller", String.class, "whatever",
> null));
> call.setParams(params);
>
> The problem is that the Parameter constructor only takes object-based
> parameters (a String in this case), but won't take primitives. I
> reviewed the source code for Parameter and I don't see any way to give
> it a non-object parameter.
>
> So I began to wonder if it wasn't possible. Then I ran into this
> document, "Creating Type Mappings":
>
> http://xml.apache.org/soap/docs/guide/serializer.html
>
> It seems to imply that at least from a XML serialization perspective,
> Apache SOAP knows about primitive types. So how do you use one as a call
> parameter?
>
> Thanks,
> Jason
>
>
> --
> To unsubscribe, e-mail: <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
>
> --
> To unsubscribe, e-mail: <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
RE: Passing primitives into SOAP calls
Posted by Erich Izdepski <ei...@cysive.com>.
Java has class types for primitives that work with the Parameter class. Each
object wrapper has a static member called TYPE that gives the class of the
associated primitive. For example, the class for int is given by
Integer.TYPE.
Erich Izdepski
Senior Software Engineer
Cysive, Inc.
-----Original Message-----
From: Jason Wells [mailto:jason@semanticresearch.com]
Sent: Thursday, June 20, 2002 5:54 PM
To: soap-user@xml.apache.org
Subject: Passing primitives into SOAP calls
Hello,
I'm trying to understand how to expose a SOAP service with a method that
takes a primitive data types (such as int) rather than objects (like
Integer). Most of the code examples I've found set up the call's method
arguments like this:
Call call = new Call();
Vector params = new Vector();
params.addElement(new Parameter("caller", String.class, "whatever",
null));
call.setParams(params);
The problem is that the Parameter constructor only takes object-based
parameters (a String in this case), but won't take primitives. I
reviewed the source code for Parameter and I don't see any way to give
it a non-object parameter.
So I began to wonder if it wasn't possible. Then I ran into this
document, "Creating Type Mappings":
http://xml.apache.org/soap/docs/guide/serializer.html
It seems to imply that at least from a XML serialization perspective,
Apache SOAP knows about primitive types. So how do you use one as a call
parameter?
Thanks,
Jason
--
To unsubscribe, e-mail: <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>
RE: Passing primitives into SOAP calls
Posted by Erich Izdepski <ei...@cysive.com>.
Java has class types for primitives that work with the Parameter class. Each
object wrapper has a static member called TYPE that gives the class of the
associated primitive. For example, the class for int is given by
Integer.TYPE.
Erich Izdepski
Senior Software Engineer
Cysive, Inc.
-----Original Message-----
From: Jason Wells [mailto:jason@semanticresearch.com]
Sent: Thursday, June 20, 2002 5:54 PM
To: soap-user@xml.apache.org
Subject: Passing primitives into SOAP calls
Hello,
I'm trying to understand how to expose a SOAP service with a method that
takes a primitive data types (such as int) rather than objects (like
Integer). Most of the code examples I've found set up the call's method
arguments like this:
Call call = new Call();
Vector params = new Vector();
params.addElement(new Parameter("caller", String.class, "whatever",
null));
call.setParams(params);
The problem is that the Parameter constructor only takes object-based
parameters (a String in this case), but won't take primitives. I
reviewed the source code for Parameter and I don't see any way to give
it a non-object parameter.
So I began to wonder if it wasn't possible. Then I ran into this
document, "Creating Type Mappings":
http://xml.apache.org/soap/docs/guide/serializer.html
It seems to imply that at least from a XML serialization perspective,
Apache SOAP knows about primitive types. So how do you use one as a call
parameter?
Thanks,
Jason
--
To unsubscribe, e-mail: <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>
--
To unsubscribe, e-mail: <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>