从应用程序中使用KSOAP方法Web服务临危空参数 [英] Web service recieves null parameters from application using ksoap method

查看:139
本文介绍了从应用程序中使用KSOAP方法Web服务临危空参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过的话题讨论这一点,但没有人似乎已发布的解决方案。目前,我测试的参数传递到我的.NET Web服务。当参数达到Web服务将其添加一个额外的字符串,然后返回它太我的应用程序;但所有我是返回字符串信息,而不是我传递的​​参数。是不是有什么毛病我的网络服务或我的肥皂的方法?

香皂:

  

SoapObject请求=新SoapObject(命名空间METHOD_NAME);

  request.addProperty(A,workowr);


    SoapSerializationEnvelope信封=
        新SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = TRUE;
        envelope.setOutputSoapObject(要求);
        HttpTransportSE androidHttpTransport =新HttpTransportSE(URL);
        尝试 {
            androidHttpTransport.call(SOAP_ACTION,包);
            SoapPrimitive结果=(SoapPrimitive)envelope.getResponse();
            // SoapObject结果=(SoapObject)envelope.getResponse();
            串resultData = result.toString();
            testTV.setText(resultData);

        }
        赶上(例外五)
        {
            testTV.setText(e.getMessage());
        }
 

下面是我简单的.NET Web服务:

  

公共功能getRegInfo(一BYVAL作为字符串)作为字符串

     

返回A +字符串消息

     

端功能

我会AP preciate任何帮助。

解决方案

什么工作对我来说是改变我的两个.NET Web服务上,在我的应用程序的命名空间网址。

例如,我有:

http://www.example.com/webservices/

我更改为:

example.com/webservices /

和它的工作完美。

试试看。

I've seen topics discussing this but no one has seemed to post a solution. At the moment, I'm testing passing parameters to my .Net web service. When the parameters reach the web service it adds it with an additional string then returns it too my application; but all I'm returning is the string message, not the parameter I passed. Is there something wrong with my web service or my soap method?

Soap:

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

    request.addProperty("A", "workowr");


    SoapSerializationEnvelope envelope =
        new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(request);
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);    
        try {
            androidHttpTransport.call(SOAP_ACTION, envelope);
            SoapPrimitive result = (SoapPrimitive) envelope.getResponse();
            //SoapObject result = (SoapObject)envelope.getResponse();       
            String resultData = result.toString();
            testTV.setText(resultData);

        }
        catch(Exception e)
        {
            testTV.setText(e.getMessage());
        }

Here is my simple .Net web service:

Public Function getRegInfo(ByVal A As String) As String

Return A + "String message"

End Function

I would appreciate any help.

解决方案

What worked for me was changing the namespace URL in both my .Net webservice and in my application.

For example, I had:

"http://www.example.com/webservices/"

i changed to:

"example.com/webservices/"

and it worked perfectly.

Give it a shot.

这篇关于从应用程序中使用KSOAP方法Web服务临危空参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