我试图用django1.5.2和python2.7.3和soaplib0.8.1开发soapweb服务。 目前一切正常,但现在我需要将命名空间添加到@soapmethod响应中。在
这是我的观点:
from sms.soaplib_handler import DjangoSoapApp, soapmethod, soap_types
from django.views.decorators.csrf import csrf_exempt
class SmsGatewayService(DjangoSoapApp):
__tns__ = 'http://mismsgw01.milano.ea.it/soap'
@soapmethod(
soap_types.String,
soap_types.String,
soap_types.String,
soap_types.Integer,
soap_types.Boolean,
soap_types.Boolean,
soap_types.String,
_returns=soap_types.Any
)
def sendSms(
self,
sendTo,
numSender,
senderDescription,
timeToLive,
isDelivered,
isStatistics,
messageText
):
retCode = '<retCode>OK</retCode>'
return retCode
sms_gateway_service = csrf_exempt(SmsGatewayService())
这是我调用方法时的响应:
^{pr2}$有人能帮我吗?如何修改soap响应?我需要一些类似的东西:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<sendSmsResponse xmlns="http://mismsgw01.milano.ea.it/soap">
<retCode>OK</retCode>
</sendSmsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
提前谢谢
您应该使用Spyne而不是SoapLib。由于Spyne是从soapLib构建的,代码的精神将保留下来,Spyne可以很好地使用自己的wsdl。在
相关问题 更多 >
编程相关推荐