Click here to Skip to main content
15,902,835 members
Home / Discussions / Mobile
   

Mobile

 
QuestionA problem about create virtual shared folder in pocket pc vs 2005 Pin
nvphap18-May-09 22:40
nvphap18-May-09 22:40 
QuestionJava code executing on mobile, sent as SMS Pin
de.w18-May-09 19:07
de.w18-May-09 19:07 
Questionconvertion of xls file into csv file. Pin
ujjawal kumar18-May-09 18:35
ujjawal kumar18-May-09 18:35 
QuestionDisplaying bitmap and SetDIBitsToDevice..... Pin
Episodio118-May-09 14:22
Episodio118-May-09 14:22 
AnswerRe: Displaying bitmap and SetDIBitsToDevice..... Pin
slumberparty19-May-09 2:15
slumberparty19-May-09 2:15 
GeneralNope... same happens... Pin
Episodio119-May-09 7:39
Episodio119-May-09 7:39 
GeneralFIXED.SetDIBitstoDevice was causing problems. Pin
Episodio120-May-09 6:59
Episodio120-May-09 6:59 
QuestionKsoap2 - how to send byte[] present in custom class Pin
gittu12318-May-09 0:59
gittu12318-May-09 0:59 
Hi




I have following issues while working with KSOAP2.

I don’t know whether I am posting my query at correct location or not





I have a Web service written in JAVA, developed using Netbeanns 6.5 deployed on Jboss5.0

I have a J2ME client which gives a call to WS using KSOAP

I want to do following things:



send byte[] which is part of custom VO
Handle exceptions sent from server


How do I send the byte array



I read the things on http://ksoap.objectweb.org/project/faq/index.html

But I don’t know how to use it


 private void callWS1() throws IOException, XmlPullParserException {

        String endPointURL = new String("http://172.16.3.184:8080/CitiBankOnline/LoginService");

        String nameSpace = new String("http://service.partner.com/");

        SoapObject method = new SoapObject(nameSpace, "getDevice1");

        DeviceCurrentActivityVO oDcavo = new DeviceCurrentActivityVO();

        KeySet oKeySet = new KeySet();

        byte[] oBytesArr=new byte[]{(byte)0x01,(byte)0x01,(byte)0x01,(byte)0x01};

        String bytes = Base64.encode(oBytesArr);

        SoapPrimitive oPrimitive = new SoapPrimitive (SoapEnvelope.ENC, "base64", bytes);

        String szbytes = oPrimitive.toString();

        oDcavo.setProperty("id", new Integer(12));

        oDcavo.setProperty("name", "geetanjali");

        oDcavo.setProperty("encKey", bytes);

        oDcavo.setProperty("keySet", oKeySet);

        method.addProperty("param", oDcavo);

        oForm.append("Created soap object");

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

        envelope.bodyOut = method;

        envelope.setOutputSoapObject(method);

        new MarshalBase64().register(envelope);

        HttpTransport ht = new HttpTransport(endPointURL);

        oForm.append("Created transport");

        ht.call("", envelope);

        oForm.append("Called transport");

 

        SoapObject soapResult = (SoapObject) envelope.getResponse();

        int totalProperty = soapResult.getPropertyCount();

        oForm.append("\nid = " + soapResult.getProperty(0).toString() + "\n");

        oForm.append("\nPriority                    = " + soapResult.getProperty(1).toString() + "\n");

        SoapObject oString = (SoapObject) soapResult.getProperty(2);

        Object s = oString.getProperty("version");

        oForm.append("version          = " + s.toString() + "\n");

        oForm.append("id          = " + oString.getProperty("id").toString() + "\n");

         String szBytes = oString.getProperty("encKey").toString();

         byte[] oBytes1=  Base64.decode(szBytes);

         oForm.append("ENc Key         = " +oBytes1[0]+ "\n");

 

        Display.getDisplay(this).setCurrent(oForm);

    }

 

And Vo luks like

 

public class DeviceCurrentActivityVO extends SampleVO {

    //public static Class EVENT_CLASS = new Event().getClass();

 

    private int id;

    private String name;

    public Vector oVector = new Vector();

    KeySet keySet = new KeySet();

    byte[] oBytes = null;

    public byte[] encKey;

 

    public Object getProperty(int index) {

        switch (index) {

            case 0:

                return new Integer(id);

            case 1:

                return name;

            case 2:

                return keySet;

            case 3:

                return encKey;

            default:

                return null;

        }

    }

 

