Adding WSDL web reference in PCL causes and Framework error

KapilKapil USUniversity

Hi

I am newbie to PCL but not to Xamarin. I am trying to add WSDL api to PCL library and I able to add it as web reference. But when I tried to compile the PCL it gives me error for "The type or namespacename 'Web' does not exist in namespace 'System'".

When I tried to add "System.Web", it gives me "assembly not found for framework .net portable subset" error. I have used PCL 4.0 Profile 136.

Please let me know, how to resolve this issue.

Thanks in advance.

Regards,

Kapil

Answers

  • PeterDavisPeterDavis USMember ✭✭✭
    edited May 2014

    You can't add it that way. What you want to use is the Silverlight service proxy generator. On my machine it's located in:

    C:\Program Files (x86)\Microsoft SDKs\Silverlight\v5.0\Tools

    The app is slsvcutil.exe

    Here's a sample batch file I use to generate my services

    @echo off
    set TOOLSPATH=C:\"Program Files (x86)\Microsoft SDKs\Silverlight\v5.0\Tools"\
    %TOOLSPATH%slsvcutil.exe /namespace:"*,MyApp.ServiceProxy" http://localhost/LoggingService.svc?wsdl /internal
    

    This will then generate your .cs files which you can include in your project

  • CastroCastro USMember

    After generating the .cs files i get this error at build

    CS0234 The type or namespace name 'ServiceContractAttribute' does not exist in the namespace 'System.ServiceModel' (are you missing an assembly reference?)

  • rayyadrayyad CAMember ✭✭

    Im getting this error.. Adding WCF Client to PCL. Im using Visual Studio 2015

  • rayyadrayyad CAMember ✭✭

    Hey Guys,

    Let me explain what I'm doing:

    1. I'm using Visual Studio 2015
    2. I added a Project of Type "Class Library(Xamarin.Forms)" - I believe this is what you call a PCL?
    3. Tried to add "Service Reference". Ok its not there.... You guys Gimped VS...No Problem...I'll use SLSvcUtil
    4. SlSvcUtil.exe created a class out of my web service. (This web service was not created using WCF, but its a basic Soap 1.1 Service)
    5. Added the class to my PCL Project.
    6. Missing References everywhere! The first one being S0234 The type or namespace name 'ServiceContractAttribute' does not exist in the namespace 'System.ServiceModel' (are you missing an assembly reference?)

    So how do I get WCF client in a PCL? What am I missing here?

  • DaveGharbaranDaveGharbaran USMember

    @rayyad said:
    Hey Guys,

    Let me explain what I'm doing:

    1. I'm using Visual Studio 2015
    2. I added a Project of Type "Class Library(Xamarin.Forms)" - I believe this is what you call a PCL?
    3. Tried to add "Service Reference". Ok its not there.... You guys Gimped VS...No Problem...I'll use SLSvcUtil
    4. SlSvcUtil.exe created a class out of my web service. (This web service was not created using WCF, but its a basic Soap 1.1 Service)
    5. Added the class to my PCL Project.
    6. Missing References everywhere! The first one being S0234 The type or namespace name 'ServiceContractAttribute' does not exist in the namespace 'System.ServiceModel' (are you missing an assembly reference?)

    So how do I get WCF client in a PCL? What am I missing here?

    Hi, did you already found a solution for this?

  • rayyadrayyad CAMember ✭✭

    I did!

    You need to change the Profile to Profile 78.

    You do this by opening the properties screen of the PCL project and Unchecking "Windows Phone 8.1" and checking Windows Phone Silverlight! I wish this stuff was documented!

  • OverheadOverhead USMember ✭✭

    @rayyad said:
    I did!

    You need to change the Profile to Profile 78.

    You do this by opening the properties screen of the PCL project and Unchecking "Windows Phone 8.1" and checking Windows Phone Silverlight! I wish this stuff was documented!

    Thanks for this one!

Sign In or Register to comment.