【问题标题】:Suds error when creating a issue for Jira为 Jira 创建问题时出现泡沫错误
【发布时间】:2012-06-03 14:12:33
【问题描述】:

每次我尝试向 Jira 发送问题时都会收到以下错误:

suds.WebFault: Server raised fault: 'org.xml.sax.SAXException: 
   Found character data inside an array element while deserializing'

我在 stackoverflow 和网络上搜索答案,有人说这是 suds 0.3

这是我的问题字典:

  issue = {"assignee": "user_test",
             "components": "17311",
             "project": "TES",
             "description" : "This is a test",
             "priority" : "Major",
             "summary" : "Just a test title",
             "type":"Incident"
             }

我制作的 Jira 类:

  def create_issue(self,issue):
        if(not isinstance(issue,dict)):
            raise Exception("Issue must be a dict")

        new_issue = self.jira.service.createIssue(in0 = self.auth,in1 = issue)

        return new_issue["key"]

【问题讨论】:

  • 不应该是问题对象而不是字典吗? self.jira.factory.create('Issue')

标签: python soap jira suds


【解决方案1】:

使用 jira-python 我可以添加类似的组件:

jira.create_issue(project={'key': project_id}, summary=ticket_summary,
                                 description=ticket_description, issuetype={'name': ticket_issue_type},
                                 components=[{'name': 'Application Slow'},], parent={'id': new_issue_key}, customfield_10101=termination_change_date,
                                 )

我一直试图以“components={'name': 'Application Slow'}”的形式发送一个组件,但我得到一个“数据不是数组”(或类似的东西)。我查看了 REST API 以及他们的一些数组示例是如何组成的,这就是我上面示例的方式。

https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Create+Issue#JIRARESTAPIExample-CreateIssue-Request

Labels
"customfield_10006": ["examplelabelnumber1", "examplelabelnumber2"]
Labels are arrays of strings

我知道这有点离题,但是当我搜索我的问题时,我发现自己经常回到这里,所以我希望这对您和其他任何人都有帮助。概念与 components 字段相同,只接受一个对象数组。

【讨论】:

    【解决方案2】:

    组件不正确。它必须是一系列事物,因为它是多值的。 https://developer.atlassian.com/display/JIRADEV/Creating+a+JIRA+SOAP+Client 的一些提示或查看 JIRA Python CLI 是如何实现的

    '组件':[17311]

    【讨论】:

      猜你喜欢
      • 2018-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多