What is XML for a valid OTRS-TicketSearch request

I am trying to interact with the otrs-ticket system to take some photos and calculate some statistics. I want to do this in haskell- I use the package soap.

Ignoring the code import statements is quite simple; I create a SOAP-Transport with a configuration file soap.cfg(see below). Then build SOAP-Body and call the web service with "Dispatch".

{-# LANGUAGE OverloadedStrings #-}

import Network (withSocketsDo)
import Network.SOAP
import Network.SOAP.Transport.HTTP

import Text.XML.Writer
import Text.XML.Stream.Parse as Parse
import           Data.Text (Text)
import qualified Data.Text as T
import qualified Data.ByteString.Lazy.Char8 as BS
import Data.Configurator (load, Worth(Required))

main :: IO ()
main = withSocketsDo $ do
    transport <- confTransport "soap" =<< load [Required "./src/SOAP/soap.cfg"]
    let body = do element "TicketObject" ("TicketSearch" :: Text)
                  element "OwnerID" ("owner" :: Text)

    xmlresult <- invokeWS transport "#TicketObject" () body (RawParser id)
    BS.putStrLn xmlresult

soap.cfg

soap {
    url = "http://domain/otrs/rpc.pl"
    user = "testuser"
    password = "testpass"
    trace = true
    timeout = 15
    }

If I create and call this program, I get the following xmlresult:

inquiry:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <TicketObject>TicketSearch</TicketObject>
        <OwnerID>heu</OwnerID>
    </soapenv:Body>
</soapenv:Envelope>

Answer:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
    soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soap:Body>
        <soap:Fault>
            <faultcode>soap:Client</faultcode>
            <faultstring>
                SOAPAction shall match 'uri#method' if present (got 'Dispatch', expected '#TicketObject'
            </faultstring>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>

If I then change the line, the next line

xmlresult <- invokeWS transport "Dispatch" () body (RawParser id)

to

xmlresult <- invokeWS transport "#TicketObject" () body (RawParser id)

the error line becomes

<faultstring>
    Denied access to method (TicketObject) in class (main) at /opt/otrs/Kernel/cpan-lib/SOAP/Lite.pm line 2810.
</faultstring>

I searched the Internet for some solution, I found this

- iPhoneObject TicketGet - , TicketSearch, , .

- , XML ?

otrs .Net - - - , , , ​​.

+4

All Articles