Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSXML SOAP Request just isn't working 1

Status
Not open for further replies.

MissouriTiger

Programmer
Oct 10, 2000
185
US
I am praying that someone can help me solve this problem. I have been banging my head against the wall for days.

I am a relatively inexperienced software developer. I'm attempting to set up a PayPal direct payment system on a client's website (using 3-token authentication, not certificate authentication). I have read all the PayPal documentation, and have looked at a number of examples on the Web, and have written an ASP script based on all that information.

The script wraps various data items in an XML document, and attempts to send it as an HTTP request to the PayPal server and capture the results. My script generates the following error message:

'''''''''ERROR MSG '''''''''''''''''''''''''''

"msxml3.dll error '800c0008'

The download of the specified resource has failed.

/PayPalFunctions_GREG.asp, line 213 "

'''''''''END ERROR MSG '''''''''''''''''''''''

This ain't much information to go on. It's no better than saying "Your program didn't work."

Man, if I could just get an error message back from the PayPal server I would be thrilled, but apparently my request never reaches PayPal, becuase if it did, I would get an error message from them.

Below is the main gist of my code. If you would like to see the whole script, including the xml, you can download it here ( feel free to run it and try to fix it :) ):


''''''''''''''''''''''''''''''''''''''''''''''''''''
CODE (Partial)
''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim objHttpRequest, objResponseXMLDoc, objNodeList

set objHttpRequest = Server.createObject("Microsoft.XMLHTTP")

objHttpRequest.open "POST", strPayPalAPIUrl, False

objHttpRequest.setRequestHeader "Content-Type", "text/xml"
objHttpRequest.setRequestHeader "SOAPMethodName", "urn:ebay:api:payPalAPI"

objHttpRequest.send strSoapRequest

objResponseXMLDoc.async = false

set objResponseXMLDoc = createObject("MSXML.DOMDocument")

objResponseXMLDoc.loadXML objHttpRequest.responseText

Set objNodeList = objResponseXMLDoc.SelectNodes("//DoDirectPaymentResponse")


For i = 0 To (objNodeList.Length - 1)
strAck = objNodeList(x).selectSingleNode("Ack").text
strTransactionID = objNodeList(x).selectSingleNode("TransactionID").text
strTimestamp = objNodeList(x).selectSingleNode("Timestamp").text
strAmount = objNodeList(x).selectSingleNode("Amount").text
strAVSCode = objNodeList(x).selectSingleNode("AVSCode").text
strCVV2Code = objNodeList(x).selectSingleNode("CVV2Code").text
i = i + 1
Next

'etc...............

''''''''''''''''''''''''''''''''''''''''''''''''''''
END OF CODE
''''''''''''''''''''''''''''''''''''''''''''''''''''

I would greatly appreciate any attempt to explain why this code doesn't work.



Greg Norris
Software Developer

________________________________________________
Constructed from 100% recycled electrons.
 
Greg,

You are right the call never reaches Paypal. The error you are getting The download of the specified resource has failed. is because your URL in strPayPalAPIUrl is not found. Check the URL.

Hope this helps.

~Satish

Thanks and Regards
Satish Kumar
 
Okay, I will check the URL, but I could swear I double-checked it against their documentation.

I'm curious to know how you figured this out?



Greg Norris
Software Developer

________________________________________________
Constructed from 100% recycled electrons.
 
:) been working with XMLHTTP for a long time now. Hope I was right though :)

~Satish
 
Well, I'm afraid it appears you were wrong. Here's the URL assignment in my code:

strPayPalAPIUrl = "
Try this...

I just copied the URL " and pasted into the address bar of my browser and hit "Go."

The URL was found, and resulted in a prompt for security information. If you just hit "okay" you will get an XML response, which contains an error message.

Thanks for trying though.


Greg Norris
Software Developer

________________________________________________
Constructed from 100% recycled electrons.
 
Yes, since you hit OK you went to the URL but your call is "clicking" cancel and you will get a "End of file or no input: 'No such file or directory'". I tried in Firefox but the same should be in IE too.

~Satish
 
When I direct Firefox to that URL, here is what I get:

---------------------------------------------------
?
<SOAP-ENV:Envelope>
?
<SOAP-ENV:Body SOAP-ENV:encodingStyle=" id="_0">
?
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
?
<faultstring>
End of file or no input: 'No such file or directory'
</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
---------------------------------------------------


The faultcode above is form PayPal, and is not in any way related to the error message that my asp script returns. They are two very different things. Every time you submit anything to that URL you will get an XML response. That XML response might contain an error message, or might contain a success message. But regardless, you will always get XML back no matter what. That's how the API works. My script captures the XML response into an variable, and it is always empty, which is one other reason I know that my script never actually submits the request to PayPal. I just don't know why.

"End of file or no input" means that no XML message was submitted. The URL is correct, I have double checked it with PayPal. But directing your browser to the URL doesn't sbmit an XML Dom formatted request, and therefore, the PayPal API finds "no input".

My point is that I'm not getting this faultcode from PayPal when I run my program, instead I get an error message directly from MSXML. If I could get this XML back form PayPal I would be delighted, becuase then could zero in on the problem and fix it.

Bottom line: There is something wrong with the way I format and and submit my XMLHTTP request, and the server is balking at it, and it never gets sent to PayPal.

I really appreciate your help, but I don't think the URL is my problem.

Thanks again for trying though, and if it turns out that you are right, I will owe you an apology. :)


Greg Norris
Software Developer

________________________________________________
Constructed from 100% recycled electrons.
 
Greg

Sorry I am just trying to help. Hope you bear with me.

I tried downloading your zip file but got a corrupt file error.

~Satish
 
You are right, the file is corrupt.

My FTP program seems to be corrupting files in transit. So here's a different approach. Try either downloading the text file and change the file extension to .asp, or go straight to the test asp file and open it with your browser (but with the second way you won't be able to see the code).

Text file:


ASP on the server:


NOTE: Notice that when I change the CreateObject statement to -

set objHttpRequest = Server.CreateObject("MSXML2.ServerXMLHTTP") 'Didn't work. Certificate required.

it throws the following error:


'''''''''ERROR MSG '''''''''''''''''''''''''''
msxml3.dll error '80072f0c'

A certificate is required to complete client authentication

/paypal/PayPalFunctions_DIST.asp, line 198

'''''''''END ERROR MSG '''''''''''''''''''''''

I have more research to do, but maybe the server is looking for a certificate, and is unable to complete the request without it. And this is in line with what you originally said. Anyway, I have to learn more about these certificates, something I'm currently ignorant about.

The PayPal API isn't supposed to require a certificate if you are using a Secure Signature like I am. But the IIS server that my code is running on might be requiring it in order to access a secure site. I'm really not sure.
I'm afraid I don't know a lot about servers, so I've got a lot of reading to do.

I really appreciate your help. Thanks buddy.


Greg Norris
Software Developer

__________________________________________________
Constructed from 100% recycled electrons.
 
Greg

I found this link. I am not sure if you have already looked at it though. It does mention giving the IUSR_<Machinename> and IWAM_<Machinename> users permission to access the certificate.

Also from what I have read on the net the issue you are getting with the XMLHTTP seems pretty much to be a bug that MS don't seem to have resolved.

~Satish

 
Thanks for the link. I had read several accounts similar to that one a couple weeks ago, but I mistakenly thought I could ignore all that certificate stuff, since I had chosen to use 3-token authentication instead of a cert. I didn't pick up on the fact that IIS requres the cert until this weekend.

I finally installed a certificate last week, but now I know that the local computer account isn't sufficient to do that.
I tried last night to do the IWAM thing, but I don't know the password for those accounts.

Once again, I appreciate all your help. I'm saving that article and will present it to my boss today, along with some other info from MSDN, and hopefully we can get the IUSR_<Machinename> and IWAM_<Machinename> thing straightened out soon.

Thanks again!



Greg Norris
Software Developer

__________________________________________________
Constructed from 100% recycled electrons.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top