cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
copkillaNoOne
Level 4

automating the registration and activation process

Hi, I would appreciate and would be very grateful, if somebody could help me with this outstanding issue...

Is this possible ?

I would like to create, respectively activate my product by an automated process, after the customer has installed my product, he should edit some infos in a form or dialog, send a fulfillmentID or Serial-Number to the server and receive a license file by mail (or is it possible to create one at client side directly ?).

without anyone touches the web-platform for generating any xml or license files manually...

I´ve seen the example in C:\FlexNet\Publisher\examples\fulfill could I use a similar code to implement my needs ? Or is there any better way (other than Java-Web-Services) ... ?

Thanks a lot in advance,

CopkillaNoOne...
Labels (1)
0 Kudos
(21) Replies
RobertDickau
Flexera Alumni

What type of licensing are you using, license file-based or trusted storage-based? And are you using FLEXnet Operations?

If you're using trusted storage and using FLEXnet Operations, your activation utility should be able to speak directly to FNO to fulfill licenses. For license file-based licensing, there's not a built-in fulfillment, but you could perhaps set up the FNO customer portal for creating license files...
0 Kudos
copkillaNoOne
Level 4

RobertDickau wrote:
What type of licensing are you using, license file-based or trusted storage-based? And are you using FLEXnet Operations?

If you're using trusted storage and using FLEXnet Operations, your activation utility should be able to speak directly to FNO to fulfill licenses. For license file-based licensing, there's not a built-in fulfillment, but you could perhaps set up the FNO customer portal for creating license files...


First, Hi Robert and thank you for the fast reply.
Yes I´m using operations and have set up a customer portal... we have some problems with the customers, that they don´t want to have any services installed on their machines, so we have to use license files.

The problem is that we have to automate the process, and the customer should not login to the customer portal, but he should receive a license file via email or maybe created locally by our client-application.

I´ve seen the sample in \Publisher\examples\fulfill some 'c' code, where the license information get read into a buffer and printed on to the standard output device. Isn´t it possible to do so with a license ? and writing to a file directly after getting response from FNO ?

Thanks for your patience... 😮

P.S.: Could we use the web-services to accomplish our needs ?
0 Kudos
RobertDickau
Flexera Alumni

The FNO web services do support generating and e-mailing license files. Please search the web services guide for "generateLicense" and "emailLicense" for more information, and see the code samples in the subdirectory site/samples/webservices/licenses...
0 Kudos
copkillaNoOne
Level 4

RobertDickau wrote:
The FNO web services do support generating and e-mailing license files. Please search the web services guide for "generateLicense" and "emailLicense" for more information, and see the code samples in the subdirectory site/samples/webservices/licenses...


Thanks for reply... 🙂 is Java necessary or can I use .NET also... (because of
probable compatibility issues and not having all the methods available)...

Thanks and will look into suggested topic.
0 Kudos
RobertDickau
Flexera Alumni

The samples that ship with FNO are set up to use Axis + Java, but it's not a requirement. The web services guide has some general information about creating other types of clients, including the "ClientSecurityCredentials Class Source" appendix that mentions the need for Basic HTTP authentication in the client. (I've had some luck using C# and VB.NET for FNO web service clients, as it's a fairly straightforward translation from Java.)
0 Kudos
copkillaNoOne
Level 4

RobertDickau wrote:
The samples that ship with FNO are set up to use Axis + Java, but it's not a requirement. The web services guide has some general information about creating other types of clients, including the "ClientSecurityCredentials Class Source" appendix that mentions the need for Basic HTTP authentication in the client. (I've had some luck using C# and VB.NET for FNO web service clients, as it's a fairly straightforward translation from Java.)


ok, that would make my life a bit asier... :rolleyes: ... are there any samples for usage of c# or vb.net ? does anybody have some snippets ?

I appreaciate any help, and if I could, i would spend a beer or two via the net !!

