Change name of part in wsdl message “wsdl:part”
I've created this as a question on Stack but maybe I could find answer here a bit quicker :)
in my case, in order to keep conformance with some existing SOAP client "name" of "part" in "message" element of WSDL needs to be "parameters" like here
<wsdl:message name="Notify">
<wsdl:part name="parameters" element="tns:Notify"/>
</wsdl:message>
<wsdl:message name="NotifyResponse">
<wsdl:part name="parameters" element="tns:NotifyResponse"/>
</wsdl:message>
Currently I don't see any way of doing that in Spyne. I went through documentation, source code and it seems that WSDL generator always takes the same value for "name" of "part" as for "name" of whole "message"
(spyne/interface/wsdl/wsdl11.py)
def add_messages_for_methods(self, service, root, messages):
for method in service.public_methods.values():
self._add_message_for_object(root, messages, method.in_message,
method.in_message.get_element_name())
(...)
def _add_message_for_object(self, root, messages, obj, message_name):
(...)
message = SubElement(root, WSDL11("message"))
message.set('name', message_name)
for obj in objs:
part = SubElement(message, WSDL11("part"))
part.set('name', obj.get_element_name())
part.set('element', obj.get_element_name_ns(self.interface))
So basically "name" for "message" message_name is method.in_message.get_element_name() and that's the same case for "name" in "part" as obj.get_element_name() -> method.in_message.get_element_name()
However, in Python I've never done anything larger then 3 lines of code and it took me a while to understand all of this (Swift/Objc programmer here) I might be missing something and maybe there's some nice easy method to do that ?
As a quick and poor hack/workaround I've just changed part.set('name', obj.get_element_name()) into part.set('name', 'parameters') and in my case (my wsdl is really simple with just two methods and not many arguments) it works just fine but I'm totally aware how bad this is in terms of breaking SOAP/WSDL logic and code quality :( SOAP standard looks to me way overcomplicated/complex and it's my first time ever to deal with it so my understanding of importance of each element is quite low :(
I've also come across this need.. I'm working with Deltek Vision, and their Invoke Web Service request expects the message part name attributes to be explicitly set to parameters.. Very troubling.. It would be nice if we could add some overrides in the RPC decorator to override the part names.
@kcollins-ene Hey, I've forked repo and made a little bit of workaround -> https://github.com/przemyslaw-szurmak/spyne/commit/cb1814d929c4c7c39a9b1315f05edacbabafede1 which works fine for me.
Just keep in mind that I did not synchronized with main repo recently so code there is pretty old
questions go to the mailing list.
I see that the provided patches hardcode "parameters". I can't accept them. I can accept a patch that parametrizes the value though.
If I end up moving forward with spyne for this project (that requires this adjustment), I'll have a go at putting that together, @plq. Thanks for helping with this great project!