Hi Steven,

In response to your note:
Q)Are you saying that you are invoking a web service operation that takes a
phone
number as a parameter
A) Yes

Q) but the operation has defined the type of the phone
number to be an integer
A) Yes

As you suggested, I have contacted the person controlling the web service,
explained my situation, and I am now allowed to send strings containing the
phone number. Thanks for your guidance.

Regards,
Mark.
-----Original Message-----
From: Steven Gollery [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 27 February 2002 10:48
To: [EMAIL PROTECTED]
Subject: Re: How to get leading zeros into <number
xsi:type="xsd:int">...</num ber>


Mark,

Are you saying that you are invoking a web service operation that takes a
phone
number as a parameter, but the operation has defined the type of the phone
number to be an integer? If so, this appears to me to be a flaw in the
definition of the web service: it doesn't make sense for a phone number to
be
considered as an integer, since you are unlikely to perform arithmetic on
it.

If someone else has control of the web service definition, you might ask
them
how their service handles phone numbers with leading zeroes. They may
already
be dealing with this issue internally.

Steven Gollery
[EMAIL PROTECTED]

"Walsh, Mark" wrote:

> Hi Rich,
>
> Thanks for your suggestion, the only problem is, if I use a string for the
> phone number as per example below, the XML that goes out on the wire is
> xsd:string not xsd:int. (That is using string does enable the leading zero
> to appear in the XML that is sent over the wire, I just end up using the
> wrong XML data type).
>
> String num = "0412345678";
> call.addParameter("number", XMLType.XSD_INT, Call.PARAM_MODE_IN );
> String ret = (String) call.invoke( new Object[] { num } );
>
> which produces the following xml that is sent over the wire
> <number xsi:type="xsd:string">0412345678</number>
>
> -----Original Message-----
> From: R J Scheuerle Jr [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 27 February 2002 10:16
> To: [EMAIL PROTECTED]
> Cc: '[EMAIL PROTECTED]'
> Subject: Re: How to get leading zeros into <number
> xsi:type="xsd:int">...</num ber>
>
> If you need to pass a leading zero, pass it as a string not an integer.
>
> Rich Scheuerle
> XML & Web Services Development
> 512-838-5115  (IBM TL 678-5115)
>
>
>
>                       "Walsh, Mark"
>
>                       <[EMAIL PROTECTED]        To:
> "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
>                       au>                      cc:
>
>                                                Subject:  How to get
leading
> zeros into <number xsi:type="xsd:int">...</num
>                       02/25/2002 11:36          ber>
>
>                       PM
>
>                       Please respond to
>
>                       axis-user
>
>
>
>
>
> Hi,
>
> I have a java xml client that uses Apache SOAP version 2.2 (eg
> org.apache.soap...) that can send a phone number (with a leading zero) to
> our server.
>
> Having trouble seeing how to do the same from a client using axis (alpha
> 3).
>
> The code fragment from Apache SOAP version 2.2 client that works is
>
> String number = "0412345678";
>
> call.setTargetObjectURI("urn:DBASE/Sms");
> call.setMethodName("sms_send");
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
> Vector params = new Vector (  );
> params.addElement (new Parameter("number", Integer.class, number, null));
> call.setParams (params);
> Response resp = call.invoke(url, "");
>
> which produces the following xml that is sent over the wire
> <number xsi:type="xsd:int">0412345678</number>
>
> I tried the following using axis code but the leading zero of the phone
> number gets killed when I created the Integer object.
>
> import org.apache.axis.client.Call;
> import org.apache.axis.client.Service;
> ..
> ..
> Service  service = new Service();
> Call     call    = (Call) service.createCall();
> ..
> ..
> Integer num = new Integer("0412345678");
> call.addParameter("number", XMLType.XSD_INT, Call.PARAM_MODE_IN );
> String ret = (String) call.invoke( new Object[] { num } );
>
> which produces the following xml that is sent over the wire
> <number xsi:type="xsd:int">412345678</number>
>
> Any help or suggestions on how can i get the axis client to include the
> leading zero would be greatly appreciated.
>
> Regards,
> Mark Walsh,
>
> WWW Applications Programmer
> Division of Information Technology
> Charles Sturt University
> PO Box 789
> Albury NSW 2640
> Australia,
>
> Phone: +61 2 60 519 600
> Fax:     +61 2 60 519 919
> Email: [EMAIL PROTECTED]

Reply via email to