none
[SOLVED] Help Using FAST Search Web Service in Metro application? ( It cannot be done. Need WCF service for Metro ) RRS feed

  • Question

  • Hi all,

    I'm trying to use the FAST Search Web Service in a Metro application for Windows 8.

    I have been basing my implementation off of this MSDN walkthrough: http://msdn.microsoft.com/en-us/library/gg588339.aspx

    I originally wanted to develop the Metro application using HTML5/JavaScript since I have a stronger web development background; however, it seems there is no easy way to utilize the service "http://SERVER/_vti_bin/search.asmx" using JavaScript. I thought I could convert the XML string building functions from C# to JavaScript and then submit this string using a Win.xhr AJAX request but after I originally made a post about the problem (http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/054066a9-3e77-45c6-95c2-05822c61b1d4) on the Metro application development forums and they advised me to use the C# method and directed me here.

    So, I abandoned the HTML5/JavaScript and started with a blank C# Metro application to follow the tutorial and came across problems still.

    Problem 1: The Service Reference I am using does not seem to have the QueryService type or method in it?

    This was driving me crazy because it's documented that it should exist here: http://msdn.microsoft.com/en-us/library/search.queryservice(v=office.12).aspx

    Is there a setting / configuration that I need to modify in my SharePoint / FAST installation to make this class available?  I tried to read (http://msdn.microsoft.com/en-us/library/ee872313.aspx) but it didn't help much.

    I took some screen shots to help explain:

    When I first right click my References > Add Service Reference and fill out the data I get this:


    Which makes it look like the QueryService exists, but when I actually program it like in the Walkthrough as seen here:

    As you can see the FastWebService.QueryService which I have named my reference is showing an error:

    "The type or namespace name 'QueryService' does not exist in the namespace 'FastSearchText.FastWebService' (are you missing an assembly reference?)" 

    So then I go to the object explorer to see what actually does exist in this service I've referenced and there is no QueryService.

    Something doesn't seem right. I'm thinking this is either a really stupid oversight since I'm not familiar with C# development or somehow the service in my SharePoint site is messed up.

    Problem 2: I would be forced to use Query() instead of QueryEx() due to lack of DataSet object. 

    As you see here (http://msdn.microsoft.com/en-us/library/windows/apps/br230232(v=VS.85).aspx) the System.Data is not available to Metro applications. This wouldn't bother me too much except that on this page (http://msdn.microsoft.com/en-us/library/ff394628.aspx#int_overview_web_service) it says I need QueryEx() to use the advanced features of FAST Search.  I'm hoping that getting the raw XML doesn't actually restrict me, it is just that using DataSet objects, makes processing the data easier, but I could still do everything with an XML object.

    Based on these problems I have some questions:

    1. How to properly access the QueryService class of my FAST Search Web service.

    2. Assuming I can't use DataSet objects and am forced to use Query() what is the best method for parsing data.

    3. What are other people's recommendations for how to use FAST Search Web service in an HTML5/Javascript applicatin because I'm still interested to see how it would be done.

    Thanks for reading such a long post. I'm really not sure what to do if I can't get past this problem since 90% of my content for this application is retrieved from FAST query service.  Really appreciate the help!

    - Matt 





    Sunday, April 15, 2012 5:05 AM

Answers

  • So it seems my problem is that I can't add Web Services in a Metro application and need an alternate method to utilize FAST search from the application.

    It seems you are expecting to be able to do something like this: http://msdn.microsoft.com/en-us/library/d9w023sx.aspx to add a Web Reference but it doesn't work that way for Metro applications.  See the following links:

    Adding a Web Reference in Visual Studio 11:

    http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/534631ab-8e80-49a0-b86d-fb2e77de7184

    Another article basically explaining my problem.  Metro applications can't use .asmx services and must use .wcf

    http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/59fa422b-5604-48d9-a63f-04b404d5cc3a

    One guy mentioned "even the [methods] that come across, the client code to use/call them is not just doing a new on the XYZSoapClient class and invoking them via the instance, which is the way one of the article/response in this forum suggests. Rather it looks like one has to cast the class instance to the interface and then invoke them" So it looks like there might be a some casting tricks to get functionality but I would rather not use this method.   This explains why I was seeing QueryServiceSoapClient.

    I've read about using a WSDL service but I'll have to look into it more.  Is there any form of WCF service available for FAST Search or is that something that will be released in the 2015 versions?

    - Matt

    • Marked as answer by Matt Mazzola Tuesday, April 17, 2012 2:11 PM
    Sunday, April 15, 2012 7:24 PM

All replies

  • I couldn't fit this in the other post:

    But here is the screenshot of the object explorer of my service:

    Sunday, April 15, 2012 5:11 AM
  • Hi,

    You should be able to add the reference to search.asmx and then use the Query or QueryEx methods. I would advise to add the reference as a .NET 2.0 Web Reference and not a WCF reference. Makes it easier to set the credentials on the query and make it work. For some reason using the WCF reference is tricky with the SP services. Let me know if this works out.

    That said, it should be possible to call the service using javascript and send the XML packet, but it's probably easier if you create a REST service in SP which wraps the search.asmx service.

    Regards,
    Mikael Svenson


    Search Enthusiast - SharePoint MVP/WCF4/ASP.Net4
    http://techmikael.blogspot.com/

    Sunday, April 15, 2012 10:31 AM
  • I'm not sure what you mean by "add the reference as a .NET 2.0 Web Reference and not a WCF reference."

    Here are the steps I took to add the service:

    1. Right click on project name > Add Service Reference.  Which displays this window:


    Then I fill in the required data and click "Go" to make sure it's referenced properly.  Then If I click "Advanced" I'm presented with this window:

    Which does not seem to match up with Walkthrough (http://msdn.microsoft.com/en-us/library/gg588339.aspx).  I don't see anything that shows an option for adding as Web reference instead of WCF reference.  Although, I'm not really familiar with what these advanced configurations mean but I've tried a bunch of combinations of check boxes and nothing has helped.

    The directions in the walkthrough say "In the Service Reference Settings dialog box, click Add Web Reference." although there no is Add Web Reference button.

    The fact that the first window recognizes QueryService means it should be here somewhere right? It's just that the notation used for the old .NET framework in Visual Studio 2010 in the Walkthrough no longer applies.  There should be some other way to create an instance of this QueryService class from the QueryWebServiceProxy namespace.

    Has anyone else added a Service Reference to search.asmx in Visual Studio 11 Beta?

    "You should be able to add the reference to search.asmx and then use the Query or QueryEx methods."

    I have been able to add the search.asmx referend but I can't create an instance of the QueryService class in order to get access to these methods.  I can see the methods QueryAsync and QueryExAsync exist in the QueryServiceSoapClient but I'm not sure how this differs from the MSDN Walkthrough.



    Sunday, April 15, 2012 5:27 PM
  • Hi,

    I will try and fire up my VS11 tomorrow in my demo image a have a look. "Service Reference" is a WCF reference. In VS10 you add an old-fashioned web reference like this:

    "Add Service Reference" -> Click "Advanced" button -> Click "Add Web Reference" button.

    So if you click the "Advanced" button in your screenshot you should be able to get there.

    Thanks,
    -m


    Search Enthusiast - SharePoint MVP/WCF4/ASP.Net4
    http://techmikael.blogspot.com/

    Sunday, April 15, 2012 6:06 PM
  • So it seems my problem is that I can't add Web Services in a Metro application and need an alternate method to utilize FAST search from the application.

    It seems you are expecting to be able to do something like this: http://msdn.microsoft.com/en-us/library/d9w023sx.aspx to add a Web Reference but it doesn't work that way for Metro applications.  See the following links:

    Adding a Web Reference in Visual Studio 11:

    http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/534631ab-8e80-49a0-b86d-fb2e77de7184

    Another article basically explaining my problem.  Metro applications can't use .asmx services and must use .wcf

    http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/59fa422b-5604-48d9-a63f-04b404d5cc3a

    One guy mentioned "even the [methods] that come across, the client code to use/call them is not just doing a new on the XYZSoapClient class and invoking them via the instance, which is the way one of the article/response in this forum suggests. Rather it looks like one has to cast the class instance to the interface and then invoke them" So it looks like there might be a some casting tricks to get functionality but I would rather not use this method.   This explains why I was seeing QueryServiceSoapClient.

    I've read about using a WSDL service but I'll have to look into it more.  Is there any form of WCF service available for FAST Search or is that something that will be released in the 2015 versions?

    - Matt

    • Marked as answer by Matt Mazzola Tuesday, April 17, 2012 2:11 PM
    Sunday, April 15, 2012 7:24 PM
  • Matt,

    Were you able to find any alternative approach of doing this for windows 8 apps ? Am stuck at the same place.

    Thanks,

    Pavan


    Pavan Jayavarapu

    Thursday, August 23, 2012 9:36 AM