    public int getPropertyCount() {

        return 4;

    }

 

    public void getPropertyInfo(int index, Hashtable properties, PropertyInfo info) {

        switch (index) {

            case 0:

                info.name = "id";

                info.type = PropertyInfo.INTEGER_CLASS;

                break;

            case 1:

                info.name = "name";

                info.type = PropertyInfo.STRING_CLASS;

                break;

            case 2:

                info.name = "keySet";

                info.type = PropertyInfo.OBJECT_CLASS;

                break;

            case 3:

                 info.name = "encKey";

                 info.type =  new byte[0].getClass();

                break;

            default:

                break;

        }

    }

 

    public void setProperty(String name, Object value) {

 

        {

            if (name.equals("name")) {

                setProperty(1, value);

            } else if (name.equals("id")) {

                setProperty(0, value);

            }

            else if (name.equals("keySet")) {

                setProperty(2, value);

            }

             else if (name.equals("encKey")) {

                setProperty(2, value);

            }

 

        }

 

    }

 

    public void setProperty(int index, Object value) {

        switch (index) {

            case 0:

                id = ((Integer) value).intValue();

                break;

            case 1:

                name = ((String) value).toString();

                break;

            case 2:

                keySet = (KeySet) value;

          case 3:

              

                 encKey = (byte[]) value;

            default:

                break;

        }

    }

}

 

 

public abstract class SampleVO  implements KvmSerializable  {

    public static final String NAMESPACE = "http://172.16.3.184:8080/CitiBankOnline/LoginService";

    public SampleVO() {

        super();

    }

}


Regards,
Geetanjali
QuestionA problem when I show help file in pocketpc Pin
nvphap17-May-09 22:03
nvphap17-May-09 22:03 
QuestionHow to get thread's handle in mobile 6.1 , Not the current thread's handle. Pin
torinoyuan17-May-09 21:53
torinoyuan17-May-09 21:53 
QuestionA problem about show help file in pocket pc Pin
nvphap17-May-09 6:45
nvphap17-May-09 6:45 
AnswerRe: A problem about show help file in pocket pc Pin
Joel Ivory Johnson17-May-09 10:28
professionalJoel Ivory Johnson17-May-09 10:28 
GeneralRe: A problem about show help file in pocket pc Pin
nvphap17-May-09 19:21
nvphap17-May-09 19:21 
GeneralRe: A problem about show help file in pocket pc Pin
Joel Ivory Johnson18-May-09 12:28
professionalJoel Ivory Johnson18-May-09 12:28 
QuestionHow to use Datagrid in Right-to-left (Like Hebrew or Arabic language) Pin
E_Gold16-May-09 0:23
E_Gold16-May-09 0:23 
QuestionHow to send SMS to multiple recipients? Pin
Zeng_Zeng15-May-09 1:55
Zeng_Zeng15-May-09 1:55 
AnswerRe: How to send SMS to multiple recipients? Pin
Joel Ivory Johnson17-May-09 10:25
professionalJoel Ivory Johnson17-May-09 10:25 
GeneralRe: How to send SMS to multiple recipients? Pin
Zeng_Zeng17-May-09 16:23
Zeng_Zeng17-May-09 16:23 
AnswerRe: How to send SMS to multiple recipients? Pin
Jabbar_espania18-May-09 23:10
Jabbar_espania18-May-09 23:10 
QuestionSound emission with duration and frequency control Pin
slugger66613-May-09 6:59
slugger66613-May-09 6:59 
AnswerRe: Sound emission with duration and frequency control Pin
Joel Ivory Johnson14-May-09 6:41
professionalJoel Ivory Johnson14-May-09 6:41 
QuestionTimer Control do not have Start and Stop methods. Pin
sunit_8213-May-09 3:06
sunit_8213-May-09 3:06 
AnswerRe: Timer Control do not have Start and Stop methods. Pin
PavanPareta13-May-09 8:19
PavanPareta13-May-09 8:19 
AnswerRe: Timer Control do not have Start and Stop methods. Pin
yrishi14-May-09 1:15
yrishi14-May-09 1:15 
QuestionHow to read .xls file(Excel Mobile) in WM? Pin
ujjawal kumar12-May-09 2:32
ujjawal kumar12-May-09 2:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.