Está en la página 1de 2

20/12/13

Accessing OTRS SOAP using Java/Groovy | Gregors Braindump

Home

About
Search: type, hit enter

Gregors Braindump
Accessing OTRS SOAP using Java/Groovy
Posted by Gregor Tudan on April 26, 2010 Go to comments Leave a comment (6) RSS Feed

Recent Posts
Accessing OTRS SOAP using Java/Groovy

Being interested in Webservices, I was searching for something to play with in order to get a bit more practise and found OTRS at work. I was excited and wanted to give it a try, but soon found, that the interface OTRS was offering had little to do with Webservices. It is more like RPC using the SOAP protocol, basic elements like a predefined interface (WSDL) are missing. This makes all the frameworks for Webservices in Java practically useless. After googling around, I found a post from Joko Sastriawan explaining how to build SOAP-Messages using the standard JDK methods. I gave it a try and came up with a generic Java utility for creating SOAP Messages for OTRS. While is written in pure Java, it is intended to be used with something dynamic like Groovy and comes pretty close to the feeling of the original SOAP::Lite client. Watch this: 1 / /P r e p a r eC o n n e c t i o n 2 d e fo t r s C o n n= n e wO t r s C o n n e c t o r ( ' h t t p s : / / e x a m p l e . o r g / o t r s / r p c . p l ' ,' s o a p U s e r ' , ' s o a p P a s s ' ) 3 4 / /F i n da l lo p e nt i c k e t s 5 d e fp a r a m s=[ R e s u l t : ' A R R A Y ' ,L i m i t : 1 0 0 ,U s e r I D : 1 ,S t a t e T y p e : [ ' o p e n ' ] ] 6 d e fm s g=o t r s C o n n . d i s p a t c h C a l l ( " T i c k e t O b j e c t " ," T i c k e t S e a r c h " ,p a r a m s ) 7 S t r i n g [ ]r e s u l t=n e wS i m p l e S o a p M e s s a g e P a r s e r ( ) . n o d e s T o A r r a y ( m s g ) This will give you an array of TicketIDs, that can be used for more sophisticated stuff. Lets print the body of the last Article for a Ticket: 1 d e fm s g 2=o t r s C o n n . d i s p a t c h C a l l ( " T i c k e t O b j e c t " ," A r t i c l e F i r s t A r t i c l e " , [ T i c k e t I D : 0 8 1 5 ] ) 2 d e fr e s u l t 2=n e wS i m p l e S o a p M e s s a g e P a r s e r ( ) . n o d e s T o M a p ( m s g 2 ) 3 4 / /A c c e s s i n gp r o p e r t i e si se a s yu s i n gg r o o v y ,s i n c et h i si sam a p 5 d e fb o d y=r e s u l t 2 [ ' B o d y ' ] / /o rr e s u l t 2 . B o d y 6 7 / /B o d yc o m e sb a s e 6 4e n c o d e d ,w en e e ds o m em a g i ch e r e . . . 8 p r i n t l nn e wS t r i n g ( b o d y . d e c o d e B a s e 6 4 ( ) , ' U T F 8 ' ) You get the idea. Im willing to share what I learned and might upload the code to github. If youre interested, drop me a line. UPDATE: The code is available on github: https://github.com/gtudan/OTRS-Client

Search by Tags!
Groovy Java OTRS SOAP Webservice

Archives
April 2010

Links Meta
Log in

0
Programming Groovy, Java, OTRS, SOAP, Webservice

Leave a comment ?

6 Comments.

Thomas Holmstrm July 6, 2010 at 21:03 Hi! Would you like to share your code? Im trying to do the same from Ruby, but have a hard time reverse-engineering the calls to OTRSs SOAP::Lite peculiarities. It seems like the order of the parameters in the SOAP body is significant, right? I am at the point where Ive got OTRS to accept my SOAP call without de-serialization errors but I get empty answers for all my calls. The OTRS log shows Need UserID or CustomerUserID params for permission check! for my TicketSearch calls and Need User or UserID! for my GetUserData call even though I provide a UserID in both cases

Reply

gregor.tudan.de/2010/04/accessing-otrs-soap-from-javagroovy/

1/2

20/12/13
Regards, Thomas

Accessing OTRS SOAP using Java/Groovy | Gregors Braindump

Greg Duffy October 25, 2010 at 10:47 Would also like to share your code, any chance of passing it on please. Regards Greg

Reply

Jayanth February 4, 2011 at 07:53 Hi, I am very interested to try out your approach. Can you share the code Regards, Jayanth

Reply

The Red May 31, 2011 at 14:43 Im also very interested. Thanks for help. Good work!

Reply

Stephan Scharff-Rahn August 12, 2011 at 15:03 Im very interested to. Chears*Stephan

Reply

Roman Keller January 4, 2012 at 11:15 Hi That is wat im looking for Is there a way to get your Library? Thank you, Roman

Reply

Leave a Comment
NAME EMAIL Website URL

NOTE - You can use these HTML tags and attributes: < ah r e f = " "t i t l e = " " >< a b b rt i t l e = " " >< a c r o n y mt i t l e = " " >< b >< b l o c k q u o t e c i t e = " " >< c i t e >< c o d e >< d e ld a t e t i m e = " " >< e m >< i >< qc i t e = " " >< s t r i k e > < s t r o n g >

SUBMIT

Copyright 2013 Gregors Braindump | Powered by zBench and WordPress

Top

gregor.tudan.de/2010/04/accessing-otrs-soap-from-javagroovy/

2/2

También podría gustarte