BurunduK
BurunduK

Reputation: 293

Ksoap set property type

when adding a property to an soap object can't specify it's type .... I need integer but it always sets it to "d:string" <timestamp i:type="d:string">1312191347</timestamp> here is the way I add the proprety:

SoapObject _client = new SoapObject("urn:PopfaxService", "PopfaxService.getModifiedObjects");
        PropertyInfo UIDInfo = new PropertyInfo ();

        UIDInfo.name = "timestamp";

        UIDInfo.type = PropertyInfo.INTEGER_CLASS;
        _client.addProperty(UIDInfo,String.valueOf(timestamp));

can anyone help ?

Upvotes: 2

Views: 2725

Answers (3)

user2982332
user2982332

Reputation:

Try this:

  PropertyInfo pi1 = new PropertyInfo();
                 pi1.setName("arg0");
                 pi1.setValue("username");
                 pi1.setType(String.class);
                 request.addProperty(pi1);

                 PropertyInfo pi2 = new PropertyInfo();
                 pi2.setName("arg1");
                 pi2.setValue("password");
                 pi2.setType(String.class);
                 request.addProperty(pi2);

until I'm replaced username and password to arg0 and arg1, this dont work

Upvotes: 1

sagar
sagar

Reputation: 161

This may help you...

public String call(String a,String b)
{

    SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);
    PropertyInfo pi=new PropertyInfo();

    pi.setName("username");
    pi.setValue(a);
    pi.setType(a.getClass());
    request.addProperty(pi);

    pi=new PropertyInfo();
    pi.setName("password");
    pi.setValue(b);
    pi.setType(b.getClass());
    request.addProperty(pi);

Upvotes: 2

Manfred Moser
Manfred Moser

Reputation: 29912

You are adding it with String.valueOf ... which is a string, so ksoap is doing the right thing.

Upvotes: 3

Related Questions