SOAP Listener

I'm trying to write a SOAP Listener using libwww.  To do so, I've modified
the 
listen.c example and added the XML parsing stuff from the showxml.c example,

however, nothing happens.  That is, only the initial message "Listening on
port 90..." 
comes out.  If I use the generic listen.c, I receive the SOAP payload just
fine.

The questionable code is shown below.  Is the attachment of the parser
troublesome to
HTServeAbsolute?  If I set a breakpoint at HTXML_newInstance, I can see that
I never get there when the payload arrives.

Thanks for any ideas,
Tom



/*** SNIP

     Left out parser callbacks, etc.

     SNIP ***/

PUBLIC BOOL SOAP_ListenForRequest(const int onPort)
{    
  ListenTool * ms = ListenTool_new();
  int status = HT_ERROR;
  int arg = 0;

  HTLibInit(APP_NAME, APP_VERSION);

#if (_DEBUG)
  HTSetTraceMessageMask("sop");
#endif

  /* Set up default event loop */
  HTEventInit();

  /* Need our own trace and print functions */
  HTPrint_setCallback(printer);
  HTTrace_setCallback(tracer);

  /* Add our own filter to handle termination */
  HTNet_addAfter(terminate_handler, NULL, NULL, HT_ALL, HT_FILTER_LAST);

  /* Register our new XML Instance handler */
  HTXMLCallback_registerNew (HTXML_newInstance, NULL);

  /* Setup a timeout on the request for 15 secs */
  HTHost_setEventTimeout(15000);

  ms->port = onPort;

  /* Set up a tool to listen on this port */
  if (ms->port >= 0) {
	HTList* charsets  = HTList_new();
	HTList* encodings = HTList_new();

    /* Register TCP as the transport */
    HTTransport_add("tcp", HT_TP_SINGLE, HTReader_new, HTWriter_new);

    /* Register the "noop" application layer protocol for reading */
    HTProtocol_add("noop", "tcp", ms->port, NO, NULL, HTLoadSocket);

    /* Set up the request */
    ms->request = HTRequest_new();
    HTRequest_setOutputFormat(ms->request, HTAtom_for("text/xml"));
    HTRequest_setOutputStream(ms->request,
                              HTFWriter_new(ms->request, OUTPUT, YES));

    /* Start listening on the socket */
    if ((status = HTServeAbsolute("noop://localhost", ms->request)) == NO) {
      HTPrint("Can't listen on port %d\n", ms->port);
      Cleanup(ms, -1);
    } else {
	HTPrint("Listening on port %d\n", ms->port);
    }

    /* Go into the event loop... */
    if (status == YES) HTEventList_newLoop();
  }

  Cleanup(ms, 0);
  return YES;
}


---------------------------------
Tom_Halliley@Compuware.com
Software Architect
Common Technologies Group
248-737-7300 ext. 10117
  

Received on Monday, 12 February 2001 03:08:49 UTC