So ändern Sie die Konfiguration ElementFormDefault- und AttributeFormDefault -Felder im Python Spyne SOAP WSDL -Dienst
Posted: 11 Feb 2025, 07:02
Vielen Dank im Voraus für Ihre Hilfe und für das Lesen meiner Frage. < /p>
Der Dienst ist in Spyne geschrieben, was keine so explizite Funktion hat. Es generiert automatisch XML, in der es nur ein Feld gibt: < /p>
So erstelle ich meinen Dienst.from logging import getLogger
from spyne import Application
from spyne.protocol.soap import Soap11
from spyne.server.wsgi import WsgiApplication
from configs import APP_CONFIG
from routers import SameTestRouter
debug_loggers = getLogger('debug_logger')
soap_app = Application(
[SameTestRouter],
name=APP_CONFIG.APP_NAME,
tns=APP_CONFIG.URL_PREFIX,
in_protocol=Soap11(validator='lxml'),
out_protocol=Soap11()
)
wsgi_app = WsgiApplication(soap_app)
< /code>
Well, then there's the test method with its schematics, which I'm sending the message to. Well, it works if I explicitly specify the namespace, but I need it without explicitly specifying it.
class TestBlockTwo(ComplexModel):
__namespace__ = APP_CONFIG.URL_PREFIX
test_test = Unicode
test_test = Decimal
class message(ComplexModel):
__namespace__ = APP_CONFIG.URL_PREFIX
test_block_two = TestBlockTwo
class SameTestRouter(ServiceBase):
@rpc(TestBlockOne, _returns=Unicode)
def process(self, message: TestBlockOne) -> str:
passage = vars(message.test_block_two)
debug_loggers.info(f"Received data: {passage}")
< /code>
If you have encountered this, please tell me how it can be solved.
Der Dienst ist in Spyne geschrieben, was keine so explizite Funktion hat. Es generiert automatisch XML, in der es nur ein Feld gibt: < /p>
Code: Select all
< /code>
und das Ergebnis, das ich erreichen möchte, ist: < /p>
< attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://simpleTest/">
< /code>
Hier sind die Versionen, mit denen ich mit < /p>
arbeitespyne = 3.11.3< /code>
python = 2.14.0
So erstelle ich meinen Dienst.from logging import getLogger
from spyne import Application
from spyne.protocol.soap import Soap11
from spyne.server.wsgi import WsgiApplication
from configs import APP_CONFIG
from routers import SameTestRouter
debug_loggers = getLogger('debug_logger')
soap_app = Application(
[SameTestRouter],
name=APP_CONFIG.APP_NAME,
tns=APP_CONFIG.URL_PREFIX,
in_protocol=Soap11(validator='lxml'),
out_protocol=Soap11()
)
wsgi_app = WsgiApplication(soap_app)
< /code>
Well, then there's the test method with its schematics, which I'm sending the message to. Well, it works if I explicitly specify the namespace, but I need it without explicitly specifying it.
class TestBlockTwo(ComplexModel):
__namespace__ = APP_CONFIG.URL_PREFIX
test_test = Unicode
test_test = Decimal
class message(ComplexModel):
__namespace__ = APP_CONFIG.URL_PREFIX
test_block_two = TestBlockTwo
class SameTestRouter(ServiceBase):
@rpc(TestBlockOne, _returns=Unicode)
def process(self, message: TestBlockOne) -> str:
passage = vars(message.test_block_two)
debug_loggers.info(f"Received data: {passage}")
< /code>
If you have encountered this, please tell me how it can be solved.