Ksoap 设置属性类型

发布于 2024-11-27 07:16:54 字数 494 浏览 2 评论 0原文

当向肥皂对象添加属性时无法指定它的类型...我需要整数,但它总是将其设置为“d:string”1312191347< ;/timestamp> 这是我添加属性的方式:

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));

任何人都可以帮忙吗?

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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

雄赳赳气昂昂 2024-12-04 07:16:54

您将其与 String.valueOf ... 添加它,这是一个字符串,因此 ksoap 正在做正确的事情。

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

ぇ气 2024-12-04 07:16:54

这可能会帮助你...

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);

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);

冷夜 2024-12-04 07:16:54

试试这个:

  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);

直到我将用户名和密码替换为 arg0 和 arg1 之前,这不起作用

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文