SharePoint User Group UK

Share the knowledge!

Welcome to SharePoint User Group UK Sign in | Join | Help
in
Home Blogs Forums Photos Files Roller

Smart part and WCF Service

Last post 09-24-2008, 12:45 PM by royce. 0 replies.
Sort Posts: Previous Next
  •  09-24-2008, 12:45 PM 13920

    Smart part and WCF Service

    Hello all,

    I have just started using Smart part v1_3.

    I built a hello world app and that worked so I started putting together a real app.

    Basically, without going into un-needed detail, I need to call the List.asmx sharepoint web service.

    http://MY_SERVER_NAME/_vti_bin/Lists.asmx

    I added a service reference (WCF not an old web service although I did try that also with no luck)

    So my web.config looks like this and it all works fine in my stand alone app.:

    <system.serviceModel>
            <bindings>
                <basicHttpBinding>
                    <binding name="ListsSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
                        <security mode="TransportCredentialOnly">
                            <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
                            <message clientCredentialType="UserName" algorithmSuite="Default"/>
                        </security>
                    </binding>
                </basicHttpBinding>
            </bindings>
            <client>
                <endpoint address="http://tdrsshptd01/_vti_bin/Lists.asmx" binding="basicHttpBinding" bindingConfiguration="ListsSoap" contract="mySPServiceRef.ListsSoap" name="ListsSoap"/>
            </client>
        </system.serviceModel>

    When I deploy to Sharepoint for use in my smart part I add my user control to the following folder:
    C:\Inetpub\wwwroot\wss\VirtualDirectories\80\UserControls

    This is the same folder as the hello world app I mentioned before.

    then I pasted / added the above web.config sections to the system.ServiceModel as shown above. Before you ask, I have pasted it in the right place as I have done this loads of times just not with smart part. The location of this web.config was here:
    C:\Inetpub\wwwroot\wss\VirtualDirectories\80 which is the correct web.config for the site I am working on.

    ok ready to rock and roll.

    So I go into my smart part and put it into edit mode.

    first thing I notice is that the "user control to display" drop down says: "could not load MyUserControl.ascx"

    I choose it anyway and click ok and also exit edit mode.

    Now the smart part says:

    Error: unable to load ~\/UserControls\MyListDisplayControl.ascx
    Details: c:\Inetpub\wwwroot\wss\VirtualDirectories\80\UserControls\MyListDisplayControl.ascx.cs(20): error CS0246: The type or namespace name 'mySPServiceRef' could not be found (are you missing a using directive or an assembly reference?)

    mySPServiceRef is the name of my WCF service.

    So why would it work stand alone and not in sharepoint.

    sharepoint doesnt know about my WCF service.

    In the following post:
    http://blogs.msdn.com/jowardel/archive/2008/08/08/installing-smartpart-for-sharepoint-with-a-dash-of-wcf-1-of-2.aspx

    I found this paragraph:
    8) Next add two dirctories to your website; UserControls and Bin. The former is where your ASCX user controls (and their code-behind) will reside, and the latter is where the corresponding user control assembly will sit (if you have any classes/interfaces which are not control code files, for example WCF proxies).

    So I created the BIN folder but i'm not sure what to put inside it?

    Which one is my WCF proxy. These are the files created inside my App_WebReferences folder in my stand alone project?:
    configuration.svcinfo
    Lists.disco
    Lists.wsdl
    Reference.svcmap


    Do I put these in my BIN folder?

    Slightly confused and running out of time!

    comments?
    thanks
    RuSs








    Regards
    Russell McCloy
    http://russellmccloy.blogspot.com/
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems