2016-08-16 5 views
1

사용자 정의 포털에서 otrs 티켓을 업데이트하는 데 문제가 있습니다. Soap Api를 통해 PHP를 사용하고 있습니다. 여기 내가 시도한 것이있다. 웹 서비스를 만들었습니다. OTRS에서 공급자 인 Network Transport는 네임 스페이스 https://otrs.classic.com.np/otrs/GenericInterface/actions을 추가했습니다. < -----이게 맞나요? ??????????? 나는이 대답을 발견OTRS. 티켓 업데이트

$url  = "https://myurl.com/otrs/nph-genericinterface.pl"; // URL for OTRS server 

      $namespace = "https://myurl.com/otrs/GenericInterface/actions"; 
      $username = "ctdeveloper"; // SOAP username set in sysconfig 
      $password = "ctdeveloper"; // 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'  => $namespace, 
        'trace'  => 1, 
        'login'  => $username, 
        'password' => $password, 
        'style'  => SOAP_RPC, 
        'use'  => SOAP_ENCODED 
       ) 
      ); 

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

답변

1

확인을 다음과 같이 내 PHP 코드입니다. 희망은 그것이 모두를 돕는다. 먼저 OTRS의 관리자에게 웹 서비스를 만드십시오.

$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>";