SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    My ASP code would not return XML values generated by ColdFusion...

    Hi:
    I have this sample section of an XML file generated from a ColdFusion server:

    -<wsdl:portType name="organizationalModule">
    -<wsdl:operation name="getPositions" parameterOrder="siteid validationkey WhichPosition WhichUnit">
    <wsdl:input name="getPositionsRequest" message="impl:getPositionsRequest"/>
    <wsdl:output name="getPositionsResponse" message="impl:getPositionsResponse"/>
    <wsdl:fault name="CFCInvocationException" message="impl:CFCInvocationException"/>
    -</wsdl:operation>

    I was trying to retrieve the valus associated with siteid, validationkey, WhichPosition, and WhichUnit by using the following code from as classic ASP page:

    <%

    Dim returnString
    Dim myXML ' this variable hold the XML data in a DOM Object
    Dim SoapRequest
    Dim SoapURL
    Dim ResponseXML
    Dim bXMLLoadError

    Set SoapRequest = Server.CreateObject("MSXML2.XMLHTTP")
    Set myXML =Server.CreateObject("MSXML.DOMDocument")

    myXML.Async=False
    SoapURL = "https://ourserver.com/applicationAPI/organizationalModule.cfc?wsdl"
    SoapRequest.Open "GET",SoapURL , False
    SoapRequest.Send()

    'Check that the XML was retrieved successfully by checking to ensure that a HTTP status code of 200 was received (200 = OK)

    if Not myXML.load(SoapRequest.responseXML) or XMLHTTP.Status <> 200 then 'an Error loading XML
    Response.Write("<font color=""red"">Page Error: Could not load XML from remote server</font><br>") 'Show error message
    bXMLLoadError = True

    Else 'parse the XML

    Dim siteid
    Dim validationkey
    Dim WhichPosition
    Dim WhichUnit
    Dim siteValue
    Dim validValue
    Dim positValue
    Dim unitValue

    Set NodeList = objXML.documentElement.selectNodes("/portType/operation")

    Set nodesiteid=myXML.documentElement.selectSingleNode("//siteid").text
    siteValue=nodesiteid.getAttribute("siteid")
    MsgBox siteValue

    Set nodevalid=myXML.documentElement.selectSingleNode("//validationkey").text
    validValue=nodevalid.getAttribute("validationkey")
    MsgBox validValue

    Set nodePos=myXML.documentElement.selectSingleNode("//WhichPosition").text
    positValue=nodePos.getAttribute("WhichPosition")
    MsgBox positValue

    Set nodeUnit=myXML.documentElement.selectSingleNode("//WhichUnit").text
    unitValue=nodeUnit.getAttribute("WhichUnit")
    MsgBox unitValue


    Set myXML = Nothing

    End If


    %>


    My problem is I am not seeing anything back when I run this script. Am I missing something? Do I have to do a specific response.write for each retrieved field?

    I would appreciate any suggestion that would make my crude code work.

    Thanks.
    ReySan
    Last edited by Mittineague; Sep 19, 2011 at 23:32. Reason: OP forgot to turn off smilies

  2. #2
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    'Sorry, but the XML was not displaying properly, so here's another copy:

    -<wsdl: portType name="organizationalModule">
    -<wsdl: operation name="getPositions" parameterOrder="siteid validationkey WhichPosition WhichUnit">
    <wsdl: input name="getPositionsRequest" message="impl:getPositionsRequest"/>
    <wsdl: output name="getPositionsResponse" message="impl:getPositionsResponse"/>
    <wsdl: fault name="CFCInvocationException" message="impl:CFCInvocationException"/>
    </wsdl: operation>


    Thanks.
    ReySan


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •