send attachments rpc .net

English! place to talk about development, programming and coding
Post Reply
kristov
Znuny newbie
Posts: 7
Joined: 10 Jan 2011, 14:21
Znuny Version: 2.4

send attachments rpc .net

Post by kristov »

hello
I need to send attachments to the ticket in the form of files and using rpc. net tickets even though I have problems sending emails with attachments still remain
someone knows a solution thanks in advance
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: send attachments rpc .net

Post by jojo »

please use forum search and upgrade to 3.0.5 to see if your mail probs are solved
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
kristov
Znuny newbie
Posts: 7
Joined: 10 Jan 2011, 14:21
Znuny Version: 2.4

Re: send attachments rpc .net

Post by kristov »

hello
I use the search option on the forum, unfortunately I have not found a solution
I'm not an administrator orts, and I have no power to raise the version I have to somehow deal with this version of PHP I was able to send a ticket and so I got a notification by mail c # too, should be given a student manual rpc is something I find interesting as the ladies know

Code: Select all

   private static String SOAP_CREATETICKETARTICLE = @"<?xml version=""1.0"" encoding=""utf-8""?>
  <soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:soapenc=""http://schemas.xmlsoap.org/soap/encoding/"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" soap:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">
    <soap:Body>
      <Dispatch xmlns=""/Core"">
        <c-gensym62 xsi:type=""xsd:string"">{0}</c-gensym62>
        <c-gensym64 xsi:type=""xsd:string"">{1}</c-gensym64>

        <c-gensym66 xsi:type=""xsd:string"">TicketObject</c-gensym66>
        <c-gensym68 xsi:type=""xsd:string"">ArticleSend</c-gensym68>

        <c-gensym70 xsi:type=""xsd:string"">TicketID</c-gensym70>
        <c-gensym72 xsi:type=""xsd:int"">{2}</c-gensym72>

        <c-gensym74 xsi:type=""xsd:string"">ArticleType</c-gensym74>
        <c-gensym76 xsi:type=""xsd:string"">{3}</c-gensym76>

        <c-gensym78 xsi:type=""xsd:string"">SenderType</c-gensym78>
        <c-gensym80 xsi:type=""xsd:string"">{4}</c-gensym80>

        <c-gensym82 xsi:type=""xsd:string"">From</c-gensym82>
        <c-gensym84 xsi:type=""xsd:string"">{5}</c-gensym84>

        <c-gensym86 xsi:type=""xsd:string"">To</c-gensym86>
        <c-gensym88 xsi:type=""xsd:string"">{6}</c-gensym88>

        <c-gensym90 xsi:type=""xsd:string"">Cc</c-gensym90>
        <c-gensym92 xsi:type=""xsd:string"">{7}</c-gensym92>

        <c-gensym94 xsi:type=""xsd:string"">ReplyTo</c-gensym94>
        <c-gensym96 xsi:type=""xsd:string"">{8}</c-gensym96>

        <c-gensym98 xsi:type=""xsd:string"">Subject</c-gensym98>
        <c-gensym100 xsi:type=""xsd:string"">{9}</c-gensym100>

        <c-gensym102 xsi:type=""xsd:string"">Body</c-gensym102>
        <c-gensym104 xsi:type=""xsd:string"">{10}</c-gensym104>
<!--
        <c-gensym106 xsi:type=""xsd:string"">MessageID</c-gensym106>
        <c-gensym108 xsi:type=""xsd:string"">{11}</c-gensym108>
-->
        <c-gensym110 xsi:type=""xsd:string"">Charset</c-gensym110>
        <c-gensym112 xsi:type=""xsd:string"">{12}</c-gensym112>

        <c-gensym114 xsi:type=""xsd:string"">HistoryType</c-gensym114>
        <c-gensym116 xsi:type=""xsd:string"">{13}</c-gensym116>

        <c-gensym118 xsi:type=""xsd:string"">HistoryComment</c-gensym118>
        <c-gensym120 xsi:type=""xsd:string"">{14}</c-gensym120>

        <c-gensym122 xsi:type=""xsd:string"">UserID</c-gensym122>
        <c-gensym124 xsi:type=""xsd:int"">{15}</c-gensym124>
     <!--   
        <c-gensym126 xsi:type=""xsd:string"">NoAgentNotify</c-gensym126>
        <c-gensym128 xsi:type=""xsd:int"">{16}</c-gensym128>
