Before you can handle HTTP requests, you need to register your service with HTTP stack. This allows HTTP stack to forward URL requests to the proper method. You can also list your service in the main table of contents for simplified access. Take a look at the NetWare Remote Manager entry page and decide if your service fits under one of the topics listed on the left.
There are two methods used to register services with HTTP stack; RegisterServiceMethod, and RegisterServiceMethodEx. RegisterServiceMethodEx contains a parameter to pass a table of contents structure.
Before you call RegisterServiceMethodEx, you need to build the TOCregistration structure and fill in the variables:
struct TOCregistration tocreg;
CStrCpy(&tocreg.TOCHeadingName, "Volume Management");
tocreg.TOCHeadingNumber = 0;
CSetB(0, &tocreg.reserved[0], 4);
TOCHeadingNumber corresponds with the seven headings listed on the left side of the entry page (starting with 0). You can list your service under any heading by setting TOCHeadingNumber to the corresponding value.
Now that you have the TOCregistration struct, you can register your service with the HTTP stack:
BOOL eflg;
char *pzDemoService = "DEMO";
eflg = RegisterServiceMethodEx("Portal Demo Pages", pzDemoService, CStrLen(pzDemoService), &tocreg, 0, 0, &demoMethod, demoServiceMethodTag, &ccode);
if (eflg == FALSE) return(ccode);
return(0);
You now have a service registered under the name DEMO and demoMethod is registered as the connection request method. Now, if a URL request comes in to http://<portal_server>/DEMO/..., demoMethod is called to handle the request. Note that you need to use RegisterServiceMethodEx in order to register your service in the table of contents for NetWare Remote Manager.
The first call to the registered method is an initialization call. The CONTROL_INITIALIZATION_BIT is set in the InformationBits to signal this call. This allows the method to do any of its own initialization it needs to do before handling HTTP requests. Also, when HTTPSTK unloads or the method is deregistered, another call to the method is made with the CONTROL_DEINITIALIZATION_BIT set. Make sure any symbols dynamically imported from HTTPSTK are released before returning from your method on deinitialization.