2012-11-06 2 views
0

이것은 처음으로 비누로 작업합니다.SOAP 및 배열 + SUDS

나는 자습서를 따라하는 첫 걸음을 내딛었지만 지금은 붙어있다. Im는 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 = '[email protected]' 
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 작동합니다.

앨런

답변

1

는 ... 자신을 알아 냈어 내가해야 할 일을했을 무엇

했다 :

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) 

앨런