Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/199.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用soap通过web服务将android应用程序连接到mysql_Android_Mysql_Asp.net_Web Services_Ksoap - Fatal编程技术网

使用soap通过web服务将android应用程序连接到mysql

使用soap通过web服务将android应用程序连接到mysql,android,mysql,asp.net,web-services,ksoap,Android,Mysql,Asp.net,Web Services,Ksoap,我正在创建一个应用程序来下订单。我已经创建了web服务,它是: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; namespace myservice { /// <summary> /// Summary description for Service1 /// </summa

我正在创建一个应用程序来下订单。我已经创建了web服务,它是:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace myservice
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }
        [WebMethod]
        public void order()
        {
            string fname, lname, email, shippingno, city, product, price;

        }
    }
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用System.Web;
使用System.Web.Services;
命名空间myservice
{
/// 
///服务1的摘要说明
/// 
[WebService(命名空间=”http://tempuri.org/")]
[WebServiceBinding(ConformsTo=WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
//要允许使用ASP.NET AJAX从脚本调用此Web服务,请取消注释以下行。
//[System.Web.Script.Services.ScriptService]
公共类服务1:System.Web.Services.WebService
{
[网络方法]
公共字符串HelloWorld()
{
返回“你好世界”;
}
[网络方法]
公共秩序
{
字符串fname、lname、email、发货号、城市、产品、价格;
}
}
}
但我不知道如何在web方法中输入值

这是我的mainActivity.java:

package com.example.orderform;
导入org.ksoap2.serialization.PropertyInfo;
导入org.ksoap2.serialization.SoapObject;
导入android.app.Activity;
导入android.os.AsyncTask;
导入android.os.Bundle;
导入android.util.Log;
导入android.view.Menu;
导入android.view.MenuItem;
导入android.view.view;
导入android.widget.Button;
导入android.widget.EditText;
导入android.widget.TextView;
导入android.view.view.OnClickListener;
公共类MainActivity扩展了活动{
私有最终字符串命名空间=”http://tempuri.org";
私有最终字符串URL=”http://10.0.2.2/websd/Service1.asmx";
私有最终字符串SOAP_ACTION=”http://tempuri.org/HelloWorld";
私有最终字符串方法\u NAME=“HelloWorld”;
私有字符串TAG=“PGGURU”;
私有静态字符串fname;
私有静态字符串lname;
私有静态字符串电子邮件;
私有静态字符串shippingno;
私人静态字符串城市;
私有静态字符串产品;
私有静态字符串价格;
文本视图显示;
编辑文本e1、e2、e3、e4、e5、e6、e7;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
e1=(EditText)findViewById(R.id.editText1);
e2=(EditText)findViewById(R.id.editText2);
e3=(EditText)findViewById(R.id.editText3);
e4=(EditText)findViewById(R.id.editText4);
e5=(EditText)findViewById(R.id.editText5);
e6=(EditText)findViewById(R.id.editText6);
e7=(EditText)findViewById(R.id.editText7);
按钮b1=(按钮)findViewById(R.id.button1);
b1.setOnClickListener(新的OnClickListener(){
公共void onClick(视图v){
//TODO自动生成的方法存根
AsyncCallWS任务=新建AsyncCallWS();
//调用执行
task.execute();
}
});
}
public void adddata(){
SoapObject请求=新的SoapObject(名称空间、方法名称);
//保存输入参数的属性
PropertyInfo a1=新的PropertyInfo();
//设置名称
a1.设定名称(“名字”);
//设定值
a1.设定值(e1);
//设置数据类型
a1.setType(String.class);
//将属性添加到请求对象
请求。添加属性(a1);
}
私有类AsyncCallWS扩展了AsyncTask{
@凌驾
受保护的Void doInBackground(字符串…参数){
Log.i(标签“doInBackground”);
HelloWorld();
返回null;
}
@凌驾
受保护的void onPostExecute(void结果){
Log.i(标记“onPostExecute”);
}
@凌驾
受保护的void onPreExecute(){
Log.i(标记“onPreExecute”);
}
@凌驾
受保护的void onProgressUpdate(void…值){
Log.i(标记“onProgressUpdate”);
}
}
@凌驾
公共布尔onCreateOptions菜单(菜单){
//为菜单充气;这会将项目添加到操作栏(如果存在)。
getMenuInflater().充气(R.menu.main,menu);
返回true;
}
@凌驾
公共布尔值onOptionsItemSelected(菜单项项){
//处理操作栏项目单击此处。操作栏将
//自动处理Home/Up按钮上的点击,只要
//在AndroidManifest.xml中指定父活动时。
int id=item.getItemId();
if(id==R.id.action\u设置){
返回true;
}
返回super.onOptionsItemSelected(项目);
}
}
这是我的布局


这是我的清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.orderform"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="15"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

我想知道我的数据将如何进入webservice,然后进入数据库。帮助我或给我发送一个最佳教程链接。等待你的帮助 谢谢