Hello all, I'm trying to figure out how to make soaplib produce a server-side response with appropriate name spaces.
I mostly use the __namespace__ attribute in classes, but it doesn't seem to work the way I'd like. Here is a simplified example; I'd like to get the following output : <senv:Envelope xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/ xmlns:s0="my_first_ns" xmlns:s1="my_second_ns" xmlns:s3="my_third_ns"> <senv:Body> <s0:MyFunctionResponse> <s1:FirstItem> <s3:field1>Some data</s3:field1> <s1:field2>Some more data</s1:field1> </s1:FirstItem> <SecondItem> <- I want this one to be without NS <field>A field without NS</field> </SecondItem> </s0:MyFunctionResponse> </senv:Body> </senv:Envelope> In order to get this I do the following declarations: class ThirdNSString(String): __namespace__ = "my_third_ns" class FirstItemClass(ClassModel): __namespace__ = "my_first_ns" field1 = ThirdNSString field2 = String class MyFunctionResponseClass(ClassModel): __namespace__ = "my_first_ns" FirstItem = FirstItemClass class SecondItemClass(ClassModel): __namespace__ = "my_fourth_ns" #<- I'd like it to be empty; if this is not declared, the script crashes field = String The data is produced as follows : rep = MyFunctionResponseClass() rep.FirstItem = FirstItemClass() rep.FirstItem.field1 = "Some data" rep.FirstItem.field2 = "Some more data" rep.SecondItem = SecondItemClass() rep.SecondItem.field = "A field without NS" return rep However here is the output I get : <?xml version="1.0" encoding="UTF-8"?><senv:Envelope xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s0="some_ns_from_the_request" xmlns:s4="my_first_ns" xmlns:s5="my_fourth_ns" xmlns:s6="my_third_ns"> <senv:Body> <s0:MyFunctionResponse> <s0:SecondItem> <s5:field>A field without NS</s5:field> </s0:SecondItem> <s0:FirstItem> <s4:field2>Some more data</s4:field2> <s4:field1>Some data</s4:field1> </s0:FirstItem> </s0:MyFunctionResponse> </senv:Body></senv:Envelope> Would someone be kind enough to help me figure it out ? Thanks in advance. -- Philippe
_______________________________________________ Soap mailing list [email protected] https://mail.python.org/mailman/listinfo/soap
