Tuesday, November 20, 2012

How to call OTRS web service in C#?

There are two ways for calling web service to create/get/search ticket in OTRS:
First way: call RPC.pl
Second way: GenericInterface

Follwoing are the steps for RPC:
1. Setup SOAP user in OTRS:
Log in OTRS with FULL admin permission
Admin -> SysConfig -> Framework -> Core: SOAP
Add and enable SOAP user and password
2. In C# project, prepare SOAP request like following
Then make Webrequest for URL: http://localhost/otrs/RPC.pl

<?xml version=""1.0"" encoding=""utf-8""?>
  <soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xmlns:soapenc=""http://schemas.xmlsoap.org/soap/encoding/""
xmlns:xsd=""http://www.w3.org/2001/XMLSchema""
soap:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/""
xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">
    <soap:Body>
      <Dispatch xmlns=""/Core"">
        <c-gensym4 xsi:type=""xsd:string"">soapUserName</c-gensym4>
        <c-gensym6 xsi:type=""xsd:string"">soapUserPassword</c-gensym6>
        <c-gensym8 xsi:type=""xsd:string"">TicketObject</c-gensym8>
        <c-gensym10 xsi:type=""xsd:string"">TicketSearch</c-gensym10>
        <c-gensym57 xsi:type=""xsd:string"">Limit</c-gensym57>
        <c-gensym59 xsi:type=""xsd:int"">10000</c-gensym59>
        <c-gensym8 xsi:type=""xsd:string"">Result</c-gensym8>
        <c-gensym10 xsi:type=""xsd:string"">ARRAY</c-gensym10>
        <c-gensym57 xsi:type=""xsd:string"">UserID</c-gensym57>
        <c-gensym59 xsi:type=""xsd:int"">1</c-gensym59>
      </Dispatch>
    </soap:Body>
  </soap:Envelope>
3. The result is in the XML format
If you meet problem, please give me an email, may I help a little bit. wangchiwei@gmail.com

How I went from $100-an-hour programming to $X0,000-a-week consulting.

https://training.kalzumeus.com/newsletters/archive/consulting_1

- Clients Pay For Value, Not For Time
- Charging Weekly: It Makes Everything Automatically Better
- Getting Clients: The Importance Of Social Proof
- Scaling A Consulting Business
- Hybridizing Consultancies With Product Businesses