Loading ...
Sorry, an error occurred while loading the content.

YUI - Web Service

Expand Messages
  • Olivier Anguenot
    Hi, Is-it possible with the Connection Manager class to call a Web Service using the asyncRequest ? I have found this example. Is-it a goow way to handle web
    Message 1 of 2 , Jul 2, 2007
    • 0 Attachment
      Hi,

      Is-it possible with the Connection Manager class to call a Web Service
      using the asyncRequest ?

      I have found this example. Is-it a goow way to handle web service ?

      var targetUrl = '...';

      var callback = {
      success: function(o)
      {
      var root = o.responseXML.documentElement;
      if( root.getElementsByTagName( 'faultstring' ).length> 0 )
      {
      var faultstring = root.getElementsByTagName( 'faultstring'
      )[0].firstChild.nodeValue;
      var detailed = '';
      YAHOO.UP.util.each( root.getElementsByTagName( 'detail'
      )[0].childNodes, function( j, textNode )
      {
      if( textNode.nodeValue != null ) detailed +=
      textNode.nodeValue;
      } );

      } else {

      }
      },
      failure: function( o )
      {

      }
      };

      var message = '<s11:Envelope...SOAP Message';


      YAHOO.util.Connect._use_default_post_header = false;
      YAHOO.util.Connect.initHeader( 'Content-Type', 'text/xml', false );
      var ajaxCall = YAHOO.util.Connect.asyncRequest( 'POST', targetUrl,
      callback, message);

      With the message :

      |<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/">
      <s11:Header>
      </s11:Header>
      <s11:Body>
      ...
      </s11:Body>
      </s11:Envelope>|


      Has someone an example ?


      Thanks in advance
      Olivier
    • tssha
      ... Yes. Note: the RSS example at http://developer.yahoo.com/yui/examples/connection/ makes use of a proxy. ... I recommend setDefaultPostHeader(false)
      Message 2 of 2 , Jul 3, 2007
      • 0 Attachment
        --- In ydn-javascript@yahoogroups.com, Olivier Anguenot
        <olivier.anguenot@...> wrote:
        >
        > Hi,
        >
        > Is-it possible with the Connection Manager class to call a Web Service
        > using the asyncRequest ?

        Yes. Note: the RSS example at
        http://developer.yahoo.com/yui/examples/connection/ makes use of a proxy.

        <snip>

        > YAHOO.util.Connect._use_default_post_header = false;

        I recommend setDefaultPostHeader(false) instead of modifying the
        member value directly, so you're not impacted by changes during a
        version increment.

        > YAHOO.util.Connect.initHeader( 'Content-Type', 'text/xml', false );
        > var ajaxCall = YAHOO.util.Connect.asyncRequest( 'POST', targetUrl,
        > callback, message);

        This example:
        http://developer.yahoo.com/yui/examples/connection/weather.html ,
        demonstrates some basic XML document traversal in the callback.

        Regards,
        Thomas
      Your message has been successfully submitted and would be delivered to recipients shortly.