Thanks for the help.
cheers...
0 Kudos
RobertDickau
Flexera Alumni

I've had luck with the following; most of the tricky part is putting the "Basic" HTTP authentication in there, which Java + Axis seems to handle automatically.

[list=1]
  • Start the Operations server, and verify that http://host:port/flexnet/services reflects that the service is running.


  • Log in to Operations, open the Administer Operations view, select System Configuration, Validators category; clear the check box next to Web Service Request Validation Enabled.


  • In Visual Studio (I last tried with VS 2005), create a new C# console project (below called ConsoleApplication1).


  • In the Solution Explorer, right-click the project icon and select Add Web Reference.


  • In the Add Web Reference page, enter http://host:port/flexnet/services and click Go. Click the (wsdl) link next to the service you want to use (for this example, ProductPackagingService). You should see a list of methods in the "ProductPackagingService" Description section.


  • Change the Web reference name field to (for example) prodpkgsvc, and click Add Reference. The Solution Explorer view should have a new prodpkgsvc icon in the Web References folder.


  • Double-click the prodpkgsvc icon, which opens the Object Browser.


  • In the Object Browser, expand ConsoleApplication1.prodpkgsvc, and double-click one of the items in the tree. This should open the proxy class source file Reference.cs.


  • Near the top of Reference.cs, find the line that begins:

    public partial class ProductPackagingService : ...

    and insert the following function:

    [code]protected override WebRequest GetWebRequest(Uri uri)
    {
    HttpWebRequest request;
    request = (HttpWebRequest)base.GetWebRequest(uri);

    if (PreAuthenticate)
    {
    NetworkCredential networkCredentials =
    Credentials.GetCredential(uri, "Basic");
    if (networkCredentials != null)
    {
    byte[] credentialBuffer =
    new
    System.Text.UTF8Encoding( ).GetBytes(
    networkCredentials.UserName + ":" +
    networkCredentials.Password);

    request.Headers["Authorization"] =
    "Basic " +
    Convert.ToBase64String(credentialBuffer);
    }
    else
    {
    throw new ApplicationException(
    "No network credentials");
    }
    }
    return request;
    }[/code]

    It might also be necessary to add this to the top of the file:

    using System.Net;

    This overridden function specifies that requests are to use "Basic" HTTP authentication, adding a new "Authorization" header with credentials of the form "Basic " plus the base-64-encoded "Name:Password" string.


  • In the client code (Program.cs), you create web service requests and retrieve responses similar to the technique used in the Java examples. For example, the following code creates a simple report of the products currently defined in the Operations database:

    [code]using System;
    using System.Collections.Generic;
    using System.Text;

    using ConsoleApplication1.prodpacksvc;
    using System.Net;

    namespace ConsoleApplication1
    {
    class Program
    {
    static void Main(string[] args)
    {
    ProductPackagingService pps = new ProductPackagingService( );

    NetworkCredential netCredential = new NetworkCredential("admin", "admin");
    Uri uri = new Uri(pps.Url);

    ICredentials credentials = netCredential.GetCredential(uri, "Basic");

    pps.Credentials = credentials;
    pps.PreAuthenticate = true;

    getProductCountRequestType pcreq = new getProductCountRequestType( );

    productQueryParametersType pqp = new productQueryParametersType( );
    pcreq.queryParams = pqp;

    getProductCountResponseType pcresp = pps.getProductCount(pcreq);

    Console.Out.WriteLine(
    "Product count: " + pcresp.responseData.count + "\n");

    if (pcresp.statusInfo.status == StatusType.SUCCESS)
    {
    getProductsQueryRequestType pqreq =
    new getProductsQueryRequestType( );

    pqreq.queryParams = pqp;

    pqreq.batchSize = "50";
    pqreq.pageNumber = "1";

    getProductsQueryResponseType pqresp = pps.getProductsQuery(pqreq);

    Console.Out.WriteLine("\nProduct report:");

    productQueryDataType[] pqrespdata = pqresp.responseData;

    if (pqrespdata != null)
    {
    foreach (productQueryDataType pqd in pqrespdata)
    {
    Console.Out.WriteLine(
    pqd.productName +
    " (version " + pqd.version + ", " +
    pqd.state + " state)");
    }
    }
    }
    else
    {
    Console.Out.WriteLine("Error: " + pcresp.statusInfo.reason);
    }
    }
    }
    }[/code]
  • 0 Kudos
    copkillaNoOne
    Level 4

    RobertDickau wrote:
    I've had luck with the following; most of the tricky part is putting the "Basic" HTTP authentication in there, which Java + Axis seems to handle automatically.

    [list=1]
  • Start the Operations server, and verify that http://host:port/flexnet/services reflects that the service is running.


  • Log in to Operations, open the Administer Operations view, select System Configuration, Validators category; clear the check box next to Web Service Request Validation Enabled.


  • In Visual Studio (I last tried with VS 2005), create a new C# console project (below called ConsoleApplication1).


  • In the Solution Explorer, right-click the project icon and select Add Web Reference.


  • In the Add Web Reference page, enter http://host:port/flexnet/services and click Go. Click the (wsdl) link next to the service you want to use (for this example, ProductPackagingService). You should see a list of methods in the "ProductPackagingService" Description section.


  • Change the Web reference name field to (for example) prodpkgsvc, and click Add Reference. The Solution Explorer view should have a new prodpkgsvc icon in the Web References folder.


  • Double-click the prodpkgsvc icon, which opens the Object Browser.


  • In the Object Browser, expand ConsoleApplication1.prodpkgsvc, and double-click one of the items in the tree. This should open the proxy class source file Reference.cs.


  • Near the top of Reference.cs, find the line that begins:

    public partial class ProductPackagingService : ...

    and insert the following function:

    [code]protected override WebRequest GetWebRequest(Uri uri)
    {
    HttpWebRequest request;
    request = (HttpWebRequest)base.GetWebRequest(uri);

    if (PreAuthenticate)
    {
    NetworkCredential networkCredentials =
    Credentials.GetCredential(uri, "Basic");
    if (networkCredentials != null)
    {
    byte[] credentialBuffer =
    new
    System.Text.UTF8Encoding( ).GetBytes(
    networkCredentials.UserName + ":" +
    networkCredentials.Password);

    request.Headers["Authorization"] =
    "Basic " +
    Convert.ToBase64String(credentialBuffer);
    }
    else
    {
    throw new ApplicationException(
    "No network credentials");
    }
    }
    return request;
    }[/code]

    It might also be necessary to add this to the top of the file:

    using System.Net;

    This overridden function specifies that requests are to use "Basic" HTTP authentication, adding a new "Authorization" header with credentials of the form "Basic " plus the base-64-encoded "Name:Password" string.


  • In the client code (Program.cs), you create web service requests and retrieve responses similar to the technique used in the Java examples. For example, the following code creates a simple report of the products currently defined in the Operations database:

    [code]using System;
    using System.Collections.Generic;
    using System.Text;

    using ConsoleApplication1.prodpacksvc;
    using System.Net;

    namespace ConsoleApplication1
    {
    class Program
    {
    static void Main(string[] args)
    {
    ProductPackagingService pps = new ProductPackagingService( );

    NetworkCredential netCredential = new NetworkCredential("admin", "admin");
    Uri uri = new Uri(pps.Url);

    ICredentials credentials = netCredential.GetCredential(uri, "Basic");

    pps.Credentials = credentials;
    pps.PreAuthenticate = true;

    getProductCountRequestType pcreq = new getProductCountRequestType( );

    productQueryParametersType pqp = new productQueryParametersType( );
    pcreq.queryParams = pqp;

    getProductCountResponseType pcresp = pps.getProductCount(pcreq);

    Console.Out.WriteLine(
    "Product count: " + pcresp.responseData.count + "\n");

    if (pcresp.statusInfo.status == StatusType.SUCCESS)
    {
    getProductsQueryRequestType pqreq =
    new getProductsQueryRequestType( );

    pqreq.queryParams = pqp;

    pqreq.batchSize = "50";
    pqreq.pageNumber = "1";

    getProductsQueryResponseType pqresp = pps.getProductsQuery(pqreq);

    Console.Out.WriteLine("\nProduct report:");

    productQueryDataType[] pqrespdata = pqresp.responseData;

    if (pqrespdata != null)
    {
    foreach (productQueryDataType pqd in pqrespdata)
    {
    Console.Out.WriteLine(
    pqd.productName +
    " (version " + pqd.version + ", " +
    pqd.state + " state)");
    }
    }
    }
    else
    {
    Console.Out.WriteLine("Error: " + pcresp.statusInfo.reason);
    }
    }
    }
    }[/code]



  • Hi Robert,
    thank you very much for the excellent description !!!!!

    I´ve had a lot of trouble with that authentication stuff, and I found a solution,
    that works similar to yours, but without having to change the Reference.cs:
    (only if you have interest for it)
    [code]

    class LicenseProxyWrapper : LicenseProxy.LicenseService
    {
    protected override WebRequest GetWebRequest(Uri uri)
    {
    HttpWebRequest webRequest = (HttpWebRequest)base.GetWebRequest(uri);
    NetworkCredential credentials = Credentials as NetworkCredential;
    if(credentials != null)
    {
    string authInfo =
    (
    (credentials.Domain != null) &&
    (credentials.Domain.Length > 0) ? credentials.Domain + @"\" : string.Empty
    ) + credentials.UserName + ":" + credentials.Password;

    authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
    webRequest.Headers["Authorization"] = "Basic " + authInfo;
    }

    return webRequest;
    }
    }

    [/code]

    I was simply subclassing the VS2005 generated proxy, and I could create
    instances of the wrapper of the proxy class for using the methods. Of
    course setting the Network credentials as you did... etc.
    Anyway, the code works fine, and the Java samples are pretty self-explanating...

    But there is one (hopefully last) thing...
    I tried to use the createlicensetest.java sample and implement it in c#,
    but the line:
    CreateFulfillmentRequestType cpRequest = new CreateFulfillmentRequestType();

    is making me headaches, the request type seems not to exist in the LicenseService ... ?? Is the usage different od is the class named differently ?

    Am I missing something?

    Thanks again...
    0 Kudos
    RobertDickau
    Flexera Alumni

    Hmmm... The method names/capitalization are sometimes different in C# from Java, as you see in the sample I pasted. Does it work if you create the project from the WSDL files in the public-schema directory (as described in the web services guide) instead?
    0 Kudos
    copkillaNoOne
    Level 4

    RobertDickau wrote:
    Hmmm... The method names/capitalization are sometimes different in C# from Java, as you see in the sample I pasted. Does it work if you create the project from the WSDL files in the public-schema directory (as described in the web services guide) instead?


    Yes, I´ve tried that also, but there is no CreateFulFillmentRequest class appearing ... ? but in the documentation it is described as available.

    I really have no ideas anymore... 😞 ...

    Thanks a lot
    0 Kudos
    RobertDickau
    Flexera Alumni

    Looking at it a bit more, it seems the createLicense method just takes the createFulfillmentDataType array directly as an argument, instead of using the createFulfillmentRequestType type. (Which makes sense, since createFulfillmentRequestType has only a single "fulfillment" member of type createFulfillmentDataType[].) Perhaps passing the array directly?
    0 Kudos
    copkillaNoOne
    Level 4

    RobertDickau wrote:
    Looking at it a bit more, it seems the createLicense method just takes the createFulfillmentDataType array directly as an argument, instead of using the createFulfillmentRequestType type. (Which makes sense, since createFulfillmentRequestType has only a single "fulfillment" member of type createFulfillmentDataType[].) Perhaps passing the array directly?


    Ok, I´ll try that. Thanks and have a nice weekend...
    0 Kudos
    copkillaNoOne
    Level 4

    copkillaNoOne wrote:
    Ok, I´ll try that. Thanks and have a nice weekend...


    ok, have tried it and it compiled without errors, but it doesn´t seem to work, mybe someone take a look and maybe see´s something I don´t :confused:

    [code]

    public void CreateLicense()
    {
    try
    {
    LicenseService lsv = new LicenseService();
    NetworkCredential netCredential = new NetworkCredential("admin", "admin");

    Uri uri = new Uri(lsv.Url);
    ICredentials credentials = netCredential.GetCredential(uri, "Basic");
    lsv.Credentials = credentials;
    lsv.PreAuthenticate = true;

    createFulfillmentDataType fmtData = new createFulfillmentDataType();

    string activationId = _user._activationId;
    fmtData.activationId = activationId;
    fmtData.shipToAddress = _user._clientAddr;
    fmtData.shipToEmail = _user._email;
    fmtData.fulfillCount = "1";
    fmtData.startDate = DateTime.Now;
    fmtData.overDraftCount = "0";

    // set the serverids if the model requires them
    ServerIDsType servers = new ServerIDsType();
    servers.server1 = "INTERNET=69.0.9.1";
    fmtData.serverIds = servers;
    // set the mode ids if the model requires them
    //LicenseProxy licenseModelIdentifierType /*LicNodeIDsType*/ nodes = new LicenseProxy.licenseModelIdentifierType(); /*NodeIDsType()*/
    //nodes.setNodeId = (new String[]{"abc123", "ccc333" , "dda122"});
    fmtData.nodeIds = new String[] { "abc123", "ccc333", "dda122" } /*nodes*/;

    attributeDescriptorType[] attrArray = new attributeDescriptorType[1];
    attributeDescriptorType vsAttribute = new attributeDescriptorType();

    vsAttribute.attributeName = "VENDOR_STRING";
    vsAttribute.stringValue = "myvendorstring";
    attrArray[0] = vsAttribute;

    fmtData.licenseModelAttributes = attrArray;

    createFulfillmentDataType[] fmtArray = new createFulfillmentDataType[1];
    fmtArray[0] = fmtData;

    createFulfillmentResponseType response = lsv.createLicense(fmtArray);

    if(response.statusInfo.status.ToString().Equals(StatusType.SUCCESS.ToString()))
    {
    Console.Out.WriteLine("license created successfully ");
    createdFulfillmentDataListType cpdlType = response.responseData;
    createdFulfillmentDataType[] createdArray = cpdlType.createdFulfillment;

    for(int i = 0; createdArray != null && i < createdArray.Length; i++)
    {
    Console.Out.WriteLine
    (
    "Record : " + (i + 1) + " , created License " +
    createdArray.licenseText
    );
    }
    }
    else
    {
    Console.Out.WriteLine("license creation failed");
    Console.Out.WriteLine
    (
    "Reason for Failure -> " +
    response.statusInfo.reason
    );
    }
    }
    catch(Exception e)
    {
    Console.Out.WriteLine(e.StackTrace);
    }
    }


    [/code]


    It says that 'Failure -> All input data in the request failed' And the license creation has failed!
    error code -> 9999:null ??? What does that mean ?


    Thanks in advance,
    CkNoE
    0 Kudos
    RobertDickau
    Flexera Alumni

    If you look in the FNO application log, is there any more information about what failed in the request?
    0 Kudos
    copkillaNoOne
    Level 4

    RobertDickau wrote:
    If you look in the FNO application log, is there any more information about what failed in the request?


    Hi, it says:

    2009-07-14 11:39:25,889 ERROR [ops.ws] [http-0.0.0.0-8888-2] create license web service failed:The attribute name VENDOR_STRING is not valid [Incident# 3658-894R]
    [Incident# 3658-894R] com.macrovision.flexnet.operations.exceptions.runtime.InvalidAttributeException: The attribute name VENDOR_STRING is not valid [Incident# 3658-894R]
    but, I have inserted the right vendor inside !?!? 😞


    and I tried another sample (CreateLicenseOnCustomHost.java), where the vendorstring is not necessary and it says:
    2009-07-14 11:50:02,686 ERROR [ops.ws] [http-0.0.0.0-8888-2] create license web service failed:null java.lang.NullPointerException


    thanks
    CkNoE
    0 Kudos
    copkillaNoOne
    Level 4

    copkillaNoOne wrote:
    Hi, it says:

    2009-07-14 11:39:25,889 ERROR [ops.ws] [http-0.0.0.0-8888-2] create license web service failed:The attribute name VENDOR_STRING is not valid [Incident# 3658-894R]
    [Incident# 3658-894R] com.macrovision.flexnet.operations.exceptions.runtime.InvalidAttributeException: The attribute name VENDOR_STRING is not valid [Incident# 3658-894R]
    but, I have inserted the right vendor inside !?!? 😞


    and I tried another sample (CreateLicenseOnCustomHost.java), where the vendorstring is not necessary and it says:
    2009-07-14 11:50:02,686 ERROR [ops.ws] [http-0.0.0.0-8888-2] create license web service failed:null java.lang.NullPointerException


    thanks
    CkNoE



    Ok, short update, I removed the errors above, they were caused due missing
    attribute settings like "VENDOR=" and "VENDOR_DEFINED=" etc. now the
    attribute settings are ok, but when trying to execute the generation I get
    the following:

    at java.lang.Thread.run(Thread.java:595)
    Caused by: [Incident# 7514-9931] com.macrovision.flexnet.operations.exceptions.LicenseGeneratorException: License generator error: VCG exit value: 39 [Incident# 7514-9931]
    at com.macrovision.flexnet.operations.services.VcgProcessPool$VcgProcess.getErrorException(VcgProcessPool.java:349)
    at com.macrovision.flexnet.operations.services.VcgProcessPool$VcgProcess.grabOutput(VcgProcessPool.java:236)
    at com.macrovision.flexnet.operations.services.VcgProcessPool$VcgProcess.(VcgProcessPool.java:154)

    cheers.
    0 Kudos
    RobertDickau
    Flexera Alumni

    From memory I don't know the cause of that VCG error code. What if you try a product with the simplest possible license model (probably node-locked uncounted, not using NOTICE, VENDOR_STRING, etc.), and code with fewest attributes set...?

    If you set FNO to the debug level of logging, you should be able to see the XML coming in from the web services, too, which might help.
    0 Kudos
    copkillaNoOne
    Level 4

    RobertDickau wrote:
    From memory I don't know the cause of that VCG error code. What if you try a product with the simplest possible license model (probably node-locked uncounted, not using NOTICE, VENDOR_STRING, etc.), and code with fewest attributes set...?

    If you set FNO to the debug level of logging, you should be able to see the XML coming in from the web services, too, which might help.


    Ok, let´s try !
    0 Kudos
    copkillaNoOne
    Level 4

    copkillaNoOne wrote:
    Ok, let´s try !


    NOPE, stays the same, I also checked the configuration but have no clue what it could be.

    Maybe somone knows what the error code 39 means... ??

    There are no special configuration steps taken, all default values are set besides the vendor daemon and ID_STRING=TRUSTED...

    Thanks.

    P.S.: 'If you set FNO to the debug level of logging,...' <- how to do that ?
    0 Kudos
    RobertDickau
    Flexera Alumni

    The ID_STRING=TRUSTED suggests this is an activatable license model, which involves an activation utility talking directly to FNO. Perhaps try a license file-based license model?

    For setting the log level, please go to Administer Operations > System Configuration; it should be in the first set of configuration settings.
    0 Kudos