Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Datasource Webpart for Web Services View modes: 
User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 3/12/2012 9:14:29 AM
   
Datasource Webpart for Web Services
I'm lost on how to use the out of the box Web Service Datasource. I have a URL (/EmployeeInfo.asmx?op=GetEmployeeInformation) that accepts 2 string input parameters and outputs an object with 5 properties (DataSetResults, HasErrors, ErrorMessage, ErrorMessageWithStackTrace and OutParameterValues). How can I make this out of the box datasource work with my existing web services?

Also, how can I create a form (using out of the box functionality) to pass in the parameters to that particular webservice? The first Parameter is static but the second will be dynamic; for instance param1 = "Kentico", param2 = User.UserID.

Again, I'd like to use as much out of the box functionality as possible even if it involves creating a new webpart or module. I could add the web services myself into the website and do all that programming with asxc controls and add those to the page but I'm thinking of ease of upgrading and maintenance moving forward, I'd like to make it as easy and maintenance free as possible for others.

User avatar
Member
Member
kentico_michal - 3/14/2012 9:58:06 AM
   
RE:Datasource Webpart for Web Services
Hello,

If you want to use the Web service data source web part, you need to ensure that the web service, you are about to invoke, is called GetDataSource and its syntax looks like the following one:
    [WebMethod]
public DataSet GetDataSet(string parameter)
{
// INSERT YOUR WEB SERVICE CODE AND RETURN THE RESULTING DATASET
}

It's up to you what columns the output dataset would consist of. The input parameter is the property Web service parameter of the Web service data source web part. So, the web service method accepts only one parameter, however, you can define any macro in the Web service parameter (query, custom etc.) to dynamically specify the input parameter.

Anyway, if you still need to execute a web service method with a different name or with different input and output parameters, you will need to use custom code to execute the method. Kentico CMS is a standard .NET application so you can use standard .NET API.

Best regards,
Michal Legen

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 3/14/2012 2:39:24 PM
   
RE:Datasource Webpart for Web Services
Thanks for the reply Michal. I'm totally aware of using the .NET API for creating my own web services and methods but was trying to leverage as much out of the box functionality as I could.

I could create my own webpart to do what I'm looking for I'm assuming correct? If so, great. Is there any good documentation out there that talks about building a real world example of a web part, vs. the "Hello World" example given in the documentation?

For instance I'd like to build a web part that has 2 simple input items (textbox and dropdownlist with 3 items) and a search button. When I click the search button it calls a webservice (I'll specify in code) then display the results in a list below. Then if I select to view the details it shows them. I'm imagining this setup with a few ascx controls but the documentation gives very simple examples and doesn't go into much detail.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 3/15/2012 9:04:00 AM
   
RE:Datasource Webpart for Web Services
I'll start a new post as I think I have most of it figured out just need some direction on moving between asxc controls now.