Reputation: 31
I am trying to change the value of the returned XML element of my simple twisted SOAP server. (I generated the server with wsdl2py --twisted --complexType Myservice.wsdl
.)
My return element XSD looks like this:
<xs:element name="ReplyMessage" type="ReplyTypeEnum">
</xs:element>
<xs:simpleType name="ReplyTypeEnum">
<xs:restriction base="xs:string">
<xs:enumeration value="OK" />
<xs:enumeration value="NOT_VALID" />
<xs:enumeration value="ERROR" />
</xs:restriction>
</xs:simpleType>
</xs:simpleType>
My server currently returns this:
<SOAP-ENV:Envelope>
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns1:ReplyMessage/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I would like to return this (i.e. the value 'OK'
):
<SOAP-ENV:Envelope>
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns1:ReplyMessage>OK</ns1:ReplyMessage>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
My Python code which should change the value looks like this:
def __composeResponse_OK(self, response):
response._ReplyMessage = 'OK'
return response
but that, obviously, doesn't work. I have tried a few other ways, but none of them works. I am simply unable to change the value of the returned response!
Is there a way to add the value 'OK'
(or 'ERROR'
or 'NOT_VALID'
) into my response?
Upvotes: 1
Views: 181