wcf
wcf copied to clipboard
Client can not be generated
Hello.
We try to move from Web References
to .Net Standard and Service references
. The most of the services we use, we could regenerate with dotnet-svcutil
. But for the following it doesn't work:
- https://secure.umweltbundesamt.at/ebsws/FetchService?wsdl
The generated file hase only 5 types (of over 100 in the Web References). And no client is generated.
Here is the command line, that I used:
dotnet svcutil https://secure.umweltbundesamt.at/ebsws/FetchService?wsdl -n "*,Services.eRAS.Delivery" -o "DeliveryService" -nl -mc -i -d "ServiceReferences/Delivery"
During the generation I get the following output:
PS C:\src\PROJECT\src\Services.eRAS> dotnet svcutil https://secure.umweltbundesamt.at/ebsws/FetchService?wsdl -n "*,Services.eRAS.Delivery" -o "DeliveryService" -nl -mc -i -d "ServiceReferences/Delivery"
Resolving project references ...
Attempting to download metadata from 'https://secure.umweltbundesamt.at/ebsws/FetchService?wsdl' using WS-Metadata Exchange and HttpGet.
Warning: There was a validation error on a schema generated during export:
Source:
Line: 2 Column: 150
Validation Error: The 'http://edm.umweltbundesamt/ebsmws/datatypes:EBSConsignmentNoteNotification' element is not declared.
Warning: There was a validation error on a schema generated during export:
Source:
Line: 2 Column: 175
Validation Error: Type 'http://edm.umweltbundesamt/ebsmws/datatypes:FEAAPartyGLNUsgAIdentifierType' is not declared.
Warning: There was a validation error on a schema generated during export:
Source:
Line: 2 Column: 176
Validation Error: Type 'http://edm.umweltbundesamt/ebsmws/datatypes:EBSConsignmentNoteType' is not declared.
Warning: There was a validation error on a schema generated during export:
Source:
Line: 2 Column: 282
Validation Error: Type 'http://edm.umweltbundesamt/ebsmws/datatypes:FEAAPartyGLNUsgAIdentifierType' is not declared.
Warning: There was a validation error on a schema generated during export:
Source:
Line: 2 Column: 283
Validation Error: Type 'http://edm.umweltbundesamt/ebsmws/datatypes:EBSConsignmentNoteType' is not declared.
Warning: There was a validation error on a schema generated during export:
Source:
Line: 2 Column: 225
Validation Error: Type 'http://edm.umweltbundesamt/ebsmws/datatypes:AustrianMaterialMovementIdentifierType' is not declared.
Warning: There was a validation error on a schema generated during export:
Source:
Line: 2 Column: 258
Validation Error: Type 'http://edm.umweltbundesamt/ebsmws/datatypes:FEAAPartyGLNUsgAIdentifierType' is not declared.
Warning: There was a validation error on a schema generated during export:
Source:
Line: 2 Column: 279
Validation Error: Type 'http://edm.umweltbundesamt/ebsmws/datatypes:FEAAOperatingSiteGLNUsgAIdentifierType' is not declared.
Warning: There was a validation error on a schema generated during export:
Source:
Line: 2 Column: 277
Validation Error: Type 'http://edm.umweltbundesamt/ebsmws/datatypes:FEAAInstallationGLNUsgAIdentifierType' is not declared.
Warning: There was a validation error on a schema generated during export:
Source:
Line: 2 Column: 253
Validation Error: Type 'http://edm.umweltbundesamt/ebsmws/datatypes:AustrianMaterialMovementIdentifierType' is not declared.
Warning: There was a validation error on a schema generated during export:
Source:
Line: 2 Column: 286
Validation Error: Type 'http://edm.umweltbundesamt/ebsmws/datatypes:FEAAPartyGLNUsgAIdentifierType' is not declared.
Warning: There was a validation error on a schema generated during export:
Source:
Line: 2 Column: 309
Validation Error: Type 'http://edm.umweltbundesamt/ebsmws/datatypes:FEAAOperatingSiteGLNUsgAIdentifierType' is not declared.
Warning: There was a validation error on a schema generated during export:
Source:
Line: 2 Column: 307
Validation Error: Type 'http://edm.umweltbundesamt/ebsmws/datatypes:FEAAInstallationGLNUsgAIdentifierType' is not declared.
Warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: The element 'http://edm.umweltbundesamt/ebsmws/datatypes:EBSConsignmentNoteNotification' is missing.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://edm.umweltbundesamt.at/ebsmws']/wsdl:portType[@name='DeliveryEndpoint']
Warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://edm.umweltbundesamt.at/ebsmws']/wsdl:portType[@name='DeliveryEndpoint']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://edm.umweltbundesamt.at/ebsmws']/wsdl:binding[@name='DeliveryBinding']
Warning: Cannot import wsdl:port
Detail:
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://edm.umweltbundesamt.at/ebsmws']/wsdl:service[@name='DeliveryService']/wsdl:port[@name='DeliveryServicePort']
Warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: The datatype 'http://edm.umweltbundesamt/ebsmws/datatypes:AustrianMaterialMovementIdentifierType' is missing.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://edm.umweltbundesamt.at/ebsmws']/wsdl:portType[@name='FetchEndpoint']
Warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://edm.umweltbundesamt.at/ebsmws']/wsdl:portType[@name='FetchEndpoint']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://edm.umweltbundesamt.at/ebsmws']/wsdl:binding[@name='FetchBinding']
Warning: Cannot import wsdl:port
Detail:
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://edm.umweltbundesamt.at/ebsmws']/wsdl:service[@name='FetchService']/wsdl:port[@name='FetchServicePort']
Warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: The datatype 'http://edm.umweltbundesamt/ebsmws/datatypes:FEAAPartyGLNUsgAIdentifierType' is missing.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://edm.umweltbundesamt.at/ebsmws']/wsdl:portType[@name='PaperlessDeliveryEndpoint']
Warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://edm.umweltbundesamt.at/ebsmws']/wsdl:portType[@name='PaperlessDeliveryEndpoint']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://edm.umweltbundesamt.at/ebsmws']/wsdl:binding[@name='PaperlessDeliveryBinding']
Warning: Cannot import wsdl:port
Detail:
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://edm.umweltbundesamt.at/ebsmws']/wsdl:service[@name='PaperlessDeliveryService']/wsdl:port[@name='PaperlessDeliveryServicePort']
Warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: Object reference not set to an instance of an object.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://edm.umweltbundesamt.at/ebsmws']/wsdl:portType[@name='PaperlessFetchEndpoint']
Warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://edm.umweltbundesamt.at/ebsmws']/wsdl:portType[@name='PaperlessFetchEndpoint']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://edm.umweltbundesamt.at/ebsmws']/wsdl:binding[@name='PaperlessFetchBinding']
Warning: Cannot import wsdl:port
Detail:
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://edm.umweltbundesamt.at/ebsmws']/wsdl:service[@name='PaperlessFetchService']/wsdl:port[@name='PaperlessFetchServicePort']
Warning: No endpoints compatible with .Net Core apps were found.
Generating files...
"C:\src\PROJECT\src\Services.eRAS\ServiceReferences\Delivery\DeliveryService.cs"
I think, the problem is in the data type import inside the WSDL file, that is not respected by the generator:
<wsdl:import namespace="http://edm.umweltbundesamt/ebsmws/datatypes" location="https://secure.umweltbundesamt.at:443/ebsws/DeliveryService?xsd=1" />
@Lxiamail Is there a possible workaround that we can use?
@WebDucer Thanks for reporting this issue. It looks like there's a NullReferenceException being thrown while processing the metadata (Error: Object reference not set to an instance of an object). This should be a bug in the tool, and we'll work on investigating a fix for it.
I don't think there's an easy workaround to get this tool to work with the service. One thing you could try is generating a full framework proxy with svcutil.exe and modifying it yourself to build and run on .NET Core. You'd need to remove any code that's not supported on core and convert anything that svcutil puts in the config file into code. I'll let you know if we find an actual workaround while investigating the root cause of the bug.
@imcarolwang can you please try using the simple repro on .NET Core and .NET framework?
@WebDucer sorry for the late response. I am not sure if it is still an issue to you. I found the problem lies in the imported XSD file, I think the tool couldn't correctly parse the namespace had caused the problem.
In https://secure.umweltbundesamt.at/ebsws/FetchService?wsdl, observe tns definition as below:
In the imported XSD file, the namespace definition is like below:
Saving the files locally and update the "tns:" definition and all its refs in the imported XSD file to "data:", the service reference file can be generated without error.
close due to no response, feel free to re-activate if this issue persists.