Wcf: Web Service Reference Provider error: There was a problem reading the MetadataSet argument

Created on 15 Aug 2017  路  30Comments  路  Source: dotnet/wcf

A customer reported that:
"Trying to add reference to NetSuite Web Services at https://webservices.netsuite.com/wsdl/v2017_1_0/netsuite.wsdl and I am getting the following error. Is the WCF Web Service Extension what is need to create what used to be called a 'Web Reference' in a .Net Core project?

There was a problem reading the MetadataSet argument: a MetadataSection instance with identifier 'urn:types.website_2017_1.lists.webservices.netsuite.com' and dialect 'http://www.w3.org/2001/XMLSchema' has a Metadata property whose type does not match the dialect. The expected Metadata type for this dialect is 'System.Xml.Schema.XmlSchema' but was found to be 'System.ServiceModel.Description.MetadataSection'."

tooling

Most helpful comment

Update: A fix for this issue will be available in Visual Studio 2017 v15.6 Preview 2.

All 30 comments

I can successfully create the proxy in ASR. This is probably an XML service that needs Disco to download the metadata.

I'm the original poster of the issue. Please let me know if any more information is needed.

I have verified that ASR used Disco to download the metadata successfully. We do not support Disco currently.

Are there any plans on supporting Disco? This would be one thing holding us up from migrating to .net core.

Thanks for your feedback! We will evaluate the support.

If it helps at all, like the original poster we also integrate with NetSuite's Web Services which is the only full fledged integration option that they provide.

Thanks for posting @jedsmallwood.

@jedsmallwood Thanks for your comments! It will help us to evaluate the support for Disco.

Today, I was on the way of migrating my project (.net 4.6.2) to the new .csproj format, and my service references stopped being treated as Services references I can update (maybe I did something wrong).
I then tried to recreate my service reference but I found the same interface with which I had issues in #2104 .

I still can't add/update my references to the ONVIF webservice in my net 4.6.2 project using the new csproj format.

For reference, you will find the .wsdl links on this page : https://www.onvif.org/profiles/specifications/

Is there anything I can do to fix this issue, like a PR for example?

Interestingly, back in June we had used VS 2017, .net core 1.1 and WCF WS Connected service to reference https://webservices.netsuite.com/wsdl/v2016_2_0/netsuite.wsdl
and had built a library around that. And it worked fine and is in production at the moment.
We came across the same error trying to update this library to the same WSDL as the original poster, with VS 2017 15.4.1, core 2.0 and same connected service 0.5.1.
Now, even the original WSDL cannot be referenced through the wizard and give the exact same error. So, I believe this is likely a regression issue; and not that this wasn't supported previously.

Sounds like a regression.

@mlacouture I'd suggest create a separate bug to track this issue, if we decide not to use Disco DiscoveryClientProtocol API that ASR uses.

Thank you all for your input on this issue. I will investigate a little deeper and will get back to you as soon as I have a meaningful update.

Miguel Lacouture

Hi all!

I took a look at this issue and it is in fact a regression and has nothing to do with the DISCO protocol. I have reactivated issue #2104 to track support for DISCO separately.

As a workaround for this regression, you can try generating the service reference proxy using the dotnet-svcutil tool which is used by the WCF Web Servicer Reference tool as the underlying code generation tool. In my machine I run the following command successfully:

_dotnet "c:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\Common7\IDE\Extensions\Microsoft\WCF Connected Service\svcutil\netcoreapp1.0\dotnet-svcutil.dll"
/tf:netcoreapp1.0 https://webservices.netsuite.com/wsdl/v2017_1_0/netsuite.wsdl_

Observe that the dotnet-svcutil tool is not yet ready for production as a stand-alone tool so we don't recommend to use it over the WCF Web Service Reference tool. We are working hard on making dotnet-svcutil tool widely available in a future release.

Hope this helps,
Miguel Lacouture

@mlacouture Thanks, using dotnet-svcutil worked for me as well.
Used with /n:"*,SuiteTalk" to generate the proxy under SuiteTalk namespace.

Update: A fix for this issue will be available in Visual Studio 2017 v15.6 Preview 2.

15.6 Preview works!

image
image
image

I'm glad this issue has been resolved. Thank you all for your help.

Wanted to add that the documentation for NetSuite suggests using a "Web Reference" over a "Service Reference". See here, starting on page 16

Is there an equivalent to that for core by chance?

@jhofker, it seems the documentation was written for an earlier version of Visual Studio (it used to be called VS.Net) which supported the old ASMX (Web Reference) technology which has been deprecated and replaced with WCF (Service Reference). Hope this helps,

@mlacouture I'm not sure anyone has told the fine folks at NetSuite that ASMX is no longer supported. 馃槈 Getting their API working under WCF so far is very difficult.

Just to be precise - ASMX in full .NET Framework is not deprecated and it is still supported. However, we do recommend customers using WCF over ASMX. This has been the recommendation from WCF team for many years. ASMX is not ported to .NET Core and we don't have a plan to port it to .NET Core at this point in time.

Has anyone been able to execute WS calls using the classes generated by 15.6 beta?
I'm getting the following error

Operation is not supported on this platform.
   at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass1_0.<CreateGenericTask>b__0(IAsyncResult asyncResult)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

Also wanted to point out that the stub generated by 15.6 (svc-util 1.0) have very different method signatures than what was generated back in June 2017 (dotnet-svcutil version 0.5.0.0).

In v0.5 are several header level properties (passport, applicationId), that was required to be set at Endpoint level using IClientMessageInspectors. In v1.0, these have moved to the method signature itself.
e.g.
getServerTimeAsync(SuiteTalk.Passport passport, SuiteTalk.TokenPassport tokenPassport, SuiteTalk.ApplicationInfo applicationInfo, SuiteTalk.PartnerInfo partnerInfo)

Neither the MessageInspector approach nor setting the values at method level, is working for me now.

Sample code that throws the error:

            var client = new NetSuitePortTypeClient();
            var data = await client.getServerTimeAsync(
                new Passport {
                    email = "[email protected]",
                    password = "mypassword",
                    account = "NSACCOUNTNO"
                }, 
                null, 
                new ApplicationInfo { applicationId = config.ApplicationId },
                null
            );

We were never able to get it to work, but switched to restlets which thankfully meet our level of integration needs.

Thanks @jhofker
In which case @mlacouture, @hongdai I vote we reopen this issue as there still an issue with the generated code.

I am waiting until a non-beta release to test but I am still in need of this solution.

Hi @sameera, sounds like we need to investigate the runtime problem, but it is a separate issue, do you mind creating a new issue?

thank you!

Hi @mlacouture
No problem. Created https://github.com/dotnet/wcf/issues/2530

Sample code that throws the error:

            var client = new NetSuitePortTypeClient();
            var data = await client.getServerTimeAsync(
                new Passport {
                    email = "[email protected]",
                    password = "mypassword",
                    account = "NSACCOUNTNO"
                }, 
                null, 
                new ApplicationInfo { applicationId = config.ApplicationId },
                null
            );

Hello Sameera, I am using above sample, What type of binding need to be used for this? I am getting error for Basic Https Binding

@VenkatSappidi I' using BasicHttpBinding.
I'm actually accepting the default and not trying to set it. Any reason why you wanted to change to Https binding? The endpoint I'm hitting is a https one and the default binding works just fine.

Was this page helpful?
0 / 5 - 0 ratings