We help IT Professionals succeed at work.

WinInet Issue with HttpOpenRequest (C++)

Jax Logan
Jax Logan asked
on
Experts,

I'm trying to post an xml message to a remote server. The issue is that the server always responds with http code 500 unless I post the correct xml message. But when I try to open a request handle via HttpOpenRequest, the call will fail and gives me a 12005 - invalid URL so I can't get to the next step of actually posting the message via HttpSendMessage. It's a catch 94.7

Is there a way around it without having to change the server implementation?

Thanks!

Call flow:

InternetOpen(...)
HttpOpenRequest(...)
HttpSendMessage(...)
Comment
Watch Question

Hi php-newbie,

the error code 12005 means ERROR_INTERNET_INVALID_URL, so I guess the problem is the URL you pass is wrong.

Could you post the code and the URL you use?

ZOPPO

Author

Commented:
Hi ZOPPO,

thanks for the response. Unfortunately I can't post the URL because it's on our LAN.

But if I use something like Perl HTTP::Request and post to the URL along with the xml message I get a valid response. But if i use the WinINET and try to create the http request first without posting the message, I get the invalid URL response - I believe because the server is responding with 500.
Hi,

I meant I guess the URL maybe isn't coded the way HttpOpenRequest expects - maybe the URL looks like 'http://...', I think I remember that for HttpOpenRequest that prefix must not appear. So just post a fictional URL which looks the same as that one you're using ...

ZOPPO

Author

Commented:
when I try something like gmail.com I get a valid request handle...
That's another indication that somehow the URL you pass must be wrong ...

Author

Commented:
I don't think so - as I mentioned it works fine with a Perl client. The problem is that the server returns an HTTP error when the correct xml is not submitted to it and I can't do that until have have an HTTP Request handle...?

Author

Commented:
no complete explanation