Can NE 1 help me with more kXML and kSOAP samples??

"Bhanu" <[email protected]> Tue, 3 Jun 2003 18:35:11 +0530
Newsgroups gmane.comp.java.enhydra.kxml
Message-ID <[email protected]>
This is a multi-part message in MIME format.

------=_NextPart_000_0017_01C329FE.DD8DDE00
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

=20

I am new to J2ME, just started working on a project where my J2ME =
application needs to receive/send data to .NET web service. I have =
written a sample code to test the service. I was able to get the data =
from the server.=20

=20

Now, my question here is:

=20

1. How do I parse and get the data from the response I got from the =
server since it contains lot of things?

 =20

2. I have this XML

=20

<Cust_Appointment><Record><Internal_Cust_Id>1</Internal_Cust_Id><Appointm=
ent_Type>1</Appointment_Type><Appointment_Date>5-June-2003</Appointment_D=
ate><User_Id>1</User_Id><Description><![CDATA[Mobile =
Demo]]></Description><Active_Date>5-June-2002</Active_Date><Inactive_Date=
>

5-June-2004</Inactive_Date></Record></Cust_Appointment>

=20

How do I send it to the Server?? I was able to connect to the server but =
it returned a Fault as below:

=20

Buffer:<?xml version=3D"1.0" encoding=3D"utf-8"?>

<soap:Envelope xmlns:soap=3D"http://schemas.xmlsoap.org/soap/envelope/">

  <soap:Body>

    <soap:Fault>

      <faultcode>soap:Client</faultcode>

      <faultstring>Server was unable to read request. --&gt; The =
&amp;lt;Cust_Appointment&amp;gt; tag from namespace  is expected. Line =
1, position 2.</faultstring>

      <detail />

    </soap:Fault>

  </soap:Body>

</soap:Envelope>

Here is the sample I am using right now for reading/sending data from/to =
the server:

=20

package soaptest;

=20

import java.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;

=20

import org.ksoap.*;
import org.kxml.*;
import org.kxml.io.*;
import org.kxml.parser.*;

=20

public class clsHTTP extends Form implements CommandListener {

=20

//  static final String serviceNamespace =3D =
"http://pocketdba.com/webservices/";
  static final String serviceNamespace =3D "http://tempuri.org/";
  static final String =
xmlData=3D"<Cust_Appointment><Record><Internal_Cust_Id>1</Internal_Cust_I=
d><Appointment_Type>1</Appointment_Type><Appointment_Date>5-June-2003</Ap=
pointment_Date><User_Id>1</User_Id><Description><![CDATA[Mobile =
Demo]]></Description><Active_Date>5-June-2002</Active_Date><Inactive_Date=
>5-June-2004</Inactive_Date></Record></Cust_Appointment>";
  TextField fromField =3D new TextField ("UserName :", "ss", 4, =
TextField.ANY);
  StringItem resultItem =3D new StringItem ("", "");
  Command getCommand =3D new Command ("Get", Command.SCREEN, 1);
  Command sendCommand =3D new Command ("Send", Command.SCREEN, 2);

=20

  public clsHTTP() {
    super("Get Data");

=20

    append (fromField);
    append (resultItem);
    addCommand (getCommand);
    addCommand (sendCommand);

=20

    setCommandListener (this);
  }

=20

