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

SVCUTIL generates methods without arguments #5468

Open
Axeltherabbit opened this issue Mar 28, 2024 · 6 comments
Open

SVCUTIL generates methods without arguments #5468

Axeltherabbit opened this issue Mar 28, 2024 · 6 comments
Assignees

Comments

@Axeltherabbit
Copy link

Describe the bug
Broken class is generated from wsdl

To Reproduce
I'm importing this webservice in visual studio: https://api.learningassistant.com/webservices/soap/company.cfc?wsdl
the methods that are generated don't have any arguments

Expected behavior
A working class is generated

Additional context
version: [Microsoft.Tools.ServiceModel.Svcutil, Version 2.2.0-preview1.23462.5]

@imcarolwang
Copy link
Contributor

I have tried running the tool against the given wsdl and encountered below warnings, the warnings indicate that the wsdl file contains some elements that are not supported by the tool, this might result in incomplete or incorrect code generation.

Warning: Fault named CFCInvocationException in operation GetCompanies cannot be imported. Unsupported WSDL, the fault message part must reference an element.
Warning: Headers are not supported in RPC encoded format. Headers are ignored in message GetCompaniesRequest.

Svcutil.exe and dotnet-svcutil.exe behave the same, so it doesn't seem to be regression issue of dotnet-svcutil tool.

@Axeltherabbit
Copy link
Author

What do you advice? Is there an easy way to self implement the custom header and the missing arguments? I didn't find much online about it.

I also noticed that the arguments are generated correctly when the method is generated async but they aren't present if I generate a sync method.

@imcarolwang
Copy link
Contributor

Hi, as per this warning message "Unsupported WSDL, the fault message part must reference an element." , I tried to fix it by saving the WSDL locally and do below updates to the file:

  1. update from
    <wsdl:message name="CFCInvocationException">
    <wsdl:part name="fault" type="tns2:CFCInvocationException"/>
    </wsdl:message>

    to
    <wsdl:message name="CFCInvocationException">
    <wsdl:part name="fault" element="tns2:CFCInvocationException"/>
    </wsdl:message>

  2. Since element="tns2:CFCInvocationException" is not defined, add the element for CFCInvocationException right below its type definition:

    <element name="CFCInvocationException" nillable="true" type="tns2:CFCInvocationException"/>

With the updates, dotnet-svcutil generates both sync and async operations with arguments.

Hope this helps.

@Axeltherabbit
Copy link
Author

Thank you, is there no workaround to also add the header?

@imcarolwang
Copy link
Contributor

Thank you, is there no workaround to also add the header?

Running the dotnet-svcutil tool with --messageContract (short form: -mc) option to generate message contract types for the given wsdl will have the message header data generated. However, it might not work as expected, since the service uses legacy SOAP encoding style of XML and according to this document , WCF allows you to use the legacy SOAP encoding style of XML, however, its use is not recommended, one of the considerations is that MessageHeaderAttribute is incompatible with SOAP encoding.

@Axeltherabbit
Copy link
Author

Axeltherabbit commented Apr 24, 2024

Thank you, yes I get the header this way but it doesn't generate the methods properly, I reported these issues to the API providers, hopefully they are able to fix it.

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