User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the RSS, Web Services and SOAP section within the Web Development category of DaniWeb, a massive community of 375,235 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,028 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our RSS, Web Services and SOAP advertiser:

Trouble with SOAP and xslt

Join Date: Mar 2008
Posts: 3
Reputation: ramabahama is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ramabahama ramabahama is offline Offline
Newbie Poster

Re: Trouble with SOAP and xslt

  #2  
Mar 22nd, 2008
Okay, maybe if I show the supporting javascript:
  1. function callService() {
  2. var _IE = (new RegExp('internet explorer', 'gi')).test(navigator.appName);
  3. if(_IE) {
  4. xmlReq = new ActiveXObject('Microsoft.XMLHTTP');
  5. xmlObj = new ActiveXObject('MSXML2.FreeThreadedDOMDocument.3.0');
  6. xslObj = new ActiveXObject('MSXML2.FreeThreadedDOMDocument.3.0');
  7. } else {
  8. xmlReq =new XMLHttpRequest();
  9. xslObjProcessor = new XSLTProcessor();
  10. }
  11. var soapReq = '<?xml version="1.0" encoding="utf-8"?>' +
  12. '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' +
  13. ' <soap:Body>' +
  14. ' <getString xmlns="http://ramabahama.net/webservices">' +
  15. ' <name_in>Bubbly Boobbah</name_in>' +
  16. ' </getString>' +
  17. ' </soap:Body>' +
  18. '</soap:Envelope>';
  19. xmlReq.open('POST', 'http://127.0.0.1/(S(<%=Session.SessionID%>))/webservices/test1/test1.cs.asmx', false);
  20. xmlReq.setRequestHeader('SOAPAction', 'http://ramabahama.net/webservices/getString');
  21. xmlReq.setRequestHeader('Content-Type', 'text/xml');
  22. xmlReq.send(soapReq);
  23. if(xmlReq.status == '200') {
  24. document.getElementById('ServiceDisplay').innerHTML = '';
  25. var xmlResponseXML = xmlReq.responseXML;
  26. var xmlResponseText = xmlReq.responseText;
  27. xmlReq.open('GET', 'http://127.0.0.1/ARIS/products/test1.xslt', false);
  28. xmlReq.send(null);
  29. if(xmlReq.status == '200') {
  30. var xmlHttp;
  31. var xmlReq;
  32. var xslObj;
  33. var xslObjProcessor;
  34. var xmlObj;
  35. if(_IE) {
  36. xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
  37. xmlObj = new ActiveXObject('MSXML2.FreeThreadedDOMDocument.3.0');
  38. xslObj = new ActiveXObject('MSXML2.FreeThreadedDOMDocument.3.0');
  39. xmlObj.async = false;
  40. xslObj.async = false;
  41. var xslTemplateObj = new ActiveXObject('MSXML2.XSLTemplate.3.0');
  42. xslObj.loadXML(xmlReq.responseText);
  43. xslTemplateObj.stylesheet = xslObj;
  44. xslObjProcessor = xslTemplateObj.createProcessor();
  45. xslObjProcessor.input = xmlResponseXML;
  46. xslObjProcessor.transform();
  47. document.getElementById('ServiceDisplay').innerHTML = xslObjProcessor.output;
  48. } else {
  49. var objParser = new DOMParser();
  50. xslObjProcessor = new XSLTProcessor();
  51. xmlObj = xmlResponseXML;
  52. xslObj = xmlReq.responseXML;
  53. xslObjProcessor.importStylesheet(xslObj);
  54. document.getElementById('ServiceDisplay').appendChild(xslObjProcessor.transformToFragment(xmlObj, document));
  55. }
  56. alert(xmlResponseText);
  57. alert(xmlReq.responseText);
  58. alert(document.getElementById('ServiceDisplay').innerHTML);
  59. } else {
  60. alert('Error: ' + xmlReq.status);
  61. }
  62. } else {
  63. document.getElementById('ServiceDisplay').innerHTML = '<span style="color: red; font-weight: bold;">There wuz an error.</span>';
  64. }
  65. }

The only function that is called is 'callService'. That function makes the web service call and then retrieves the xslt file. Both of these are done via Ajax.

I'm sure I'm missing something pretty damned basic .. but I could really use some help.

Thanks.
Reply With Quote  
All times are GMT -4. The time now is 4:19 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC