3

The lack of documentation on this subject coupled with the fact that I'm struggling with a learning curve on all fronts and making me really confused about where to start. I need to get this done using C# if possible. I apologize for the vagueness of this question, but I'm really lost. I would love links to comprehensive guides/references.

In my efforts to get this done, I've run into the following problems/questions:

  • I've created a web service using the otrs gui, with the operation CreateTicket, but requests via C# to my chosen namespace are returning 404 (not found). When I try to add a service reference or web reference with that namespace, I get the same error. However, when I plug that namespace into my browser as the url, it displays "customer.pl".

  • Can I send a soap request without adding the web service as a service reference in visual studio? Given the previous problem I'm having I can't do it that way. Would I just build the soap request string and write it to the web request's data stream with http://domain/rpc.pl as the uri?

  • If the answer to the previous question is yes... When trying the below code segment I get an internal server error (500) on the last line. However the header looks like a SOAP header which confuses me because I wouldn't have thought it got that far.

        var document = new StringBuilder();
    
        document.Append("<UserLogin>some user login</UserLogin>");
        document.Append("<Password>some password</Password> ");
        document.Append("<Ticket>");
        document.Append("<Title>some title</Title> ");
        document.Append("<CustomerUser>some customer user login</CustomerUser>");
        document.Append("<Queue>some queue</Queue>");
        document.Append("<State>some state</State>");
        document.Append("<Priority>some priority</Priority>");
        document.Append("</Ticket>");
        document.Append("<Article>");
        document.Append("<Subject>some subject</Subject>");
        document.Append("<Body>some body</Body>");
        document.Append("<ContentType>text/plain; charset=utf8</ContentType>");
        document.Append("</Article>");
    
        //var uri = new Uri("http://domain/injest");
        var uri = new Uri("http://domain/rpc.pl");
        var httpWebReq = (HttpWebRequest)WebRequest.Create(uri);
        var bytePostData = Encoding.UTF8.GetBytes(document.ToString());
        httpWebReq.Timeout = 5 * 1000;
        httpWebReq.Method = "POST";
        httpWebReq.ContentLength = bytePostData.Length;
        httpWebReq.ContentType = "text/xml;charset=utf-8";
        //httpWebReq.TransferEncoding=
        //httpWebReq.ContentType = "application/xml";
        //httpWebReq.Accept = "application/xml";
        var dataStream = httpWebReq.GetRequestStream();
    
        dataStream.Write(bytePostData, 0, bytePostData.Length);
        dataStream.Close();
        var httpWebResponse = (HttpWebResponse)httpWebReq.GetResponse();
    

Even if all you can offer is where to start, it would help me to know how to proceed, as I'm stumped.

b15
  • 2,101
  • 3
  • 28
  • 46

1 Answers1

3

You're using the rpc.pl endpoint which is part of the 'old' RPC-style interface. You mention you added the web service via the GUI which means you're using the 'new' Generic Interface, which is indeed much easier from .Net.

The address of the endpoint is /otrs/nph-genericinterface.pl/Webservice/GenericTicketConnector or whatever you have called the web service in the admin section.

MichielB
  • 4,181
  • 1
  • 30
  • 39
  • 1
    Is there any documentation on how to do this via .Net? I can't find anything. – b15 May 28 '13 at 12:09