API, working with asp now

Emagine

Perch
Staff member
Well after a few days intense investigation I have managed to get the XML API working with classic ASP.

We have managed to do the following

  1. Change a users password
  2. Use the role parameter (admin account running under clients account)
  3. Get contact information
  4. Credit an account
  5. Check /authenticate a user
  6. Use under HTTP and HTTPS

use the referral program (have made a referral program), to also set up records within my secondry control panel account details)

i am working on a second control panel, to manage a mass mail manager, Archive manager (passworded), and referral program

i also have a WWF forum running under the same thing.

i have made the XML collection/request into a function if anyone would like to use it. i have 2 verbles within the Function

Envelope and Service

Envelope is teh soap request

Service is used to look at the right .jws

Below is the function



Function GetSoapReturn(strEnvelope, strService)

Dim objHTTP
Dim strReturn


Set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")

strSendingEnvelope = " <soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""> " & _
"<soap:Header > </soap:Header> " & _
" <soap:Body>" & _
"" & strEnvelope & "" & _
"</soap:Body>" & _
"</soap:Envelope>"

'Set up to post to our local server
objHTTP.open "post", "https://cp.your cp url.com:443/psoft/servlet/" & strService &".jws", False

'Set a standard SOAP/ XML header for the content-type
objHTTP.setRequestHeader "Content-Type", "text/xml"

'Set a header for the method to be called
objHTTP.setRequestHeader "SOAPAction", "urn:" & strService &""

'Make the SOAP call
objHTTP.send strSendingEnvelope

'Get the return envelope
strReturn = objHTTP.responseText


set objHTTP = Nothing


GetSoapReturn = strReturn

End Function


here is a copy of one envelope that gets the contact details for the clients account

' get contact info for the user
strContactEnvelope = _

" <ns1:getContactInfo xmlns:ns1=""UserServices"">" & _
" <at href=""#id0""/>" & _
" </ns1:getContactInfo>" & _
" <multiRef id=""id0"" soap:root=""0"" xsi:type=""ns2:AuthToken"" xmlns:ns2=""urn:UserServices"">" & _
" <accountId xsi:type=""xsd:int"">0</accountId>" & _
" <login xsi:type=""xsd:string"">reseller username</login>" & _
" <password xsi:type=""xsd:string"">reseller password</password>" & _
"<role href=""#id1""/>" & _
"</multiRef>" & _
"<multiRef id=""id1"" soap:root=""0"" soap:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/"" xsi:type=""ns3:Role"" xmlns:ns3=""urn:UserServices"" xmlns:soap=""http://schemas.xmlsoap.org/soap/encoding/"">" & _
"<accountId xsi:type=""xsd:int"">0</accountId>" & _
"<login xsi:type=""xsd:string"">clients account username</login>" & _
"</multiRef>"


strContactService = "UserServices"


you are able to do it without the reseller part

this page shows the envel;opes

http://www.psoft.net/HSdocumentation/devel/hs_xml_api_ref.html


any questions ill try and reply the best i can, but i think i have it understood


Acknolegments to Scotty_32

he helped with some code snippets that got me onto the correct path and some VB converstions
 
I meant to send this PM, but public is fine for reference, I will come back and edit the lines to the proper code if needed, but basically what is happening is the XML on the version 3 gets hung sometimes. So this is the answer I meant to send in PM:


"Microsoft.XMLHTTP"

Answer for your ticket, this is XML 3 SP5, which has some problems, try using XML4 instead in the call it will not freeze like that:
"MSXML2.ServerXMLHTTP"

That is XML4, I believe that is the right code, if it doesn't work send me a PM back and I will look up my XML code sample I did for another user that I don't have with me right now.

You can find the 4guysfromrolla comments on the microsoft.xmlhttp here:

http://www.4guysfromrolla.com/webtech/102401-1.shtml

I got that line of code from their sample for xml4, that is why I am not 100% if that is the working code.
 
cheers , im off to bed at the moment, but ill sort it out tomorrow and also look at the url

cheers stephen

on a note apart from this issue its all working 100% fine, but ill get this sorted
 
I was not meaning to imply it was not working, but I am currently at the datacenter installing some new servers, and could not address the ticket properly, I just saw the email copy.

The shift from xml3 to xml4 is seamless, it just prevents that little freeze that happens sometimes in xml3
 
thats ok, no acusations i ment the api as a hole is working ok, well better than ok, and thanks for the advice.

im reright that code tomorrow to use the better mothod
 
Emagine,

how do you know the string you put in strService variable?8o

objHTTP.open "post", "https://cp.your cp url.com:443/psoft/servlet/" & strService &".jws", False
 
there is a php api example kit at psoft.

the service is the wdl like if its admin feature its the admin.wdl or domain.wdl etc
 
sorry was thinking of another api for another site . sorry about that i had a look and looks like they dont have one.

i belive there are some php examples on the psoft forum from a user oin this boards when we where having problems with getting it to work.
 
Back
Top