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

SoapInclude and XmlInclude attributes are ignored #1071

Closed
lucamorelli opened this issue Jun 21, 2024 · 6 comments
Closed

SoapInclude and XmlInclude attributes are ignored #1071

lucamorelli opened this issue Jun 21, 2024 · 6 comments
Labels

Comments

@lucamorelli
Copy link

I'm converting an app to asp.net core, and the classes are full of ArrayList, so I have to serialize them
If I write a method like this

        [XmlInclude(typeof(DocsPaVO.ProfilazioneDinamica.Templates))]
        [SoapInclude(typeof(DocsPaVO.ProfilazioneDinamica.Templates))]
        public ArrayList getTemplates(string idAmministrazione)
        {
            try
            {
                var result = BusinessLogic.ProfilazioneDinamica.ProfilazioneDocumenti.getTemplates(idAmministrazione);
				//return result.OfType<DocsPaVO.ProfilazioneDinamica.Templates>().ToList();
                return result;
            }
            catch (Exception e)
            {
                logger.Debug("Errore in DocsPaWS.asmx  - metodo: getTemplates", e);
                return null;
            }
        }

When executed gives me this error

System.InvalidOperationException: There was an error generating the XML document.
---> System.InvalidOperationException: The type DocsPaVO.ProfilazioneDinamica.Templates was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.

why is soapcore ignoring the attribute?

@andersjonsson
Copy link
Collaborator

Unfortunately support for XmlInclude and SoapInclude has not been implemented. You are more than welcome to give it a shot if you feel up to the task.

Otherwise I'd recommend using the more specific type as return type and experimenting to see if you can coax legacy clients to accept that

@lucamorelli
Copy link
Author

could be nice, but I don't know how to do. Where can I find info?

@andersjonsson
Copy link
Collaborator

Unfortunately I don't know the details of those attributes but I imagine that you would need to add info in the wsdl (MetaBodyWriter and MetaWCFBodyWriter) and also some modifications in ServiceBodyWriter since the type of the responseObject will differ from the expected type.

I suspect that the error message you got came from ServiceBodyWriter

@lucamorelli
Copy link
Author

I'm doing some tests and even removing the arraylist properties I have serialization problems. Do you have any suggestion on how troubleshoot serialization/deserialization problems?

Copy link

github-actions bot commented Aug 1, 2024

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Aug 1, 2024
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

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

No branches or pull requests

2 participants