1

这是我第一次使用肥皂。

我设法按照教程迈出了第一步,但现在我卡住了。我正在尝试使用 mantis (mantisbt.org)。我试图将此类数据发布到服务器:

<xsd:complexType name="IssueData">
<xsd:all>
<xsd:element name="id" type="xsd:integer" minOccurs="0"/>
<xsd:element name="view_state" type="tns:ObjectRef" minOccurs="0"/>
<xsd:element name="last_updated" type="xsd:dateTime" minOccurs="0"/>
<xsd:element name="project" type="tns:ObjectRef" minOccurs="0"/>
<xsd:element name="category" type="xsd:string" minOccurs="0"/>
<xsd:element name="priority" type="tns:ObjectRef" minOccurs="0"/>
<xsd:element name="severity" type="tns:ObjectRef" minOccurs="0"/>
<xsd:element name="status" type="tns:ObjectRef" minOccurs="0"/>
<xsd:element name="reporter" type="tns:AccountData" minOccurs="0"/>
<xsd:element name="summary" type="xsd:string" minOccurs="0"/>
<xsd:element name="version" type="xsd:string" minOccurs="0"/>
<xsd:element name="build" type="xsd:string" minOccurs="0"/>
<xsd:element name="platform" type="xsd:string" minOccurs="0"/>
<xsd:element name="os" type="xsd:string" minOccurs="0"/>
<xsd:element name="os_build" type="xsd:string" minOccurs="0"/>
<xsd:element name="reproducibility" type="tns:ObjectRef" minOccurs="0"/>
<xsd:element name="date_submitted" type="xsd:dateTime" minOccurs="0"/>
<xsd:element name="sponsorship_total" type="xsd:integer" minOccurs="0"/>
<xsd:element name="handler" type="tns:AccountData" minOccurs="0"/>
<xsd:element name="projection" type="tns:ObjectRef" minOccurs="0"/>
<xsd:element name="eta" type="tns:ObjectRef" minOccurs="0"/>
<xsd:element name="resolution" type="tns:ObjectRef" minOccurs="0"/>
<xsd:element name="fixed_in_version" type="xsd:string" minOccurs="0"/>
<xsd:element name="target_version" type="xsd:string" minOccurs="0"/>
<xsd:element name="description" type="xsd:string" minOccurs="0"/>
<xsd:element name="steps_to_reproduce" type="xsd:string" minOccurs="0"/>
<xsd:element name="additional_information" type="xsd:string" minOccurs="0"/>
<xsd:element name="attachments" type="tns:AttachmentDataArray" minOccurs="0"/>
<xsd:element name="relationships" type="tns:RelationshipDataArray" minOccurs="0"/>
<xsd:element name="notes" type="tns:IssueNoteDataArray" minOccurs="0"/>
<xsd:element name="custom_fields" type="tns:CustomFieldValueForIssueDataArray" minOccurs="0"/>
<xsd:element name="due_date" type="xsd:dateTime" minOccurs="0"/>
<xsd:element name="monitors" type="tns:AccountDataArray" minOccurs="0"/>
<xsd:element name="sticky" type="xsd:boolean" minOccurs="0"/>
<xsd:element name="tags" type="tns:ObjectRefArray" minOccurs="0"/>
</xsd:all>
</xsd:complexType>

它工作得很好。但后来我发现我还需要填写一些custom_fields。它们被描述为 tns:CustomFieldValueForIssueDataArray。

<xsd:complexType name="CustomFieldValueForIssueDataArray">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:CustomFieldValueForIssueData[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>

我从中读到这应该由 CustomFieldValueForIssueData 对象组成。

所以我用相关数据创建了两个:

contact_data = client.factory.create('CustomFieldValueForIssueData')
contact_data.field = contact_field
contact_data.value = 'alan@mysite.ee'
client_data = client.factory.create('CustomFieldValueForIssueData')
client_data.field = client_field
client_data.value = u'alan, alan kesselmann'

但是现在如何添加/追加/推送/任何这些值到数组中?如果我尝试做这样的事情:

issue.custom_fields = [client_field, contact_field]

然后使用:

client.service.mc_issue_add(user, pwd, issue)

然后我得到的只是一个错误。没有 custom_fields 这个 ms_issue_add 有效。

艾伦

4

1 回答 1

2

我自己想通了...

我必须做的是:

customfields = client.factory.create('CustomFieldValueForIssueDataArray') #had done it before too
customfields.items = [client_data, contact_data] # the new stuff that i didnt know
issue.custom_fields = customfields
client.service.mc_issue_add(user, pwd, issue)

艾伦

于 2012-11-07T10:45:25.707 回答