开发者

image uploading problem from Android to .NET Webservices

开发者 https://www.devze.com 2023-03-03 19:12 出处:网络
I have an issue.. I am passing the image as the parameter to my webservices that is being build on .NET, but it returns me the error from the webservices. I am not been able to understand y this is h

I have an issue..

I am passing the image as the parameter to my webservices that is being build on .NET, but it returns me the error from the webservices. I am not been able to understand y this is happening.

This is my function in Android thru which I call the webservices.

 public ArrayList<String> HttpClient(String oid,String Base64)
 {

  SoapObject Request=new SoapObject(NAMESPACE,METHOD_NAME);
        Request.addProperty("oid",oid);
        Request.addProperty("base64",Base64.replaceAll("/","#"));

        SoapSerializationEnvelope soapEnvelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
        soapEnvelope.dotNet=true;
        soapEnvelope.setOutputSoapObject(Re开发者_运维百科quest);

        AndroidHttpTransport aht=new AndroidHttpTransport(URL);
        try
        {

         aht.call(SOAP_ACTION,soapEnvelope);
         resultString = (SoapPrimitive) soapEnvelope.getResponse();

     System.out.println(resultString.toString());

        }

And this is my function in webservices that is in C#.NET

[WebMethod]
    public void UpdateImage2Database_FromBase64String(string base64, int oid)
    {
        try
        {

            SqlConnection conn = new SqlConnection(cConnectionString);
            try
            {
                conn.Open();
                //SqlCommand cmd = new SqlCommand("Update CCOD_ORDERHDR" +
                //                                 " SET FLD_ORDERHDR_IMAGECAPTURE=@FLD_ORDERHDR_IMAGECAPTURE" +
                //                                 " Where FLD_ORDERHDR_ID=" + oid,
                //                                 conn);

                SqlCommand cmd = new SqlCommand("Update CCOD_ORDERHDR" +
                                                 " SET FLD_ORDERHDR_IMAGECAPTURE='" + base64 + "' Where FLD_ORDERHDR_ID=" + oid,
                                                 conn);
                //cmd.Parameters.Add("@FLD_ORDERHDR_IMAGECAPTURE", image);
                cmd.ExecuteNonQuery();
            }
            finally
            {
                conn.Close();
            }

        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

datatype in my database is text.

please help me.

Any suggestions will be accepted.

Thanks


I got the answer the issue was there is the low space on the server, that is why it is creating the problem and giving me the exception in Android services. Now it works fine.

Thanks

0

精彩评论

暂无评论...
验证码 换一张
取 消