Creating Tickets - MS Access VBA and SOAP

Moderator: crythias

Locked
feco
Znuny newbie
Posts: 1
Joined: 15 May 2013, 11:07
Znuny Version: 3.0.10
Real Name: Ferenc Csepregi

Creating Tickets - MS Access VBA and SOAP

Post by feco »

Hi,

We're using OTRS 3.0.10 and I'm trying to create tickets from MS Access with VBA and I've got the following code to create and send SOAP envelopes so far:

Code: Select all

...
MyURL = "http://mysite.com/otrs/rpc.pl"

         MyEnv = "<?xml version=""1.0"" encoding=""ISO-8859-1""?>"
         MyEnv = MyEnv & "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
         MyEnv = MyEnv & "  <soap:Body>"
        
        MyEnv = MyEnv & "   <TicketCreate>"
        MyEnv = MyEnv & "     <UserLogin>someuser</UserLogin>"
        MyEnv = MyEnv & "     <Password>somepass</Password>"
        MyEnv = MyEnv & "     <Ticket>"
        MyEnv = MyEnv & "       <Title>Test Message</Title>"
        MyEnv = MyEnv & "       <QueueID>6</QueueID>"                               'QUEUE - set to Support
        MyEnv = MyEnv & "       <StateID>5</StateID>"                               'STATE - closed successful(2) or open(5)
        MyEnv = MyEnv & "       <PriorityID>2</PriorityID>"                         'PRIORITY - set to normal
        MyEnv = MyEnv & "       <OwnerID>1</OwnerID>"                               'Theoretically NEW OWNER
        MyEnv = MyEnv & "       <CustomerUser>" & MyCNo & "</CustomerUser>"         'COSTUMER NO - set
        MyEnv = MyEnv & "     </Ticket>"
        
        MyEnv = MyEnv & "     <Article>"
        MyEnv = MyEnv & "       <ArticleType>email-external</ArticleType>"          'TYPE - set to e-mail external
        MyEnv = MyEnv & "       <SenderType>system</SenderType>"                    'SENDERTYPE - set to system
        MyEnv = MyEnv & "       <From>Support Team</From>"                 'FROM - set
        MyEnv = MyEnv & "       <Subject>" & MySub & "</Subject>"                   'SUBJECT - set
        MyEnv = MyEnv & "       <Body>" & BodyText & "</Body>"                      'MESSAGE BODY - set
        MyEnv = MyEnv & "       <Charset>ISO-8859-15</Charset>"                     'CHARSET - set
        MyEnv = MyEnv & "       <MimeType>text/html</MimeType>"                    'MIMETYPE - set
        MyEnv = MyEnv & "       <HistoryType>EmailCustomer</HistoryType>"           'HISTORY TYPE - set
        MyEnv = MyEnv & "       <HistoryComment>Just a friendly reminder.</HistoryComment>" ' - set
        MyEnv = MyEnv & "       <AutoResponseType>auto reply</AutoResponseType>"    'AUTO REPLY - set
        MyEnv = MyEnv & "       <NoAgentNotify>0</NoAgentNotify>"                   'NOTIFY AGENT - set
        MyEnv = MyEnv & "     </Article>"
      
        MyEnv = MyEnv & "   </TicketCreate>"
        
        MyEnv = MyEnv & "  </soap:Body>"
        MyEnv = MyEnv & "</soap:Envelope>"
        
        With xmlhtp
        .Open "POST", MyURL, False, "someuser", "somepass"
        .setRequestHeader "Host", "http://mysite.com"
        .setRequestHeader "Content-Type", "text/xml; charset=utf-8"
        .setRequestHeader "soapAction", "#TicketCreate"
        
        .Send MyEnv
...
However, this produces an error:

Denied access to method (TicketCreate) in class (main) at /opt/otrs/Kernel/cpan-lib/SOAP/Lite.pm line 2733.

This might be obvious for some of you, but I cannot find further info on this schema nor how to proceed from here.
Am I getting this error because of the missing SessionID?

Thanks,
Feri
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Creating Tickets - MS Access VBA and SOAP

Post by jojo »

don't use rpc.pl but the GenericInterface
"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
Locked