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