1

I've built a simple service with spyne and there is one issue - it will wrap method input parameters into complex types - :

class JiraAdapter(ServiceBase):

    @srpc(Unicode, Unicode, Unicode, _returns=String)
    def CreateJiraIssueWithBase64Attachment(summary, base64attachment, attachment_filename):
        status = Status
        try:
            newkey = jira_client.createWithBase64Attachment(summary, base64attachment.decode('string-escape'), attachment_filename)
            status.Code = StatusCodes.IssueCreated
            status.Message = unicode(newkey)
        except Exception as e:
            status.Code = StatusCodes.FailedToCreateIssue
            status.Message = u'Internal Exception: %s' % e.message
        return status.__str__()

    application = Application([JiraAdapter],
    tns='JiraAdapter',
    in_protocol=Soap11(),
    out_protocol=Soap11()
)

Results in the following WSDL (coping just the relative bits):

<wsdl:portType name="Application">
<wsdl:operation name="CreateJiraIssueWithBase64Attachment" parameterOrder="CreateJiraIssueWithBase64Attachment">
<wsdl:input name="CreateJiraIssueWithBase64Attachment" message="tns:CreateJiraIssueWithBase64Attachment"/>
<wsdl:output name="CreateJiraIssueWithBase64AttachmentResponse" message="tns:CreateJiraIssueWithBase64AttachmentResponse"/>
</wsdl:operation>
</wsdl:portType>

    ....

<xs:complexType name="CreateJiraIssueWithBase64Attachment">
<xs:sequence>
<xs:element name="summary" type="xs:string" minOccurs="0" nillable="true"/>
<xs:element name="base64attachment" type="xs:string" minOccurs="0" nillable="true"/>
<xs:element name="attachment_filename" type="xs:string" minOccurs="0" nillable="true"/>
</xs:sequence>
</xs:complexType>

Is there a way to make spyne build wsdl the way that it just requires a sequence of parameters? The client application is written in VBA and God only knows how to submit complex type parameter with it.

abolotnov
  • 4,282
  • 9
  • 56
  • 88

0 Answers0