1

django で SOAP サーバーを実行しています。

<{メソッド名}Response><{メソッド名}Result>タグなしでsoaplibクラスモデルインスタンスを返すsoapメソッドを作成することは可能ですか?

たとえば、これは私の SOAP サーバー コードの一部です。

# -*- coding: cp1254 -*-
from soaplib.core.service import rpc, DefinitionBase, soap
from soaplib.core.model.primitive import String, Integer, Boolean
from soaplib.core.model.clazz import Array, ClassModel 
from soaplib.core import Application
from soaplib.core.server.wsgi import Application as WSGIApplication
from soaplib.core.model.binary import Attachment    


class documentResponse(ClassModel):
    __namespace__ = ""
    msg = String
    hash = String


class MyService(DefinitionBase):
    __service_interface__ = "MyService"


    __port_types__ = ["MyServicePortType"]




    @soap(String, Attachment, String ,_returns=documentResponse,_faults=(MyServiceFaultMessage,)  , _port_type="MyServicePortType"  )
    def sendDocument(self, fileName, binaryData, hash ):

        binaryData.file_name = fileName
        binaryData.save_to_file()


        resp = documentResponse()
        resp.msg = "Saved"
        resp.hash = hash
        return resp

そして、それは次のように応答します:

 <senv:Body>
   <tns:sendDocumentResponse>
     <tns:sendDocumentResult>
      <hash>14a95636ddcf022fa2593c69af1a02f6</hash>
      <msg>Saved</msg>
    </tns:sendDocumentResult>
  </tns:sendDocumentResponse>
</senv:Body>

しかし、私はこのような応答が必要です:

<senv:Body>
   <ns3:documentResponse>
     <hash>A694EFB083E81568A66B96FC90EEBACE</hash>
     <msg>Saved</msg>
  </ns3:documentResponse>
</senv:Body>

上記の 2 番目の応答を取得するには、どのような構成を行う必要がありますか?

前もって感謝します。

4

1 に答える 1