Method Community

 

I can download pictures but I can't upload them

Last post 09-25-2015 9:49 PM by boblutz. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 06-28-2015 10:55 AM

    I can download pictures but I can't upload them

    I have followed the sample code here: https://www.method.me/cs/forums/t/949.aspx

    string result = ssc.MethodAPIUpdateFile(Constants.CompanyId, textBoxMethodUsername.Text, textBoxMethodPassword.Text,

    "", Constants.MethodCustomerTable, new string[ { "IdCardPhoto" }, image, "rocket.jpg", "276");

    Where my Company Id is ACMG1 and the table is Customer where I added an IdCardPhoto column of type Picture.  No matter what I change (smaller picture, File datatype instead of Picture, deleting the column and re-adding it) I get the following error message:

    <?xml version="1.0" encoding="windows-1252" ?><MethodAPI response = "There were problems with running the query. Please try again. If this message continues to appear, please contact support." ></MethodAPI>

    The Id 276 definitely exists because if I upload a picture via the Web UI, this returns the picture properly:

    result = ssc.MethodAPISelect_DataSetV2(Constants.CompanyId, textBoxMethodUsername.Text, textBoxMethodPassword.Text, "", ref ds, Constants.MethodCustomerTable, "IdCardPhoto, IdCardPhotoFileName, FullName", "RecordID=276", "", "", "");

    Any suggestions?  Are their any special SOAP settings I need to upload the byte[ that I need to put in my app.config file?

    Thanks,

    Bob


  • 07-17-2015 7:27 AM In reply to

    Re: I can download pictures but I can't upload them

    Hi Bob,

    Can you please post up the complete code snippet that you are using (including the portion used to create the byte array)?  We can have a look at the code as whole and then try replicating the issue on our end. 


    Cheers

    Jonathan Gamble
    Product Manager
    Method Integration Inc.
    Local and overseas: 416.847.0400
    Toll Free: 1.888.925.6238
    Fax: 416.640.6027
    E-mail: j.gamble@method.me
  • 07-17-2015 3:56 PM In reply to

    Re: I can download pictures but I can't upload them

    Here you go:

    byte[] image = null;

    FileStream fs = new FileStream("rocket16.png", FileMode.Open, FileAccess.Read);

    BinaryReader br = new BinaryReader(fs);

    long numBytes = new FileInfo("rocket16.png").Length;

    image = br.ReadBytes((int)numBytes);

     

    ACMGSyncMethodToWebSite.MethodCRM.ServiceSoapClient ssc = new MethodCRM.ServiceSoapClient("ServiceSoap");

    string result = ssc.MethodAPIUpdateFile(Constants.CompanyId, textBoxMethodUsername.Text, textBoxMethodPassword.Text, "",

    Constants.MethodCustomerTable, new string[] { "IdCardPhoto" }, image, "rocket.png", "276");


    The result I get is: 

    <?xml version="1.0" encoding="windows-1252" ?><MethodAPI response = "There were problems with running the query. Please try again. If this message continues to appear, please contact support." ></MethodAPI>

    Thanks,

    Bob

  • 08-05-2015 11:16 AM In reply to

    Re: I can download pictures but I can't upload them

    My apologies for the late reply boblutz. 

    We will need to dig into error logs to identify what is happening.  Can you please reproduce this problem on your side and let me know what day you make the call (If it is not today)?  I'll have the dev team dig into the logs for additional infromation.

    Jonathan Gamble
    Product Manager
    Method Integration Inc.
    Local and overseas: 416.847.0400
    Toll Free: 1.888.925.6238
    Fax: 416.640.6027
    E-mail: j.gamble@method.me
  • 08-05-2015 7:02 PM In reply to

    Re: I can download pictures but I can't upload them

    Okay, I tried three times at:

    Aug 5, 2015 17:45:00 Mountain Time (Calgary/Edmonton)
    Aug 5, 2015 17:51:20 Mountain Time (Calgary/Edmonton)
    Aug 5, 2015 17:54:05 Mountain Time (Calgary/Edmonton)

    I don't get an error now, I get nothing at all in the response every time:

    <?xml version="1.0" encoding="windows-1252" ?><MethodAPI response = "" ></MethodAPI>

    The file was called rocket.png, 576 bytes, that I'm adding to RecordId 276 in the Customer table if that helps.  The field is called IdCardPhoto. 

    Please let me know what you see.

    Bob

  • 09-25-2015 9:49 PM In reply to

    Re: I can download pictures but I can't upload them

    Any news?

    Thanks,

    Bob

Page 1 of 1 (6 items)