Jump to content


Photo

SOAP request and parsed response in classic ASP

SOAP classic ASP XML Request Response Parsing

  • Please log in to reply
No replies to this topic

#1 BillM

BillM

    Newbie

  • Members
  • Pip
  • 6 posts
  • Gender:Male
  • Location:Jacksonville, FL
  • Languages:html, Classic ASP, VBScript, JavaScript, CSS

Posted 23 May 2012 - 01:39 PM

OK, first and foremost, am using classic ASP as that is what I have to work with. All electronic forms in my company are currently in classic ASP. Too many of them to move to .net any time soon. That said, I have written an html form that includes sending a SOAP request to our CRM (ticketing system) which is vendor hosted. They are supplying the .net web service to the CRM's database. This will send back a response not only of a successful receipt, but also a ticket number which I am to display to the customer's screen. I am pretty comfortable with the sending part, I think. It is the response I am not so sure about. I've done XML responses through a web service before; however, I've never had a response I would have to parse before.

Here are the questions that I have:

1. Are the request and response generally coded in the same envelope or separately?

2. I'm pretty comfortable displaying text received in a response using xmlhttp.responseText, but HOW would you parse the SOAP response in classic ASP?

Below is the code I have for the Request:

  strXML = ""
  strXML = strXML & "<?xml version=""1.0"" encoding=""UTF-8""?>" & strCR
  strXML = strXML & "<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" & strCR
  strXML = strXML & "  <SOAP-ENV:Header>" & strCR
  strXML = strXML & "    <m:header xmlns:m='http://VenderURL'>" & strCR
  strXML = strXML & "	  <docType>Esr Client</docType>" & strCR
  strXML = strXML & "	  <version>3.0</version>" & strCR
  strXML = strXML & "	  <sender type='CUSTSYSID'>WIN</sender>" & strCR
  strXML = strXML & "	  <receiver type='CUSTSYSID'>CCC</receiver>" & strCR
  strXML = strXML & "	  <requestSyncType>synchronous</requestSyncType>" & strCR
  strXML = strXML & "	  <deployment.Mode>test</deployment.Mode>" & strCR
  strXML = strXML & "	  <partner type='CUSTSYSID'>" & String & "</partner>" & strCR
  strXML = strXML & "	  <transactionId>" & IntPONumber & "</transactionId>" & strCR
  strXML = strXML & "	  <timestamp>" & strTimeStamp & "</timestamp>" & strCR
  strXML = strXML & "    </m:header>" & strCR
  strXML = strXML & "  </SOAP-ENV:Header>" & strCR
  strXML = strXML & "  <SOAP-ENV:Body>" & strCR
  strXML = strXML & "    <m:serviceRequest xmlns:m='http://VendorURL' action='String'>" & strCR
  strXML = strXML & "	  <ticketInfo ticketNumber='String'>" & strCR
  strXML = strXML & "	    <refTicketNumber>" & "intPONumber" & "</refTicketNumber>" & strCR
  strXML = strXML & "	    <openedDateStamp>" & strTimeStamp & "</openedDateStamp>" & strCR
  strXML = strXML & "	    <sentDateStamp>" & strTimeStamp & "</sentDateStamp>" & strCR
  strXML = strXML & "	    <transDateStamp>" & strTimeStamp & "</transDateStamp>" & strCR
  strXML = strXML & "	    <problemDescription>" & "strCCDescription" & "</problemDescription>" & strCR
  strXML = strXML & "	    <resolution code='String' timeStamp='YYYY-MM-DDTHH:MM:SS'>" & String & "</resolution>" & strCR
  strXML = strXML & "	    <shortDescription>" & strSubject & "</shortDescription>" & strCR
  strXML = strXML & "	    <status>2</status>" & strCR
  strXML = strXML & "	    <priority internalCode='3'/>" & strCR
  strXML = strXML & "	    <severity code='3'/>" & strCR
  strXML = strXML & "	    <sla contractId=&#8221;&#8221;>" & strCR
  strXML = strXML & "		  <contractName>Winn-Dixie SLA Contract</contractName>" & strCR
  strXML = strXML & "	    </sla>" & strCR
  strXML = strXML & "	    <technician.id>" & strTechnician & "</technician>" & strCR
  strXML = strXML & "	    <category name='IssueCode1'>INCIDENT</category>" & strCR
  strXML = strXML & "	    <category name='IssueCode2'>HARDWARE</category>" & strCR
  strXML = strXML & "	    <category name='IssueCode3'>BREAK / FIX</category>" & strCR
  strXML = strXML & "	  </ticketInfo>" & strCR
  strXML = strXML & "   <entitlement>" & strCR
  strXML = strXML & "	    <code>" & CustCode & "</code>" & strCR
  strXML = strXML & "	  </entitlement>" & strCR
  strXML = strXML & "	  <contact type='primary' vip=&#8221;false&#8221;>" & strCR
  strXML = strXML & "	    <company>WINN-DIXIE</company>" & strCR
  strXML = strXML & "	    <Email>WD REQ</Email>" & strCR
  strXML = strXML & "	  </contact>" & strCR
  strXML = strXML & "	  <serviceAddress site='0'>" & strCR
  strXML = strXML & "	  </serviceAddress>" & strCR
  strXML = strXML & "	  <equipment>" & strCR
  strXML = strXML & "	    <model>" & part_no & "</model>" & strCR
  strXML = strXML & "	  <description>" & strConfigItem & "</description>" & strCR
  strXML = strXML & "	  </equipment>" & strCR
  strXML = strXML & "	  <extrinsics name='FLEX2'>" & strPartDesc & "</extrinsics>" & strCR
  strXML = strXML & "    </m:serviceRequest>" & strCR
  strXML = strXML & "  <SOAP-ENV:Fault>" & strCR
  strXML = strXML & "    <faultcode>SOAP-ENV:Client</faultcode>" & strCR
  strXML = strXML & "    <faultstring>[ISS.0088.9134] Exception occurred while processing the body of the message</faultstring>" & strCR
  strXML = strXML & "    <faultactor>http://b2bqc.compucom.com/soap</faultactor>" & strCR
  strXML = strXML & "  </SOAP-ENV:Fault>" & strCR
  strXML = strXML & "  </SOAP-ENV:Body>" & strCR
  strXML = strXML & "</SOAP-ENV:Envelope>"
	   
