W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2001

SOAP Listener

From: Halliley, Tom <Tom_Halliley@compuware.com>
Date: Fri, 9 Feb 2001 12:27:18 -0500 (EST)
Message-ID: <8D81DA9D264CD311A60C0008C75D553B045FDB07@cwus-dtw-pri02.compuware.com>
To: "'www-lib@w3.org'" <www-lib@w3.org>
I'm trying to write a SOAP Listener using libwww.  To do so, I've modified
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

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,

/*** 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;


#if (_DEBUG)

  /* Set up default event loop */

  /* Need our own trace and print functions */

  /* 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 */

  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"));
                              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;

Software Architect
Common Technologies Group
248-737-7300 ext. 10117
Received on Monday, 12 February 2001 03:08:49 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:53 UTC