【问题标题】:OTRS - Get article attachment through SOAPOTRS - 通过 SOAP 获取文章附件
【发布时间】:2014-06-11 10:22:10
【问题描述】:

在 OTRS 3.2 服务器中通过 SOAP 通用接口与 php 和 java 访问票证及其文章信息没有问题。但在 xml 响应中,我没有关于文件附件的信息。

首先,根据这个 API 文档 (http://otrs.github.io/doc/api/otrs/3.2/Kernel/GenericInterface/Operation/Ticket/TicketGet.pm.html),我使用 TicketGet 函数并将参数 DynamicFields、Extended、AllArticles 和 Attachments 设置为 1 来获取票证,但我没有得到任何关于文章的信息。

接下来,根据这个API(http://otrs.github.io/doc/api/otrs/3.2/Kernel/System/Ticket/Article.pm.html),我用函数ArticleIndex来获取Id的票文章,然后ArticleGet获取带有附件的文章。我得到带有消息正文的文章信息,但响应中没有附件。

函数调用有问题?也许我缺少一些参数。 或者可能存在错误的 OTRS 配置。在 Admin->System config->Framework and Ticket options 中有很多东西需要改变。

谢谢

【问题讨论】:

    标签: xml web-services soap otrs


    【解决方案1】:

    刚刚使用 OTRS Help Desk 3.3.8OTRS Appliance 1.0.8 上进行了测试,对我来说一切都很好。我可以使用 TicketGet 方法获取文章和附件。

    请参阅以下 article 描述如何设置 OTRS Web 服务 设置。

    OTRS Web Service 设置完成后,我通过 SoapUI 将以下 SOAP 请求发送到 OTRS Ticket Connector 端点(在我的情况下为 http://192.168.112.34/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnector):

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Body>
          <TicketGet>
             <UserLogin>root@localhost</UserLogin>
             <Password>root</Password>
             <TicketID>965</TicketID>
             <AllArticles>1</AllArticles>
             <Attachments>1</Attachments>
        </TicketGet>
       </soapenv:Body>
    </soapenv:Envelope>
    

    并得到以下响应:

    <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>
        <TicketGetResponse xmlns="http://www.otrs.org/TicketConnector/">
          <Ticket>
            <Age>160723</Age>
            <ArchiveFlag>n</ArchiveFlag>
            <Article>
              <ArticleID>3260</ArticleID>
              <ArticleType>webrequest</ArticleType>
              ...
              <Attachment>
                <Content>
                  W0dlbmVyYWxdDQpTZXJ2ZXI9Mg0KQ3JlYXRlVGFibGU9MA0KW0Rlc3RdDQpTYXZlVG9GaWxlPTEN
                  ...
                  aXNoXQ0KTG9hZEludG9FZGl0b3I9MA0KQ2xvc2VBZnRlckNvbXBsaXRlPTANCg==
                </Content>
                <ContentAlternative/>
                <ContentID/>
                <ContentType>text/plain</ContentType>
                <Filename>1.smt</Filename>
                <Filesize>673 Bytes</Filesize>
                <FilesizeRaw>673</FilesizeRaw>
              </Attachment>
              <Attachment>
                <Content>
                  REVDTEFSRSBAUkMgaW50DQpERUNMQVJFIEBMb2dnZWRVc2VySUQgaW50DQpERUNMQVJFIEBVc2Vy
                  ...
                  Y2hhbmdlc1htbA0KICAsQEJhc2VDb250cmFjdHNYbWwNCkdPDQoNCg==
                </Content>
                <ContentAlternative/>
                <ContentID/>
                <ContentType>application/octet-stream</ContentType>
                <Filename>3.sql</Filename>
                <Filesize>610 Bytes</Filesize>
                <FilesizeRaw>610</FilesizeRaw>
              </Attachment>
              <AttachmentIDOfHTMLBody>3</AttachmentIDOfHTMLBody>
              <Body>sdfghhfghg</Body>
            ...
            </Article>
          ...
          </Ticket>
        </TicketGetResponse>
      </soap:Body>
    </soap:Envelope>
    

    如您所见,我收到票的初始文章,里面有 2 个附件。

    希望这对您有所帮助,或者毫不犹豫地提供反馈。

    【讨论】:

    • @user1151816:如果我的回答有帮助,您能接受和/或投票吗?一年多过去了,由于没有给出任何反馈/接受,这个帖子看起来已经被更多的读者抛弃了。谢谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-08
    • 1970-01-01
    • 2011-03-26
    • 1970-01-01
    相关资源
    最近更新 更多