0

KSOP Web サービスを使用して画像をアップロードする必要があります。サーバーデータベースにアップロードする必要があります。残りのデータ

String strquery = "insert into SNGTADMIN.sprint_mobile_task_dtl(SITE_NBR,SITE_ASSET_NAME,TASK_ID, PHYSICAL_CONDITION,VISIBLE_RUST,BLACK_SMOKE,ENCLOSURE_OIL_LEAK,BATTERY_FLUID_LEAK,AUTO_EXERCISE_STATUS,BATTERY_STATUS,TRANSFER_SWITCH_CONDITION,ALARM_NOT_RECV_BEFORE_REPAIR,ALARM_NOT_RECV_AFTER_REPAIR,ARRIVAL_FUEL_LEVEL,CUM_METER_READING,DESCRETE_ONSITE_WORK,FUTURE_RECOMMENDED_WORK,AFTERVISIT_EVAL_SUMMARY,ACCESS_INSTR_CLAR_NEEDED,MAINT_NOTES,FIELD_PROXIMITY) values('"+ siteId+ "','"+ asset_type+ "','1','"  + phyCondion+ "','"+ visbleRust + "','"             + heavyBlackSmoke+ "','"+ fuelOrOilLeak + "','" + bateryFluidLeaks+ "','"+ exceriseStatus
+ "','" + batteryStatus + "','" + transferSwitch+ "','" + beforeRepair  + "','" + ostRepair
+ "','" + fuelLevelUponArrival  + "','" + cumulativeRunHour+ "','"+ discretionaryWork               + "','" + additionalWork+ "','"+ evaluationSummaryAfterVisit+ "','"+ accessInstrustions
+ "','" + maintenanceNotes+ "','"+ fieldFarmProximity + "')";

と使用

PropertyInfo pi = new PropertyInfo();
        pi.setName("strSQl");
        pi.setValue(strquery);
        pi.setType(String.class);
        request.addProperty(pi);

このクエリに画像を追加する方法がわかりません。画像を送信しなくても正常に動作します。

助けて。

4

2 に答える 2

0

出来るよ..!!私はそれを.asmx webservice

Web サービスのコードは、次のようにコーディングできます。

 public class FileUploader : System.Web.Services.WebService

    {

[WebMethod]

public string UploadFile(byte[] f, string fileName)

{

    // the byte array argument contains the content of the file    
    // the string argument contains the name and extension    
    // of the file passed in the byte array    
    try    
    {    
        // instance a memory stream and pass the    
        // byte array to its constructor    
        MemoryStream ms = new MemoryStream(f);     

        // instance a filestream pointing to the    
        // storage folder, use the original file name    
        // to name the resulting file    
        FileStream fs = new FileStream(System.Web.Hosting.HostingEnvironment.MapPath

                    ("~/TransientStorage/") +fileName, FileMode.Create); 


        // write the memory stream containing the original    
        // file as a byte array to the filestream    
        ms.WriteTo(fs); 


        // clean up    
        ms.Close();    
        fs.Close();    
        fs.Dispose();    

        // return OK if we made it this far    
        return "OK";    
    }

    catch (Exception ex)    
    {    
        // return the error message if the operation fails    
        return ex.Message.ToString();    
    }    
}

これがうまくいくことを願っています..他に助けが必要な場合. それから聞いてください。

于 2013-06-27T11:12:36.087 に答える
0

画像を変換してから文字列に変換しbytesbase64このbase64文字列をサーバーに送信する( 1 )か、画像からバイト[]を作成し、それをプロパティとしてリクエストに追加する必要があります( 2 , 3 )

于 2013-06-27T10:41:31.153 に答える