Android的WSDL SOAP请求格式 [英] wsdl Soap request format for android

查看:435
本文介绍了Android的WSDL SOAP请求格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用ksoap2从Android的访问Web服务。 SOAP请求从我的Andr​​oid模拟器送就好了,

I am trying to access web services from Android using ksoap2. Soap request send from my android emulator is like,

<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
<v:Header />
<v:Body>
<Login xmlns="http://xxx.com/" id="o0" c:root="1">
<MyLoginCredentials i:type="d:anyType">
<Email i:type="d:string">asdf@asd.com</Email>
<Password i:type="d:string">asdf</Password>
</MyLoginCredentials>
</Login>
</v:Body>
</v:Envelope>

但形成了SoapUI,一个成功的登录请求是什么样子,

but form SoapUI, a successful login request is like,

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:str="http://xxx.com/">
    <soapenv:Header/>
    <soapenv:Body>
        <str:Login>
    <str:MyLoginCredentials>

        <str:Email>asdf@asd.com</str:Email>
        <str:Password>asdf</str:Password>
    </str:MyLoginCredentials>
</str:Login>
    </soapenv:Body>
</soapenv:Envelope>

这是我的Andr​​oid code部分:

here is my android code section:

        String NAMESPACE = "http://xxx.com/";
        String METHOD_NAME = "Login";
        String SOAP_ACTION = "http://xxx.com/Login";
        String URL = "http://xxx.tk/service.asmx?wsdl";

        Object results;

        System.setProperty("http.keepAlive", "false");

        SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);


        Request.addProperty("MyLoginCredentials", myLoginCredentials);

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(Request);

        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
        androidHttpTransport.debug = true; 

        String Str = null;
        try
        {
            androidHttpTransport.call(SOAP_ACTION, envelope);
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

请帮我解决这个问题。谢谢..

Please help me to solve the issue. Thanks..

推荐答案

请参考以下链接可能对你有用。

Refer below link may be useful for you.

http://$c$concloud.blogspot.in/2012/04/android-web-service-access-tutorial.html

http://$c$concloud.blogspot.in/2012/04/android-403-webservice-access-tutorial.html

http://www.$c$cproject.com/Articles/112381/Step-by-Step-Method-to-Access-Webservice-from-Andr

这篇关于Android的WSDL SOAP请求格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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