https - How can I send this XML request to my server and have it send to and get a response from another server -


my situation need send xml request user validation server desktop application installed on multiple users workstations. validation server has strict whitelist policy not accept request multiple users ip change regularly.

i think solution have desktop application send xml request coldfusion webserver, webserver somehow send validation server , send response desktop app. i've no idea how accomplish , have little control on webserver, pretty strict on can put on there.

the request pretty simple on https:

<?xml version ="1.0"?> <cspinput appid="asdfasdf" apppassword="asdf1234" > <account userid="johndoe" action="authenticate"> <password>mypasswd1234</password> </account> </cspinput> 

and response:

<?xml version ="1.0"?> <cspoutput returncode="0"> <account userid="johndoe" action="authenticate"> <returnvalue>true</returnvalue> </account> </cspoutput> 

to clear issue how xml through server , validation server. need use or need create it? have access coldfusion/asp web server.

try this...

first, save packet.

<cfsavecontent variable="thexmlpacket">     <cspinput appid="asdfasdf" apppassword="asdf1234" >         <account userid="johndoe" action="authenticate">             <password>mypasswd1234</password>         </account>     </cspinput> </cfsavecontent> 

then use cfhttp post processing server.

<cfhttp method="post" url="https://someurl.com/endpoint" result="xmlresult">     <cfhttpparam type="xml" value="#xmlparse(thexmlpacket)#" /> </cfhttp> 

then process result

<cfif structkeyexists(xmlresult.responseheader,"status_code") , xmlresult.responseheader.status_code eq 200>      <!--- request successful --->     <cfoutput>#xmlparse(xmlresult.filecontent)#</cfoutput> <cfelse>     <!--- request failed --->     <cfdump var="#xmlresult#" /> </cfif> 

notice xml declaration ( <?xml version ="1.0"?> ) has been removed packet, invalid characters before may case java error.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -