1

I have error Invalid length for a Base-64 char array or string when I create WCF Rest Post

IServiceRequest.cs

    [OperationContract]
    [WebInvoke(Method = "POST",
          RequestFormat = WebMessageFormat.Json,
          ResponseFormat = WebMessageFormat.Json,
          UriTemplate = "/InsertData?ticket={ticket}&request={request}&category={category}&subCategory={subCategory}&subject={subject}&body={body}&assignto={assignto}&status={status}&fileName={fileName}&fileContent={fileContent}&fileBinary={fileBinary}&IsActive={IsActive}&createdBy={createdBy}&ACNo={ACNo}")]
    IEnumerable<USP_INSERT_DATA_Result> InsertData(string ticket, string request, string category, string subCategory, string subject, string body, string assignto, int status, string fileName, string fileContent, byte[] fileBinary, bool IsActive, string createdBy, int ACNo);

ServiceRequest.svc.cs

public IEnumerable<USP_INSERT_DATA_Result> InsertData(string ticket, string request, string category, string subCategory, string subject, string body, string assignto, int status, string fileName, string fileContent, byte[] fileBinary, bool IsActive, string createdBy, int ACNo)
    {
        return objapi.USP_INSERT_DATA(ticket, request, category, subCategory, subject, body, assignto, status, fileName, fileContent, fileBinary, IsActive, createdBy, ACNo).AsEnumerable();
    }

USP_INSERT_DATA_Result.cs

public partial class USP_INSERT_DATA_Result
{
    public string TICKET_NUMBER { get; set; }
    public string REQUESTER_ACCOUNT { get; set; }
    public string CATEGORY { get; set; }
    public string SUBCATEGORY { get; set; }
    public string SUBJECT { get; set; }
    public string BODY { get; set; }
    public string ASSIGNED_TO { get; set; }
    public bool IS_ACTIVE { get; set; }
    public string CREATED_DATE { get; set; }
    public string CREATED_BY { get; set; }
    public int AC_NO { get; set; }
    public int STATUS { get; set; }
    public string FILE_NAME { get; set; }
    public string FILE_CONTENT { get; set; }
    public byte FILE_BINARY { get; set; }
}

What I miss code to post rest service like that?

error log:

at System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength) at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) at System.Convert.FromBase64String(String s) at System.ServiceModel.Dispatcher.QueryStringConverter.ConvertStringToValue(String parameter, Type parameterType) at System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.CompositeDispatchFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
Stfvns
  • 1,001
  • 5
  • 16
  • 42
  • Possible duplicate of [Invalid length for a Base-64 char array](http://stackoverflow.com/questions/2925729/invalid-length-for-a-base-64-char-array) – gmiley Dec 16 '16 at 03:11

0 Answers0