Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateAttachment is returning an empty byte array #82

Open
cyclops26 opened this issue Jul 21, 2020 · 0 comments
Open

CreateAttachment is returning an empty byte array #82

cyclops26 opened this issue Jul 21, 2020 · 0 comments

Comments

@cyclops26
Copy link

cyclops26 commented Jul 21, 2020

@natchu - hoping you can provide insight on how you got this functional.

Currently, I'm doing the following and receiving no errors, just an empty byte response from AutoTask and the attachment never shows up on the ticket.

suds_client is a connection to my v1.6 endpoint for my zone
autotask_connection is my atws autotask connection

attachment_object = self.suds_client.factory.create('Attachment')
attachment_object.Data = open('/tmp/testfile.txt', 'rb').read()
attachment_object.Info.ParentID = 28512 # ticket to update
attachment_object.Info.ParentType = 4 # ticket type
attachment_object.Info.Type = "FILE_ATTACHMENT"
attachment_object.Info.Title = "Ticket Test"
attachment_object.Info.FullPath = "/tmp/testfile.txt"
attachment_object.Info.Publish = 2 # internal users
attachment_object.Info.ContentType = "text/plain"
autotask.CreateAttachment(attachment_object)

Using a SOAP Logging Plugin with atws connection - this is the XML that is generated and sent to AT:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://autotask.net/ATWS/v1_6/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <SOAP-ENV:Header>
      <AutotaskIntegrations xmlns="http://autotask.net/ATWS/v1_6/">
         <IntegrationCode>SCRUBBED-INTEGRATION-CODE</IntegrationCode>
      </AutotaskIntegrations>
   </SOAP-ENV:Header>
   <ns0:Body>
      <ns1:CreateAttachment>
         <ns1:attachment>
            <ns1:Data>b'TEST\\n'</ns1:Data>
            <ns1:Info>
               <ns1:id />
               <ns1:ParentID>28512</ns1:ParentID>
               <ns1:ParentType>4</ns1:ParentType>
               <ns1:Type>FILE_ATTACHMENT</ns1:Type>
               <ns1:Title>Ticket Test</ns1:Title>
               <ns1:FullPath>/tmp/testfile.txt</ns1:FullPath>
               <ns1:Publish>2</ns1:Publish>
            </ns1:Info>
         </ns1:attachment>
      </ns1:CreateAttachment>
   </ns0:Body>
</SOAP-ENV:Envelope>

I receive this response back b''

Originally posted by @natchu in #65 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant