• mtmatt
  • NEWBIE
  • 0 Points
  • Member since 2003

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

I'm having some trouble applying an XSL transformation to data returned from a SOAP Query to Sforce. I've included the XSL and the SOAP message below along with a chunk of ASP code that attempts the transform. 

Any ideas why this might be broken?

----------begin cases.xsl------------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
 <xsl:for-each select="value/valueMap">
  <tr>
  <td><xsl:value-of select="caseNumber" /></td>
  <td><a href="#"><xsl:value-of select="subject" /></a></td>
  <td><xsl:value-of select="id" /></td>
  <td><xsl:value-of select="status" /></td>  
  </tr>
 </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

----------begin soap message received from Sforce--------------
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="salesforce" xmlns:types="salesforce/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<soap:Header/>
<soap:Body>
<sfdc:queryResponse xmlns:sfdc="sfconnector:SalesforceConnector">
<return>
<value xsi:type="tns:array">
<valueMap xsi:type="tns:map">
   <status xsi:type="xsd:string">Closed</status>
   <subject xsi:type="xsd:string">Starting generator after electrical failure</subject>
   <caseNumber xsi:type="xsd:string">00001000</caseNumber>
   <id xsi:type="xsd:string">500300000007s4r</id>
</valueMap>
<valueMap xsi:type="tns:map">
   <status xsi:type="xsd:string">Closed</status>
   <subject xsi:type="xsd:string">Shutting down of generator</subject>
   <caseNumber xsi:type="xsd:string">00001001</caseNumber>
   <id xsi:type="xsd:string">500300000007s4s</id>
</valueMap>
</value>
</return>
</sfdc:queryResponse>
</soap:Body>
</soap:Envelope>

---------------Begin ASP Snippet------------------
  strXSLFile = "cases.xsl"
  set rootNode = xmlObj.documentElement.selectSingleNode("soap:Body/sfdc:queryResponse/return/value") 
  strRows = transformXMLwithXSL(rootNode, strXSLFile)  'this function applies the XSL to the XML

Perhaps I'm just dull, but I can't get a propper login working to save my life.  My server is Win2K SP3/IIS/ASP/VBScript.   I'm using the code below to make my SOAP query:

sforceSoapServer = "https://www.salesforce.com/servlet/servlet.Api"

 sforceSoapHeader = "<soap-env:Envelope xmlns:soap-env=""http://schemas.xmlsoap.org/soap/envelope/""" _
 & " xmlns:tns=""salesforce"" xmlns:types=""salesforce/encodedTypes"" "_
 & " xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" "_
 & " xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""> " _
 & " soap-env:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/""> " _
 & " <soap-env:Header> " _
 & " <headerStruct>" _
 & " <version xsi:type=""xsd:string"">2.0</version>" _
 & " <headerStruct>" _
 & " </soap-env:Header>"

 sforceSoapFooter = "</soap-env:Envelope>"

 strSoapBody = "<soap-env:Body> "
 strSoapBody = strSoapBody & "<tns:login xmlns:tns=""sfconnector:SalesforceConnector"" type=""methodCall"">"
 strSoapBody = strSoapBody & "<username type=""string"">" & strUsername & "</username>"
 strSoapBody = strSoapBody & "<password type=""string"">" & strPassword & "</password>"
 strSoapBody = strSoapBody & "</tns:login>"
 strSoapBody = strSoapBody & "</soap-env:Body>"

 strSoapRequest = sforceSoapHeader & strSoapBody & sforceSoapFooter

 'Build the SOAP header
 Set xmlhttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
 xmlhttp.Open "POST", sforceSoapServer , False  'False = do not respond immediately
 xmlhttp.setRequestHeader "Man", POST & " " & sforceSoapServer & " HTTP/1.1"
 xmlhttp.setRequestHeader "Content-Type", "text/xml"
 xmlhttp.setRequestHeader "Accept-Encoding", "gzip, deflate"
 xmlhttp.setRequestHeader "PrettyPrint", "Yes"
  
 'Send the SOAP request
 xmlhttp.send(strSoapRequest)

The response that I get back from the server is always the same: 

<?xml version="1.0" encoding="UTF-8" ?><methodResponse><fault><value><struct><member><name>faultString</name><value>unknown method name null</value></member><member><name>faultCode</name><value><int>1113</int></value></member></struct></value></fault></methodResponse>

Any ideas?

Perhaps I'm just dull, but I can't get a propper login working to save my life.  My server is Win2K SP3/IIS/ASP/VBScript.   I'm using the code below to make my SOAP query:

sforceSoapServer = "https://www.salesforce.com/servlet/servlet.Api"

 sforceSoapHeader = "<soap-env:Envelope xmlns:soap-env=""http://schemas.xmlsoap.org/soap/envelope/""" _
 & " xmlns:tns=""salesforce"" xmlns:types=""salesforce/encodedTypes"" "_
 & " xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" "_
 & " xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""> " _
 & " soap-env:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/""> " _
 & " <soap-env:Header> " _
 & " <headerStruct>" _
 & " <version xsi:type=""xsd:string"">2.0</version>" _
 & " <headerStruct>" _
 & " </soap-env:Header>"

 sforceSoapFooter = "</soap-env:Envelope>"

 strSoapBody = "<soap-env:Body> "
 strSoapBody = strSoapBody & "<tns:login xmlns:tns=""sfconnector:SalesforceConnector"" type=""methodCall"">"
 strSoapBody = strSoapBody & "<username type=""string"">" & strUsername & "</username>"
 strSoapBody = strSoapBody & "<password type=""string"">" & strPassword & "</password>"
 strSoapBody = strSoapBody & "</tns:login>"
 strSoapBody = strSoapBody & "</soap-env:Body>"

 strSoapRequest = sforceSoapHeader & strSoapBody & sforceSoapFooter

 'Build the SOAP header
 Set xmlhttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
 xmlhttp.Open "POST", sforceSoapServer , False  'False = do not respond immediately
 xmlhttp.setRequestHeader "Man", POST & " " & sforceSoapServer & " HTTP/1.1"
 xmlhttp.setRequestHeader "Content-Type", "text/xml"
 xmlhttp.setRequestHeader "Accept-Encoding", "gzip, deflate"
 xmlhttp.setRequestHeader "PrettyPrint", "Yes"
  
 'Send the SOAP request
 xmlhttp.send(strSoapRequest)

The response that I get back from the server is always the same: 

<?xml version="1.0" encoding="UTF-8" ?><methodResponse><fault><value><struct><member><name>faultString</name><value>unknown method name null</value></member><member><name>faultCode</name><value><int>1113</int></value></member></struct></value></fault></methodResponse>

Any ideas?