【问题标题】:Owner update OTRS所有者更新 OTRS
【发布时间】:2016-08-11 05:19:05
【问题描述】:

我在更新所有者和更新票证时遇到问题。我在 PHP 中使用肥皂 api。 我正在使用 OTRS 3.1.12。 我尝试使用以下功能。

 $url      = "https://url/otrs/rpc.pl";  // URL for OTRS server
            $username = "username";  // SOAP username set in sysconfig
            $password = "password";  // SOAP password set in sysconfig

        ### Form Fields

        $new_owner =$_POST['new_owner'];
        $subject =$_POST['subject'];
        $text = $_POST['text'];
        $note_type = $_POST['note_type'];


        #### Initialize new client session ####
        $client = new SoapClient(
            null,
            array(
                'location'  => $url,
                'uri'       => "Core",
                'trace'     => 1,
                'login'     => $username,
                'password'  => $password,
                'style'     => SOAP_RPC,
                'use'       => SOAP_ENCODED
            )
        );

        #### Create a new ticket shell. The function returns the Ticket ID ####
        $TicketID = $client->__soapCall(
            "Dispatch", array($username, $password,
                "TicketObject", "TicketCreate",
                "TicketID",       $ticket_id,
                "OwnerID",      $new_owner,
                "UserID",       1,
            )
        );

        ##### Create an article with the info. The function returns an Article ID ####
        $ArticleID = $client->__soapCall("Dispatch",
            array($username, $password,
                "TicketObject",   "ArticleCreate",
                "Subject",        $subject,
                "ContentType",    "text/plain; charset=ISO-8859-1",
                "Body",           $text,

            )
        );

我知道这是完全错误的。谁能帮忙??

【问题讨论】:

    标签: php soap otrs


    【解决方案1】:
    $URL = 'https://your-url.com/otrs/nph-genericinterface.pl/Webservice/WebserviceName'; //webserviceName is the name of webservice created from admin panel of otrs
    $namespace = 'https://your-url.com/otrs/GenericInterface/actions'; //namespace of soap config
    
    $username = "username"; //// SOAP username set in sysconfig
    $password = "password"; //// SOAP password set in sysconfig
    
    // initialize a SoapClient instance
    $SOAPClientInstance = new \SoapClient(null, array(
    'location'=> $URL,
    'uri' => $namespace,
    'trace' => 1,
    'login' => $username,
    'password'=> $password,
    'style' => SOAP_RPC,
    'use' => SOAP_ENCODED,
    
    )
    );
    
    
    // set the request parameters as an array of SoapParam instances
    $TicketRequestArray = array(
    
    new \SoapParam('username', 'UserLogin'), //user username
    new \SoapParam('password', "Password"),// user password
    );
    
    $TicketRequestArray[] = new \SoapParam('123', 'TicketID');// ID of ticket which is to be updated
    $TicketRequestArray[] = new \SoapParam(array(
    'State' => 'open',
    'OwnerID' => $new_owner, // you can add which parameters to update
    ), 'Ticket');
    $Action = 'TicketUpdate';
    
    $Response = $SOAPClientInstance->__soapCall($Action,
    $TicketRequestArray
    );
    
    print "<pre>\n";
    print "Request :\n".htmlspecialchars($SOAPClientInstance->__getLastRequest()) ."\n";
    print "Response:\n".htmlspecialchars($SOAPClientInstance->__getLastResponse())."\n";
    print "</pre>";
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-12
      • 2012-08-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-12
      • 2014-10-27
      相关资源
      最近更新 更多