On 10/26/12 16:42, Jaakko Rytkönen wrote:
26.10.2012 15:34, Burak Arslan kirjoitti:
On 10/26/12 02:17, Jaakko Rytkönen wrote:
:D
No worries, I managed to parse the soap request from raw xml with lxml.
But I need the feature in near future and would like to convert the
patchy approach with something more decent than raw xml parsing.
Especially Ms related services seem to use the bare convention.
Merhaba Jaakko,
So, I did fix the unwrapped style, at least for soap.
However, do you think the output in this test case is legal?
https://github.com/plq/spyne/blob/16311ea2f234adc8e96df22ecbdabd73f5ebe3d3/spyne/test/test_service.py#L374
The output seems legit, but how about the input, when schema looks like:
<types>
<xsd:schema elementFormDefault="qualified" targetNamespace="Blah.Orders">
<xsd:element name="OrderString" type="xsd:string" />
<xsd:element name="OrderStringResponse" type="xsd:boolean" />
</xsd:schema>
</types>
Hi Jaakko,
Hmmm. There's no way to generate that schema with Spyne as of trunk.
And request looks like:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:bl="Blah.Orders">
<soapenv:Header/>
<soapenv:Body>
<bl:OrderString>ORDER_IN_ONE_BUNCH_OF_STRINGS</bl:OrderString>
</soapenv:Body>
</soapenv:Envelope>
How do I get my hands on ORDER_IN_ONE_BUNCH_OF_STRINGS -value from
OrderService class?
Note that this is not xml-structure but just as it says, a string.
... So the test case from line
https://github.com/plq/spyne/blob/16311ea2f234adc8e96df22ecbdabd73f5ebe3d3/spyne/test/test_service.py#249
class SomeService(ServiceBase):
@rpc(String, _body_style='bare')
def some_call(ctx, s):
assert s == 'abc'
app = Application([SomeService], 'tns', in_protocol=Soap11(),
out_protocol=Soap11(cleanup_namespaces=True))
would take input like :
req = """
<senv:Envelope xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns="tns">
<senv:Body>
<tns:some_call>abc</tns:some_call> *<-- Note Not wrapped in
<tns:s></tns:s>**-block*
</senv:Body>
</senv:Envelope>
"""
and practically hide s-parameter from some_call -method, but enable
convenient way to get the s-string anyway.
I'm not sure what would be the most convenient way to enable this.
Adding Body method ??!?
@rpc(String, _body_style='bare')
def body(ctx, some_call):
# some_call = "abc" at his stage
No, I don't think that's a good idea. The right thing to do here would
be to force the user to implement functions that can accept 0 or 1 argument.
I'd also prefer to have _output_body_style and _input_body_style in the
decorator. Do you think it's actually needed?
Can you use use ctx.in_body_document to reach that string? Lxml
validator would not accept that message but soft validation would.
Burak
_______________________________________________
Soap mailing list
[email protected]
http://mail.python.org/mailman/listinfo/soap