  public void commandAction (Command c, Displayable d) {
    if(c.getLabel()=3D=3D"Get"){
      try {
        String from =3D fromField.getString ();
        ByteArrayOutputStream bos =3D new ByteArrayOutputStream ();
        SoapObject request =3D new SoapObject (serviceNamespace, =
"DownloadAppointmentConfig");
        request.addProperty ("uName", fromField.getString ());

=20

        ClassMap classMap =3D new ClassMap();
        classMap.prefixMap =3D new PrefixMap(classMap.prefixMap, "tns", =
"http://tempuri.org/");
        SoapEnvelope envelope =3D new SoapEnvelope (classMap);
        envelope.setBody (request);

=20

        XmlWriter xw =3D new XmlWriter (new OutputStreamWriter (bos));
        envelope.write (xw);
        xw.flush ();

=20

        byte [] data =3D bos.toByteArray();
        // System.out.println (new String (data));

=20

        HttpConnection connection =3D (HttpConnection) Connector.open
        =
("http://MMSServer/SyncSvr/SyncSvrObj.asmx",Connector.READ_WRITE);
        connection.setRequestMethod (HttpConnection.POST);
        connection.setRequestProperty ("Content-Type", "text/xml");
        connection.setRequestProperty ("Connection", "close");
        connection.setRequestProperty ("Content-Length", =
""+data.length);
        =
connection.setRequestProperty("SOAPAction","\"http://tempuri.org/Download=
AppointmentConfig\"");
        OutputStream os =3D connection.openOutputStream ();
        os.write (data);
        os.flush ();

=20

        InputStream is=3D((StreamConnection) connection).openInputStream =
();
        int buffSize=3D200;
        byte[] buff =3D new byte[buffSize];
        ByteArrayOutputStream bytebuff=3Dnew =
ByteArrayOutputStream(buffSize);
        int eof=3D0;
        while(eof!=3D-1) {
          eof=3Dis.read(buff);
          if (eof!=3D-1) {
            bytebuff.write(buff,0,eof);
          }
        }
        is.close();

=20

        String response =3D new String(bytebuff.toByteArray());
        System.out.println (response);

=20

/*      Reader reader =3D new InputStreamReader(new
        ByteArrayInputStream(bytebuff.toByteArray()));
        XmlParser parser =3D new XmlParser (reader);
        SoapEnvelope resultEnvelope =3D new SoapEnvelope ();
        resultEnvelope.parse (parser);
        resultItem.setLabel ("amount :");
        String result =3D (String)resultEnvelope.getResult();
        result =3D result.substring(0,result.indexOf(".")+3);
        resultItem.setText (" "+result);
        reader.close ();
        */
        connection.close ();
        os.close ();

=20

      }
      catch (Exception e) {
        resultItem.setLabel ("Error:");
        resultItem.setText (e.toString ());
      }
    }
    else{

=20

      /* Sending data to SERVER*/

=20

      try {
        String from =3D fromField.getString ();
        ByteArrayOutputStream bos =3D new ByteArrayOutputStream ();
        SoapObject request =3D new SoapObject (serviceNamespace, =
"Upload_Cust_Appointment");
        request.addProperty ("uName", fromField.getString ());
        request.addProperty ("fileName", "Cust_Appointment");

=20

        ClassMap classMap =3D new ClassMap();
        classMap.prefixMap =3D new PrefixMap(classMap.prefixMap, "tns", =
"http://tempuri.org/");
        SoapEnvelope envelope =3D new SoapEnvelope (classMap);
        envelope.setBody (request);

=20

        XmlWriter xw =3D new XmlWriter (new OutputStreamWriter (bos));
        envelope.write (xw);
        xw.flush ();

=20

         byte [] data =3D bos.toByteArray();

=20


        HttpConnection connection =3D (HttpConnection) Connector.open
        =
("http://MMSServer/SyncSvr/SyncSvrObj.asmx",Connector.READ_WRITE);
        connection.setRequestMethod (HttpConnection.POST);
        connection.setRequestProperty ("Content-Type", "text/xml");
        connection.setRequestProperty ("Connection", "close");
        connection.setRequestProperty ("Content-Length", "" + =
data.length);
        =
connection.setRequestProperty("SOAPAction","\"http://tempuri.org/Upload_C=
ust_Appointment\"");
        OutputStream os =3D connection.openOutputStream ();
        os.write (data);
//        os.write (xmlData.getBytes());
        os.flush ();
        os.close ();

=20

        InputStream is=3D((StreamConnection) connection).openInputStream =
();
        int buffSize=3D200;
        byte[] buff =3D new byte[buffSize];
        ByteArrayOutputStream bytebuff =3D new =
ByteArrayOutputStream(buffSize);
        int eof=3D0;
        while(eof!=3D-1) {
          eof=3Dis.read(buff);
          if (eof!=3D-1) {
            bytebuff.write(buff,0,eof);
          }
        }
        is.close();

=20

        String response =3D new String(bytebuff.toByteArray());
        System.out.println (response);

=20

        connection =3D (HttpConnection) Connector.open
        =
("http://MMSServer/SyncSvr/SyncSvrObj.asmx",Connector.READ_WRITE);
        connection.setRequestMethod (HttpConnection.POST);
        connection.setRequestProperty ("Content-Type", "text/xml");
        connection.setRequestProperty ("Connection", "close");
        connection.setRequestProperty ("Content-Length", "" + =
xmlData.length());
        =
connection.setRequestProperty("SOAPAction","\"http://tempuri.org/Upload_C=
ust_Appointment\"");
        os =3D connection.openOutputStream ();

=20

        os.write (xmlData.getBytes());
        os.flush ();

=20

        int datum;
        long byteCount;
        StringBuffer buffer =3D new StringBuffer();
        is=3D((StreamConnection) connection).openInputStream ();

=20

        for(byteCount =3D 0; (datum=3Dis.read()) > 0; byteCount++) {
          buffer.append((char)datum);
        }

=20

        os.close ();

=20

        =
System.out.println("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3Dbuff=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D");
        System.out.println("Buffer:" + buffer.toString());
        =
System.out.println("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D");
      }
      catch (Exception e) {
        resultItem.setLabel ("Error:");
        resultItem.setText (e.toString ());
      }
    }
  }

=20

