Authentication Error on Job Submit API Call

I am trying to figure out why I am having an authentication error while attempting to do a Job Submit call.  I was able to use the credentials to log into the portal without and issue, but they don't seem to be working with the API call.  I got most of the code from the API guide and modified it to what I needed.  Right now I'm just trying to get a job to work and have some clean up to do still.  Here is the code I'm using.  I also attached a screenshot of the error, and a screen shot of the request and response I grabbed in Fiddler.  Any help would be greatly appreciated.

            JobSubmitService EM = new JobSubmitService();

            var reqAuth = new RequestAuthentication

            {

                Item = new XDDSAuthType

                {

                    RequesterID = new UIDType

                    {

                        Value = GetConfigSetting("XDDSUser")

                    },

                    Password = GetConfigSetting("XDDSPw")

                }

            };


            var messages = new List<MessageType>();

            foreach (var fax in faxes)

            {

                messages.Add(new MessageType

                {

                    Contents = new ContentsType

                    {

                        Part = new ContentPartType[]

                        {

                            new ContentPartType

                            {

                                Item = new DocumentType

                                {

                                    Item = new DocDataType

                                    {

                                        format = DocEncodingFormat.base64,

                                        Value = ReadAndEncodedFile(fax.FaxFileName)

                                    },

                                    Filename = EncodableString(fax.FaxFileName),

                                    DocType = "PDF",

                                    ItemElementName = ItemChoiceType.DocData,

                                    @ref = "ATTACH1"

                                }

                            }

                        }

                    },

                    JobOptions = new JobOptionsType

                    {

                        BillingCode = EncodableString(GetConfigSetting("billingCode")),

                        Delivery = new DeliveryType

                        {

                            Schedule = ScheduleType.express

                        },

                        FaxOptions = new FaxOptionsType

                        {

                            FaxCoversheet = new FaxCoversheetOptionType

                            {

                                CoversheetTo = EncodableString(fax.FaxTo),

                                CoversheetFrom = EncodableString(GetUser()),

                                CoversheetAttn = EncodableString(GetConfigSetting("coversheetAttn")),

                                UseCoversheet = YesNo.yes

                            },

                            FaxMode = ShouldUseFine() ? FaxModeType.fine : FaxModeType.standard

                        },

                        PriorityBoost = IsHighPriority()

                    },

                    Destinations = new FaxType[]

                    {

                        new FaxType

                        {

                            Phone = fax.FaxNumber,

                            To = EncodableString(fax.FaxTo),

                            From = EncodableString(Environment.UserName)

                        }

                    }

                });

            }

            var JS_Request = new JobSubmitRequest

            {

                Message = messages.ToArray(),

                SubmitId = "SubmitId"

            };


            Set_Server_and_Proxy(EM);


            EM.RequestValue = new Request

            {

                ReceiverKey = EM.Url,

                Authentication = reqAuth,

                RequestID = "RequestID"

            };

            EM.ResponseValue = new Response();

            JobSubmitResult JS_Result = new JobSubmitResult();


            try

            {

                JS_Result = EM.JobSubmit(JS_Request);

            }

            catch (Exception ex)

            {

                Console.WriteLine(ex.Message);

                Console.Read();

            }

 


Comments

  • Make sure you are passing in a document to the ReadandEncode. Your credentials may be right, but the no document will error.

  • I believe I have done this correctly.  You can see the call to ReadAndEncode where the message is being built up.  You can also see what I believe is the encoded file in at the very bottom of the screenshot of the request (though I cut off part of it in the screenshot).  Does this appear correct to you?

  • Are you able to attach the Response as XML?

  • I attached the request and response in XML format here.  Thanks.

  • The RequesterID you submitted with is not a userid. It is an alias. As such, you have to add the aliasType attribute to RequesterID.

    <RequesterID aliasType="M2F">****@****.com/>RequesterID

  • I removed the actual user ID and password from the XML file for security purposes, but adding the "aliasType="M2F" in the code seems to have fixed this issue.

    Thank you for the help.