android - connect to web service
<p>I'm try to connect android application to a web service uploaded on somee.</p>

<p>I have the following problem :</p>

<p>FATAL EXCEPTION: main
                                                                                 java.lang.RuntimeException: Unable to start activity ComponentInfo: java.lang.NullPointerException</p>

<p><strong>the web service code :</strong></p>

<pre><code>[WebService(Namespace = "http://www.n-m.somee.com/")]
[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 WebService1 : System.Web.Services.WebService
{
    SqlConnection con = new SqlConnection(@"workstation id=WSDatabase.mssql.somee.com;packet size=4096;user id=***;pwd=***;data source=WSDatabase.mssql.somee.com;persist security info=False;initial catalog=WSDatabase ");
    [WebMethod]
    public string get_name(String pssw)
    {
        con.Open();
        SqlCommand cmd = new SqlCommand("select username from users where pssw="+pssw, con);
        string rd =(string) cmd.ExecuteScalar();

        con.Close();
        return rd;
    }
}
</code></pre>

<p><strong>I added the following line to manifest file:</strong>
    </p>

<p>**  MainActivity.java file**</p>

<pre><code>public class MainActivity extends AppCompatActivity {

protected String namespace="http://www.n-m.somee.com/";
protected String url="http://www.n-m.somee.com/WebService1.asmx";
protected String SOAPAction="http://www.n-m.somee.com/get_name";
protected String method_name= "get_name";

TextView user_name;
@SuppressLint("NewApi")

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
}


public void goButton(View v)
{
    user_name=(TextView)findViewById(R.id.textView1);
    //allow internet
    if(Build.VERSION.SDK_INT&gt;9)
    {
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
    }

    //create soap object
    SoapObject soapObject=new SoapObject(namespace,method_name);
    soapObject.addProperty("pssw", "1234");

    //create envelop
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(soapObject);

    //Rrquest get data from webservice and set it into soapobject

    HttpTransportSE transport = new HttpTransportSE(url);

    try {
        transport.call(SOAPAction, envelope);

        // get data
        SoapPrimitive output=(SoapPrimitive) envelope.getResponse();
        //set data into control
        user_name.setText("pssw: "+output.toString());

    } catch (IOException e) {
        e.printStackTrace();
     } catch (XmlPullParserException e) {
        e.printStackTrace();
    }

}
}
</code></pre>

<p>I appreciate any help
thank you</p>