' End of Request section
 
' Call the webservice using POST
  baseURL="[url="https://b2bqc.compucom.com/ws/CcEsrV4:provider"]https://b2bqc.compucom.com/ws/CcEsrV4:provider[/url]"   'Link for Production Environment
  
		    Set objXmlHttp = CreateObject("MSXML2.ServerXMLHTTP.3.0")
		    objXmlHttp.setTimeouts toResolve, toConnect, toSend, toReceive		
		    objXmlHttp.Open "POST", baseURL, False
		    objXMLHttp.Send(strXML)
		  

Here's the code for the response:

 
strXMLResponse = ""
strXMLResponse = strXMLResponse & "<SOAP-ENV:Envelope xmlns:SOAP-ENV='[url="http://schemas.xmlsoap.org/soap/envelope/"]http://schemas.xmlsoap.org/soap/envelope/[/url]' xmlns:SOAP-ENC='[url="http://schemas.xmlsoap.org/soap/encoding/"]http://schemas.xmlsoap.org/soap/encoding/[/url]' xmlns:xsd='[url="http://www.w3.org/2001/XMLSchema"]http://www.w3.org/2001/XMLSchema[/url]'
xmlns:xsi='[url="http://www.w3.org/2001/XMLSchema-instance"]http://www.w3.org/2001/XMLSchema-instance[/url]'>" & strCR
strXMLResponse = strXMLResponse &  "<SOAP-ENV:Body>" & strCR
strXMLResponse = strXMLResponse & "  <serviceResponse>" & strCR
strXMLResponse = strXMLResponse & "    <status code="?">string</status>" & strCR
strXMLResponse = strXMLResponse & "    <statusMsg>string</statusMsg>" & strCR
strXMLResponse = strXMLResponse & "    <ticketNumber>string</ticketNumber>" & strCR
strXMLResponse = strXMLResponse & "    <refTicketNumber>string</refTicketNumber>" & strCR
strXMLResponse = strXMLResponse & "  </ESR:serviceResponse>" & strCR
strXMLResponse = strXMLResponse & "</SOAP-ENV:Body>" & strCR
strXMLResponse = strXMLResponse & "</SOAP-ENV:Envelope>"
 
' XML Response from Vendor
responseXML = xmlhttp.responseText
response.write("Your Ticket Number is: ") & "<b><font color='#cc0000' size='4'>" & responseXML & "</font></b>"

Any guidance anyone can provide would be greatlly appreciated.

Thanks,

BillM





Also tagged with one or more of these keywords: SOAP, classic ASP, XML, Request, Response, Parsing

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users