Forum Visual Studio

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

How to add ServiceModel References so I can consume a web service?

RobertPeterson.4041RobertPeterson.4041 USMember ✭✭
edited February 2018 in Visual Studio

Hello. I am very new at Visual Studio for Mac and I have a simple Xamarin project. I would like consume the web service at I add a web service reference. I think I need to add a reference to System.ServiceModel, but I am not sure how do that. I have search for a dll on my system, but it does not seem to be there. I have searched Nuget, but I a not sure what package I really need. I have attempted to add System.ServiceModel.Primatives and System.ServiceModel.Http through Nuget, but I always get the error:

Attempting to resolve dependencies for package 'System.ServiceModel.Web.1.0.0' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'System.ServiceModel.Web.1.0.0'
Resolved actions to install package 'System.ServiceModel.Web.1.0.0'
Retrieving package 'System.ServiceModel.Web 1.0.0' from 'nuget.org'.
Install failed. Rolling back...
Package 'System.ServiceModel.Web.1.0.0' does not exist in project 'rhys'
Package 'System.ServiceModel.Web.1.0.0' does not exist in folder '/Users/robertpeterson/Projects/rhys/packages'
Executing nuget actions took 20.08 ms
Could not install package 'System.ServiceModel.Web 1.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

and similar Profile111 errors.

I have updated my OS and Visual Studio for Mac to the latest. I am really not sure what this error means or if I am pulling the correct NuGet packages. What am I doing wrong? Any help or suggestions would be truly appreciated.

Answers

  • kentuckerkentucker USMember ✭✭✭✭✭

    What kind of web service?

  • So, I believe when I added the web reference I used the default of WCF for the web service.

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    [System.Runtime.Serialization.DataContractAttribute(Name="LetterSolutions", Namespace="http://services.aonaware.com/webservices/")]
    public partial class LetterSolutions : object, System.Runtime.Serialization.IExtensibleDataObject {
    
        private System.Runtime.Serialization.ExtensionDataObject extensionDataField;
    
        private string anagramField;
    
        public System.Runtime.Serialization.ExtensionDataObject ExtensionData {
            get {
                return this.extensionDataField;
            }
            set {
                this.extensionDataField = value;
    

    However, I get errors like "The type or name 'IExstensibleDataObject' does not exist in the namespace 'System.Runtime.Serialization' (Are you missing an assembly reference?) I guess I am not sure what I need to add a reference to or how to add it. Any ideas anyone?

Sign In or Register to comment.