1 Reply Latest reply: Jan 13, 2012 8:36 AM by 877753 RSS

    HTTP PUBSUB not initializing giving  [ Error: missing } in XML expression ]

    910785
      Hi

      I am using WEBLOGIC 10.3 pusub sever and dojo-release1.1.1

      **I have created a channel with the following config as below**

      <wlps:channel-constraint>
      <wlps:channel-resource-collection>
      <wlps:channel-resource-name>subscribe</wlps:channel-resource-name>
      <wlps:description>subscribe channel constraint</wlps:description>
      <wlps:channel-pattern>/DispatchView/**</wlps:channel-pattern>
      <wlps:channel-operation>subscribe</wlps:channel-operation>
      <wlps:channel-operation>create</wlps:channel-operation>
      <wlps:channel-operation>publish</wlps:channel-operation>
      </wlps:channel-resource-collection>


      In my client side I have the following code in a page.

      dojo.require("dojox.cometd");

      var DEFAULT_CHANNEL = "/DispatchView/PubSub";          
      cometInit = function(){
                     dojox.cometd.init("cometd");
                     log( 'cometd initialized' );
                     }
                     
      onMessage = function(msg) {
           log( 'onMessage() ' + msg.data.test );
      //alert(msg.data.test);
           }

      //handles subscribe onclick
      onSubscribe = function(){
           dojox.cometd.subscribe( DEFAULT_CHANNEL, 'onMessage');
           log( 'subscribed to ' + DEFAULT_CHANNEL );
      }

      cometInit();
      onSubscribe();


      Whenever I am opening the page its giving me the following error.

      [ Error: missing } in XML expression ]
      handshake error!: [ Error: missing } in XML expression ]
      cometd init failed
      Retry in interval+backoff=0+4000=4000ms
      [ Error: missing } in XML expression ]
      handshake error!: [ Error: missing } in XML expression ]
      cometd init failed
      Retry in interval+backoff=0+5000=5000ms


      Am I missing something. Can any body help me with this.
        • 1. Re: HTTP PUBSUB not initializing giving  [ Error: missing } in XML expression ]
          877753
          Hi,
          The problem in your code is you haven't mentioned the server URL which is needed to subscribe.

          dojox.cometd.init("cometd"); this is a wrong intitialization instead you have to use

          dojox.cometd.init("http://localhost:9002/pubsub"); or something like this with an appropriate URL. In this URL /pubsub is context path and not the default channel you subscribe. This was the reason for your error (cometd init failed)


          Please let me know if the problem get solved or still u have any queries regarding the same.