How to reference a web service user defined type?

  • 18 July 2007
  • 1 reply
  • 1 view

Badge +5

Hi,

I'm having some difficulty trying to ref. a user defined type in K2 Studio. 

 
In my webservice I have these user defined classes:
 

public class ADMember
{
    public string username;
    public string firstname;
    public string lastname;
    public string employeeNumber;
}

public class ADMemberArr
{
    public ADMember[] admemberArr;
}

 

 

My webservice has the ADMemberArr returning back:

public ADMemberArr GetMembers(string LDAPFilter)    {

       ...
        return oADMemberArr;      
    }

 

 

In K2 Studio I have this in my code:

public void Main(ref DestinationRuleContext K2) {
   
    K2.ResolveQueuesToUsers = true;
   
    SourceCode.K2Utilities.DSHelper oDSH = new SourceCode.K2Utilities.DSHelper(SourceCode.K2Utilities.DSHelper.DSHelperNewOptionsEnum.DefaultLDAPDomain);
    System.DirectoryServices.DirectoryEntry oDEManager;
    string sManager;
    bool bAllTrue = true;
    CDest1 oDest1 = new CDest1();
    oDest1.Main(ref K2);
   
   
    ADService.ADService oADSvc = new ADService.ADService();
    ADService.ADMemberArr oADMemberArr = new ADService.ADMemberArr();
   
    ADService oWebService = new ADService();   
       
    try
    {   
        oWebService.Url = "http://teknck2stage/common/ADService.asmx";
        oWebService.Credentials = SourceCode.K2Utilities.GeneralMod.GetCredentials(oWebService.Url);
        object oADMemberArr = oWebService.GetMembers("tekDepartmentNumber=8031)");
                   
        foreach(ADService.ADMember oADMember in oADMemberArr.admemberArr())
        {
            if (oDest1.IsSuccess == true) {
            //== sendto
                K2.Destinations.Add(DestinationType.User, oADMember.username);
           
                if (bAllTrue == false) return;
            }       
        }
       

    }
    catch (Exception ex)
    {
        throw ex;
    }
    finally
    {
        oWebService = null;
    }   

}


// Destination Classes
   
private class CDest1 {
    public bool IsSuccess = false;
       
    public void Main(ref DestinationRuleContext K2) {
        this.IsSuccess = true;
    }

}

 

 However it does not compile nicely in K2 Studio... I get these errors saying it doesn't recognize the types.

 Line 13: The type name 'ADMemberArr' does not exist in the type 'ADService'
 Line 21: The type name 'ADMember' does not exist in the type 'ADService' 

I think I'm referencing this wrong unlike in Visual Studio.  Any idea how I can do this?

 

Thanks,

Vinny

 


1 reply

Badge +4

Hi Vinny,


Did you have any namespaces that you may have fogotten to added to K2 Studio.


We usually add them in the IMPORT functionality near where you add dll references in Project Properties.


Hope this helps,


Marco

Reply