Click to See Complete Forum and Search --> : XML help needed for work


dbush1973
03-20-2010, 01:35 PM
I am an ASP Programmer at work and was transfered to Data Integrations when another employee was let go. I had to take over their job since I am the only one that had some clue over SQL. However, my XML knowledge is very limited.

What I need is some help on a file that I have to create to pull data from a remote web service (database) and bring to ours. We are trying to create a partnership with this other company and have to get an interface (that works) in order for them to allow us to create this bond between databases. What I have already is on our servers and when I click refresh the screen turns white (I was told that if no errors appear then the sending part is correct), however I can not get any return values.

I have right now:


<%

Server.ScriptTimeout=14400
const URL = "xxxxxx" 'This is were the URL goes that I have
const Username = "xxxxxx"
const Password = "xxxxxx"
const ServerName = "xxxxxx"
const Database = "xxxxxx"
const Platform = "SQL"
const YardiPropertyID = "xxxxxx"
const InterfaceEntity = "xxxxxx"

POST /YSI.NET_600614/Source/Interfaces/WebServices/ItfILSGuestCard20.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "xxxxxx" ' this is were the URL goes that I have


<?xml version="1.0" encoding="utf-8"?>
<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/">
<soap:Body>
<UnitAvailability_Login xmlns="http://12.105.42.214/8223thirdDEV/webservices/itfilsguestcard20.asmx">
DIM xml
xml = "<request>"
xml = xml & "<UserName>" & Username &"</UserName>"
xml = xml & "<Password>" & Password & "</Password>"
xml = xml & "<ServerName>" & ServerName & "</ServerName>"
xml = xml & "<Database>" & Database & "</Database>"
xml = xml & "<Platform>" & Platform & "</Platform>"
xml = xml & "<YardiPropertyID>" & YardiPropertyID & "</YardiPropertyID>"
xml = xml & "<InterfaceEntity>" & InterfaceEntity & "</InterfaceEntity>"
</UnitAvailability_Login>
</soap:Body>
</soap:Envelope>


xml = xml & "</command>"
xml = xml & "</request>"
postData = Server.HTMLEncode(xml)
Set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST", url
xmlhttp.setRequestHeader "Host",Host
xmlhttp.setRequestHeader "Content-Type","application/x-www-form-urlencoded"
xmlhttp.setRequestHeader "Content-Type","text/xml"
xmlhttp.setRequestHeader "Content-Length",len(postData)
xmlhttp.send (postData)

%>



The guidlines the other company gave us (the company that is providing a web service to their database) gave us sample request and responses. They are SOAP examples (which I don't know the difference between SOAP and XML) it reads:



' REQUEST

POST / YSI.NET_600614/Source/Interfaces/WebServices/ItfILSGuestCard20.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Lenght: length
SOAPAction:
"http://tempurl.org/YSI.Interfaces.WebServices/ItfILSguestCard20/UnitAvailability_Login"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<UnitAvailability_Login xmlns="http://www.xxxxx.org.......">
<UserName>string</UserName>
<Password>string</Password>
<ServerName>string</ServerName
<Databasae>string</Databasae>
<Platform>string</Platform>
<ID>string</ID>
<InterfaceEntity>string</InterfaceEntity>
</UnitAvailability_Login>
</soap:Body>
</soap:Envelope>



And the code for the response is:



HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://schemas.xmlsoap.org/soap/envelope/">

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://schemas.xmlsoap.org/soap/envelope/">

<soap:Body>
<UnitAvailability_LoginResponse xmls="http://xxxxxxxxxxx.org/">
<UnitAvailability_LoginResult>xml</UnitAvailability_LoginResult>
</UnitAvailability_LoginResponse?
</soap:Body>
</soap:Envelope>



Can anyone help me with this xml and what I should do? This is suppose to be XML DOM and asp, however, I don't think XML DOM vs. Regular XML is a big deal. As long as we can access their database......

Thanks in advanced

daveofgv

Charles
03-20-2010, 04:01 PM
I don't know squat about ASP but I do know a lot about XML and building XML from character strings is way not the way to go. You need to use DOM methods to build the document tree with a parser. Then when the parser spits out the XML you won't have that dropped "/" above.

dbush1973
03-20-2010, 07:27 PM
Charles....

thanks for the reply. I do not know squat really about XML. Do you know of any awsome articles or website's that can really help.

Or can you help some more. This was just layed on my desk and was told that it needed to be done asap.

I am clueless about XML

Thanks

Charles
03-21-2010, 05:17 AM
You shouldn't need to know much. ASP will have some sort of XML parser and some way to use the DOM.

http://www.w3schools.com/dom/default.asp

dbush1973
03-21-2010, 12:01 PM
Thanks for the reply.

Would it be possible to give me an example. I read the article you sent, however, still confused. Remember, I am new at this.

Thanks

Charles
03-21-2010, 02:46 PM
You need to post over at the ASP forum. This is more of an ASP question.

dbush1973
03-21-2010, 02:59 PM
Thanks Charles.

I just posted it in the ASP section.....