  private static byte[] extractXml(byte[] extractFrom){
    byte[] result;
    int off=3D0;
    boolean nonStop=3Dtrue;
    for(int i=3D0;nonStop;i++){
      if (extractFrom[i]=3D=3D60) {
        off=3Di;
        nonStop=3Dfalse;
      }
    }

=20

    result=3Dnew byte[extractFrom.length -off];
    for(int i=3Doff;i<extractFrom.length;i++){
      result[i-off]=3DextractFrom[i];
    }
    return result;
  }
}

=20

Any help would be appreciated.

=20

Thanks in advance

=20

Bhanu


------=_NextPart_000_0017_01C329FE.DD8DDE00
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Hi,</SPAN><SPAN=20
style=3D"FONT-FAMILY: 'Arial Unicode MS'"><?xml:namespace prefix =3D o =
ns =3D=20
"urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">I am new to J2ME, just =
started=20
working on a project where my J2ME application&nbsp;needs=20
to&nbsp;receive/send&nbsp;data to .NET web service. I have written a =
sample code=20
to test the service. I was able to get the data from the server.=20
</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Now, my question here=20
is:</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><STRONG><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">1. How do I parse and get =
the data=20
from the response I got from the server since it contains lot of=20
things?</SPAN></STRONG><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><STRONG><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;</SPAN></STRONG>=20
<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><STRONG><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">2. I have this=20
XML</SPAN></STRONG><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&lt;Cust_Appointment&gt;&lt;Record&gt;&lt;Internal_Cust_Id&gt;1&lt=
;/Internal_Cust_Id&gt;&lt;Appointment_Type&gt;1&lt;/Appointment_Type&gt;&=
lt;Appointment_Date&gt;5-June-2003&lt;/Appointment_Date&gt;&lt;User_Id&gt=
;1&lt;/User_Id&gt;&lt;Description&gt;&lt;![CDATA[Mobile=20
Demo]]&gt;&lt;/Description&gt;&lt;Active_Date&gt;5-June-2002&lt;/Active_D=
ate&gt;&lt;Inactive_Date&gt;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">5-June-2004&lt;/Inactive_Date&gt;&lt;/Record&gt;&lt;/Cust_Appointm=
ent&gt;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><STRONG><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">How do I send it to the =
Server?? I=20
was able to connect to the server but it&nbsp;returned a Fault as=20
below:</SPAN></STRONG><SPAN=20
style=3D"FONT-FAMILY: 'Arial Unicode MS'; mso-fareast-font-family: =
'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Buffer:&lt;?xml =
version=3D"1.0"=20
encoding=3D"utf-8"?&gt;</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">&lt;soap:Envelope =
xmlns:soap=3D"<A=20
href=3D"http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap=
.org/soap/envelope/</A>"&gt;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;=20
&lt;soap:Body&gt;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;&nbsp;&nbsp;=20
&lt;soap:Fault&gt;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;faultcode&gt;soap:Client&lt;/faultcode&gt;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;faultstring&gt;Server was unable to read request. --&amp;gt; The=20
&amp;amp;lt;Cust_Appointment&amp;amp;gt; tag from namespace&nbsp; is =
expected.=20
Line 1, position 2.&lt;/faultstring&gt;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;detail /&gt;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;&nbsp;&nbsp;=20
&lt;/soap:Fault&gt;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;=20
&lt;/soap:Body&gt;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&lt;/soap:Envelope&gt;</SPAN><SPAN=20
style=3D"FONT-FAMILY: 'Arial Unicode MS'; mso-fareast-font-family: =
'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><STRONG><I><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Here is the sample I am =
using right=20
now for reading/sending data from/to the=20
server:</SPAN></I></STRONG><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">package=20
soaptest;</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">import =
java.io.*;<BR>import=20
javax.microedition.midlet.*;<BR>import =
javax.microedition.lcdui.*;<BR>import=20
javax.microedition.io.*;</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">import =
org.ksoap.*;<BR>import=20
org.kxml.*;<BR>import org.kxml.io.*;<BR>import=20
org.kxml.parser.*;</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">public class clsHTTP =
extends Form=20
implements CommandListener {</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">//&nbsp; static final =
String=20
serviceNamespace =3D "<A=20
href=3D"http://pocketdba.com/webservices/">http://pocketdba.com/webservic=
es/</A>";<BR>&nbsp;=20
static final String serviceNamespace =3D "<A=20
href=3D"http://tempuri.org/">http://tempuri.org/</A>";<BR>&nbsp; static =
final=20
String=20
xmlData=3D"&lt;Cust_Appointment&gt;&lt;Record&gt;&lt;Internal_Cust_Id&gt;=
1&lt;/Internal_Cust_Id&gt;&lt;Appointment_Type&gt;1&lt;/Appointment_Type&=
gt;&lt;Appointment_Date&gt;5-June-2003&lt;/Appointment_Date&gt;&lt;User_I=
d&gt;1&lt;/User_Id&gt;&lt;Description&gt;&lt;![CDATA[Mobile=20
Demo]]&gt;&lt;/Description&gt;&lt;Active_Date&gt;5-June-2002&lt;/Active_D=
ate&gt;&lt;Inactive_Date&gt;5-June-2004&lt;/Inactive_Date&gt;&lt;/Record&=
gt;&lt;/Cust_Appointment&gt;";<BR>&nbsp;=20
TextField fromField =3D new TextField ("UserName :", "ss", 4,=20
TextField.ANY);<BR>&nbsp; StringItem resultItem =3D new StringItem ("",=20
"");<BR>&nbsp; Command getCommand =3D new Command ("Get", =
Command.SCREEN,=20
1);<BR>&nbsp; Command sendCommand =3D new Command ("Send", =
Command.SCREEN,=20
2);</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp; public clsHTTP()=20
{<BR>&nbsp;&nbsp;&nbsp; super("Get Data");</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;&nbsp;&nbsp; append=20
(fromField);<BR>&nbsp;&nbsp;&nbsp; append =
(resultItem);<BR>&nbsp;&nbsp;&nbsp;=20
addCommand (getCommand);<BR>&nbsp;&nbsp;&nbsp; addCommand=20
(sendCommand);</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;&nbsp;&nbsp;=20
setCommandListener (this);<BR>&nbsp; }</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp; public void =
commandAction=20
(Command c, Displayable d) {<BR>&nbsp;&nbsp;&nbsp;=20
if(c.getLabel()=3D=3D"Get"){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String from =3D=20
fromField.getString ();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
ByteArrayOutputStream bos =3D new ByteArrayOutputStream=20
();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SoapObject request =3D =
new=20
SoapObject (serviceNamespace,=20
"DownloadAppointmentConfig");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
request.addProperty ("uName", fromField.getString =
());</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
ClassMap classMap =3D new=20
ClassMap();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
classMap.prefixMap =3D=20
new PrefixMap(classMap.prefixMap, "tns", "<A=20
href=3D"http://tempuri.org/">http://tempuri.org/</A>");<BR>&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
SoapEnvelope envelope =3D new SoapEnvelope=20
(classMap);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
envelope.setBody=20
(request);</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
XmlWriter xw =3D new XmlWriter (new OutputStreamWriter=20
(bos));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; envelope.write=20
(xw);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xw.flush=20
();</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
byte [] data =3D =
bos.toByteArray();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
// System.out.println (new String (data));</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
HttpConnection connection =3D (HttpConnection)=20
Connector.open<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ("<A=20
href=3D"http://mmsserver/SyncSvr/SyncSvrObj.asmx"><FONT=20
color=3D#0000ff>http://MMSServer/SyncSvr/SyncSvrObj.asmx",Connector.READ_=
WRITE</FONT></A>);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
connection.setRequestMethod=20
(HttpConnection.POST);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
connection.setRequestProperty ("Content-Type",=20
"text/xml");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
connection.setRequestProperty ("Connection",=20
"close");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
connection.setRequestProperty ("Content-Length",=20
""+data.length);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
connection.setRequestProperty("SOAPAction","\"<A=20
href=3D"http://tempuri.org/DownloadAppointmentConfig/">http://tempuri.org=
/DownloadAppointmentConfig\</A>"");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;=20
OutputStream os =3D connection.openOutputStream=20
();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; os.write=20
(data);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; os.flush=20
();</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
InputStream is=3D((StreamConnection) connection).openInputStream=20
();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int=20
buffSize=3D200;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte[] =
buff =3D new=20
byte[buffSize];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
ByteArrayOutputStream bytebuff=3Dnew=20
ByteArrayOutputStream(buffSize);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;=20
int eof=3D0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
while(eof!=3D-1)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
eof=3Dis.read(buff);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; if=20
(eof!=3D-1)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
bytebuff.write(buff,0,eof);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
is.close();</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
String response =3D new=20
String(bytebuff.toByteArray());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;=20
System.out.println (response);</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
Reader reader =3D new=20
InputStreamReader(new<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
ByteArrayInputStream(bytebuff.toByteArray()));<BR>&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;=20
XmlParser parser =3D new XmlParser=20
(reader);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SoapEnvelope=20
resultEnvelope =3D new SoapEnvelope=20
();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resultEnvelope.parse=20
(parser);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
resultItem.setLabel=20
("amount :");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String =
result =3D=20
(String)resultEnvelope.getResult();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;=20
result =3D=20
result.substring(0,result.indexOf(".")+3);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;=20
resultItem.setText (" =
"+result);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
reader.close ();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
*/<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; connection.close=20
();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; os.close=20
();</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (Exception e)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resultItem.setLabel=20
("Error:");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
resultItem.setText=20
(e.toString ());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
}<BR>&nbsp;&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp; else{</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*=20
Sending data to SERVER*/</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String from =3D=20
fromField.getString ();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
ByteArrayOutputStream bos =3D new ByteArrayOutputStream=20
();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SoapObject request =3D =
new=20
SoapObject (serviceNamespace,=20
"Upload_Cust_Appointment");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
=20
request.addProperty ("uName", fromField.getString=20
());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; request.addProperty=20
("fileName", "Cust_Appointment");</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
ClassMap classMap =3D new=20
ClassMap();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
classMap.prefixMap =3D=20
new PrefixMap(classMap.prefixMap, "tns", "<A=20
href=3D"http://tempuri.org/">http://tempuri.org/</A>");<BR>&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
SoapEnvelope envelope =3D new SoapEnvelope=20
(classMap);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
envelope.setBody=20
(request);</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
XmlWriter xw =3D new XmlWriter (new OutputStreamWriter=20
(bos));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; envelope.write=20
(xw);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xw.flush=20
();</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
byte [] data =3D bos.toByteArray();</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial"><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
HttpConnection connection =3D (HttpConnection)=20
Connector.open<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ("<A=20
href=3D"http://mmsserver/SyncSvr/SyncSvrObj.asmx"><FONT=20
color=3D#0000ff>http://MMSServer/SyncSvr/SyncSvrObj.asmx",Connector.READ_=
WRITE</FONT></A>);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
connection.setRequestMethod=20
(HttpConnection.POST);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
connection.setRequestProperty ("Content-Type",=20
"text/xml");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
connection.setRequestProperty ("Connection",=20
"close");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
connection.setRequestProperty ("Content-Length", "" +=20
data.length);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
connection.setRequestProperty("SOAPAction","\"<A=20
href=3D"http://tempuri.org/Upload_Cust_Appointment/">http://tempuri.org/U=
pload_Cust_Appointment\</A>"");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;=20
OutputStream os =3D connection.openOutputStream=20
();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; os.write=20
(data);<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; os.write=20
(xmlData.getBytes());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
os.flush=20
();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; os.close=20
();<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
InputStream is=3D((StreamConnection) connection).openInputStream=20
();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int=20
buffSize=3D200;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte[] =
buff =3D new=20
byte[buffSize];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
ByteArrayOutputStream bytebuff =3D new=20
ByteArrayOutputStream(buffSize);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;=20
int eof=3D0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
while(eof!=3D-1)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
eof=3Dis.read(buff);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; if=20
(eof!=3D-1)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
bytebuff.write(buff,0,eof);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
is.close();<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
String response =3D new=20
String(bytebuff.toByteArray());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;=20
System.out.println (response);<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
connection =3D (HttpConnection)=20
Connector.open<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ("<A=20
href=3D"http://mmsserver/SyncSvr/SyncSvrObj.asmx"><FONT=20
color=3D#0000ff>http://MMSServer/SyncSvr/SyncSvrObj.asmx",Connector.READ_=
WRITE</FONT></A>);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
connection.setRequestMethod=20
(HttpConnection.POST);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
connection.setRequestProperty ("Content-Type",=20
"text/xml");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
connection.setRequestProperty ("Connection",=20
"close");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
connection.setRequestProperty ("Content-Length", "" +=20
xmlData.length());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
connection.setRequestProperty("SOAPAction","\"<A=20
href=3D"http://tempuri.org/Upload_Cust_Appointment/">http://tempuri.org/U=
pload_Cust_Appointment\</A>"");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;=20
os =3D connection.openOutputStream ();<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
os.write =
(xmlData.getBytes());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
os.flush ();<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
int datum;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long=20
byteCount;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StringBuffer =
buffer =3D=20
new StringBuffer();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
is=3D((StreamConnection) connection).openInputStream =
();<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
for(byteCount =3D 0; (datum=3Dis.read()) &gt; 0; byteCount++)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
buffer.append((char)datum);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
=20
}<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
os.close ();<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
System.out.println("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3Dbuff=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D");<BR>&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
System.out.println("Buffer:" +=20
buffer.toString());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
System.out.println("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D");<BR>&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (Exception e)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resultItem.setLabel=20
("Error:");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
resultItem.setText=20
(e.toString ());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
}<BR>&nbsp;&nbsp;&nbsp;=20
}<BR>&nbsp; }<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp; private static =
byte[]=20
extractXml(byte[] extractFrom){<BR>&nbsp;&nbsp;&nbsp; byte[]=20
result;<BR>&nbsp;&nbsp;&nbsp; int off=3D0;<BR>&nbsp;&nbsp;&nbsp; boolean =

nonStop=3Dtrue;<BR>&nbsp;&nbsp;&nbsp; for(int=20
i=3D0;nonStop;i++){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if =
(extractFrom[i]=3D=3D60)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
off=3Di;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
nonStop=3Dfalse;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
}<BR>&nbsp;&nbsp;&nbsp;=20
}<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;&nbsp;&nbsp; =
result=3Dnew=20
byte[extractFrom.length -off];<BR>&nbsp;&nbsp;&nbsp; for(int=20
i=3Doff;i&lt;extractFrom.length;i++){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
result[i-off]=3DextractFrom[i];<BR>&nbsp;&nbsp;&nbsp; =
}<BR>&nbsp;&nbsp;&nbsp;=20
return result;<BR>&nbsp; }<BR>}</SPAN><SPAN=20
style=3D"FONT-FAMILY: 'Arial Unicode MS'; mso-fareast-font-family: =
'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">&nbsp;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Any help would be=20
appreciated.<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Thanks in=20
advance<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Arial">Bhanu</SPAN></P></DIV></BODY></HTML>

------=_NextPart_000_0017_01C329FE.DD8DDE00--