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

kdwsdl2cpp cycle reference #248

Open
pedromellofh opened this issue Apr 11, 2022 · 3 comments
Open

kdwsdl2cpp cycle reference #248

pedromellofh opened this issue Apr 11, 2022 · 3 comments

Comments

@pedromellofh
Copy link

suppose you're in a situation like that:

a "project" complex type with a list of complex type "task" which itself has a "project" attribute who refers to his parent "project"

the kdsoap generated code will cause an infinite recursive loop. is there a way to instruct kdwsdl2cpp to avoid this? the staff lib (https://github.com/loentar/staff) does that with an "annotation" in the header file. staff lib is not maintained anymore and I'm currently evaluating some alternatives to our Qt project. any advise would be appreciated.

@dfaure-kdab
Copy link
Member

Interesting problem.

We fixed a similar issue in the past like "Fix infinite recursion when type A contains a member A with minoccurs=0", by storing that member as a shared pointer or an optional.

I'm assuming that in your case, the project attribute doesn't have minoccurs=0, i.e. it's supposed to always be set?

What would such an annotation mean and do? Store this attribute as a pointer? (I guess optional doesn't really make sense here, if it's not actually optional).

Note that the object behind the pointer would still be a local duplicate of the actual project, but I suppose that's OK, it's not like the data structures generated by KDSoap are meant to be used for actual business logic, usually just for copying from/into them for SOAP calls.

@pedromellofh
Copy link
Author

I was looking at the staff lib's source trying to figure out what is going on under the hood... and I've found out that the annotation makes the serialization/deserialization code to traverse the already processed attributes to find one with the same name/type and, if it finds one, it simply uses the pointer to it. staff uses axis2c internally to generate the soap stuff.

I hope it helps to understand my point...

@pedromellofh
Copy link
Author

in time, the annotation tells the code generator that the collection has reference to the parent type

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

No branches or pull requests

2 participants