-->
        <c-gensym130 xsi:type=""xsd:string"">MimeType</c-gensym130>
        <c-gensym132 xsi:type=""xsd:string"">{17}</c-gensym132>

        <c-gensym134 xsi:type=""xsd:string"">Loop</c-gensym134>
        <c-gensym136 xsi:type=""xsd:int"">{18}</c-gensym136>
      </Dispatch>
    </soap:Body>
  </soap:Envelope>";

 data.Clear();
                data.Add(username); //username
                data.Add(password); //password
                data.Add(createdTicketId); //ticket number
                data.Add("note-internal"); //article type
                data.Add("agent"); //sender type
                data.Add("BMM OptiCo APPLICATION "); //from
                data.Add("BMM_OPTICO"); //to
                data.Add(""); //cc
                data.Add("k.kolodziej@bmm.com.pl"); //reply to
                data.Add(title); //subject
                data.Add(message); //body
                data.Add("123"); //MessageID
                data.Add("ISO-8859-15"); //Charset
                data.Add("NewTicket"); //HistoryType
                data.Add("Created through RPC service"); //HistoryComment
                data.Add("1"); //UserID
                data.Add("1"); //NoAgentNotify
                data.Add("text/plain"); //MimeType
                data.Add("0"); //Loop
This is the xml structure and an array of values can help
kristov
Znuny newbie
Posts: 7
Joined: 10 Jan 2011, 14:21
Znuny Version: 2.4

Re: send attachments rpc .net

Post by kristov »

hello i found a solution to send the ticket and send notification emails should be created with the following xml content may be useful to someone on the writer in Java or C #. net code here ...

Code: Select all

 private static String SOAP__CREATEARTICLESEND  = @"<?xml version=""1.0"" encoding=""utf-8""?>
  <soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:soapenc=""http://schemas.xmlsoap.org/soap/encoding/"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" soap:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">
    <soap:Body>
      <Dispatch xmlns=""/Core"">
        
        <c-gensym138 xsi:type=""xsd:string"">{0}</c-gensym138>
        <c-gensym139 xsi:type=""xsd:string"">{1}</c-gensym139>
        
        <c-gensym140 xsi:type=""xsd:string"">TicketObject</c-gensym140>
        <c-gensym141 xsi:type=""xsd:string"">ArticleSend</c-gensym141>
        
           <c-gensym142 xsi:type=""xsd:string"">TicketID</c-gensym142>
        <c-gensym143 xsi:type=""xsd:int"">{2}</c-gensym143>


        <c-gensym144 xsi:type=""xsd:string"">ArticleType</c-gensym144>
        <c-gensym145 xsi:type=""xsd:string"">{3}</c-gensym145>

        <c-gensym146 xsi:type=""xsd:string"">SenderType</c-gensym146>
        <c-gensym147 xsi:type=""xsd:string"">{4}</c-gensym147>

        <c-gensym148 xsi:type=""xsd:string"">From</c-gensym148>
        <c-gensym149 xsi:type=""xsd:string"">{5}</c-gensym149>

        <c-gensym150 xsi:type=""xsd:string"">To</c-gensym150>
        <c-gensym151 xsi:type=""xsd:string"">{6}</c-gensym151>

     
        <c-gensym152 xsi:type=""xsd:string"">ReplyTo</c-gensym152>
        <c-gensym153 xsi:type=""xsd:string"">{7}</c-gensym153>

        <c-gensym154 xsi:type=""xsd:string"">Subject</c-gensym154>
        <c-gensym155 xsi:type=""xsd:string"">{8}</c-gensym155>
        
        <c-gensym156 xsi:type=""xsd:string"">Body</c-gensym156>
        <c-gensym157 xsi:type=""xsd:string"">{9}</c-gensym157>


        <c-gensym158 xsi:type=""xsd:string"">InReplyTo</c-gensym158>
        <c-gensym159 xsi:type=""xsd:string"">{10}</c-gensym159>

        <c-gensym160 xsi:type=""xsd:string"">References</c-gensym160>
        <c-gensym161 xsi:type=""xsd:string"">{11}</c-gensym161>

        <c-gensym162 xsi:type=""xsd:string"">Charset</c-gensym162>
        <c-gensym163 xsi:type=""xsd:string"">{12}</c-gensym163>

        <c-gensym164 xsi:type=""xsd:string"">MimeType</c-gensym164>
        <c-gensym165 xsi:type=""xsd:string"">{13}</c-gensym165>

        <c-gensym166 xsi:type=""xsd:string"">Loop</c-gensym166>
        <c-gensym167 xsi:type=""xsd:int"">{14}</c-gensym167>
 
        <c-gensym168 xsi:type=""xsd:string"">Attachment</c-gensym168>
        <c-gensym169 xsi:type=""xsd:int"">{15}</c-gensym169>

         <c-gensym170 xsi:type=""xsd:string"">Sign</c-gensym170>
         <c-gensym171 xsi:type=""xsd:int"">{16}</c-gensym171>
<!--
          <c-gensym172 xsi:type=""xsd:string"">Crypt</c-gensym172>
        <c-gensym173 xsi:type=""xsd:int"">{17}</c-gensym173>
-->
        <c-gensym174 xsi:type=""xsd:string"">HistoryType</c-gensym174>
        <c-gensym175 xsi:type=""xsd:int"">{18}</c-gensym175>

        <c-gensym176 xsi:type=""xsd:string"">HistoryComment</c-gensym176>
        <c-gensym177 xsi:type=""xsd:int"">{19}</c-gensym177>
        
        <c-gensym180 xsi:type=""xsd:string"">UserID</c-gensym180>
        <c-gensym181 xsi:type=""xsd:int"">{20}</c-gensym181>

   
       
      </Dispatch>
    </soap:Body>
  </soap:Envelope>";

//Fill the array with the elements of our string
 #region create article for a ticket send
                data.Clear();
                data.Add(username); //username
                data.Add(password); //password
                data.Add(createdTicketId); //ticket number
                data.Add("note-internal"); //article type
                data.Add("agent"); //sender type
                data.Add("APPLICATION "); //from
                data.Add("queue"); //to
                data.Add(""); //reply to
                data.Add(title); //subject
                data.Add(message); //body
                data.Add(""); //IN REPLYTO
                data.Add("k.kolodziej@bmm.com.pl"); // References
                data.Add("iso-8859-15"); // Charset     => 'iso-8859-15'
                data.Add("text/plain"); //  MimeType    => 'text/plain',
                data.Add("1"); //   Loop        => 0, # 1|0 used for bulk emails
                data.Add(SOAP__ATTACHMENT); // Attachment
                data.Add(SOAP__SIGN); // Sign
                data.Add("Detached"); //Crypt
                data.Add("WebRequestCustomer"); //   HistoryType    => 'OwnerUpdate',  # Move|AddNote|PriorityUpdate|WebRequestCustomer|...
                data.Add("C# SEND RPC"); // HistoryComment => 'Some free text!',
                data.Add("1"); //  UserID         => 123,
//string for sing
        #region tworzenie xml sign
        private static String SOAP__SIGN = @"
        
        <c-gensym182 xsi:type=""xsd:string"">Type</c-gensym182>
        <c-gensym183 xsi:type=""xsd:string"">PGP</c-gensym183>
        <c-gensym184 xsi:type=""xsd:string"">SubType</c-gensym184>
        <c-gensym185 xsi:type=""xsd:string"">Inline|Detached</c-gensym185>
        <c-gensym186 xsi:type=""xsd:string"">Key</c-gensym186>
        <c-gensym187 xsi:type=""xsd:string"">81877F5E</c-gensym187>
        <c-gensym188 xsi:type=""xsd:string"">Type</c-gensym188>
         <c-gensym189 xsi:type=""xsd:string"">SMIME</c-gensym189>
          <c-gensym190 xsi:type=""xsd:string"">Key</c-gensym190>
            <c-gensym191 xsi:type=""xsd:string"">3b630c80</c-gensym191>
 ";
        #endregion
this code is work
This code is working properly but still I can not create an xml file for upload (ATTACHMENT) if another section let someone correct me ..
kristov
Znuny newbie
Posts: 7
Joined: 10 Jan 2011, 14:21
Znuny Version: 2.4

Re: send attachments rpc .net

Post by kristov »

someone has an idea how to create xml from the php code to send an attachment working code in php

Code: Select all

 "Attachment"       , array(
                    array('Content' => $theData,'ContentType' => $contenttype,'Filename' => $myFile),
                     ),
mytry to to create xml

Code: Select all

   #region tworzenie xml ATTACHMENT
        private static String SOAP__ATTACHMENT = @"
    <c-gensym192 xsi:type=""xsd:string"">    
             <c-gensym193 xsi:type=""xsd:string""> 
                    <c-gensym194 xsi:type=""xsd:string"">Content</c-gensym194>
                    <c-gensym195 xsi:type=""xsd:string"">{0}</c-gensym195>
                    <c-gensym196 xsi:type=""xsd:string"">ContentType</c-gensym196>
                    <c-gensym197 xsi:type=""xsd:string"">text/html</c-gensym197>
                    <c-gensym198 xsi:type=""xsd:string"">Filename</c-gensym198>
                    <c-gensym199 xsi:type=""xsd:string"">kaka.html</c-gensym199>
                </c-gensym193>
    </c-gensym192>
 ";
This code does not work anyone have an idea how to do it differently
kristov
Znuny newbie
Posts: 7
Joined: 10 Jan 2011, 14:21
Znuny Version: 2.4

Re: send attachments rpc .net

Post by kristov »

I have a question or did someone in the forum to send a file attachment using the c # or. net if so ask for an example.
Thank you
Post Reply