Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change name of part in wsdl message “wsdl:part” #543

Open
przemyslaw-szurmak opened this issue Sep 23, 2017 · 4 comments
Open

Change name of part in wsdl message “wsdl:part” #543

przemyslaw-szurmak opened this issue Sep 23, 2017 · 4 comments

Comments

@przemyslaw-szurmak
Copy link

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 :(

@kcollins-ene
Copy link

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.

@przemyslaw-szurmak
Copy link
Author

@kcollins-ene Hey, I've forked repo and made a little bit of workaround -> przemyslaw-szurmak@cb1814d which works fine for me.

Just keep in mind that I did not synchronized with main repo recently so code there is pretty old

@plq plq changed the title [Question] Change name of part in wsdl message “wsdl:part” Change name of part in wsdl message “wsdl:part” Mar 31, 2018
@plq
Copy link
Member

plq commented Mar 31, 2018

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.

@kcollins-ene
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants