Jump to content

Recommended Posts

I have made a program that takes a xml file and sends it to an off-site server. My problem is that the value of the content-length header will not change to the number I specify. I use wireshark to check what my request header looks like, and the content-length value never changes no matter what I put down. Does WinHTTP make up his own content-length?

Thank you

Link to comment

Do you need to use activeX?

I am not a very experienced LabVIEW programmer and found that activeX was a bit too advanced to use. Plus I heard that it was a lot of hassle even if you are experienced/skilled enough.

I use a format-in-to string function to build my own http header (for a SOAP client and the sam for the SOAP message which is basically an XML with SOAP namespaces) you may want to try it out its pretty simple.

I had a couple of issues when starting as it is important to use CRLF for each line of the HTTP Header and then 2 at the end before the body and the body can be just LFs.

post-11721-1240492316.jpg?width=400

I can post more code if you like, but, I took most of my queues from the XML-RPC server/client project in the code repository.

Link to comment

I don't really need to use ActiveX. I tried it with TCP/IP before I used ActiveX and that didn't work out. So I looked into using ActiveX object WinHTTP and it was actually easier to build then my TCP/IP program that I had.

Could you maybe post a little more code that shows how you make a connection?

I'm using LabVIEW 8.0 and LabVIEW 8.2 and the XML-RPC client/server project project in the code repository requires LabVIEW 8.5 and above.

Thanks

Link to comment

If you are only sending some basic pages to the server I think you would be better off building your strings and sending them via the native TCP connections. If you do a trace using your ActiveX version you should see what messages are being passed to the server. Your earlier version may have simply been missing a message that was generated by the ActiveX component. The TCP VIs are fairly basic. You would essentially need to use three of them. They would be the open, write and close VIs. More likely than not you will want to open the connection on port 80. What types of problems were you encountering?

Link to comment

QUOTE (LVBeginner @ Apr 23 2009, 09:21 AM)

Although the repository page only lists 8.5 as the version, the zip archive includes versions for 7.1 and 8.0 for the XML-RPC code. So you can download it and take a look if you're interested.

Mark

QUOTE (Mark Yedinak @ Apr 23 2009, 09:55 AM)

If you are only sending some basic pages to the server I think you would be better off building your strings and sending them via the native TCP connections. If you do a trace using your ActiveX version you should see what messages are being passed to the server. Your earlier version may have simply been missing a message that was generated by the ActiveX component. The TCP VIs are fairly basic. You would essentially need to use three of them. They would be the open, write and close VIs. More likely than not you will want to open the connection on port 80. What types of problems were you encountering?

IIRC, the original problem here was accessing web pages from behind a proxy server - LabVIEW TCP/IP vi's don't have any automatic way to handle that and WinHTTP does. Still, one could write some LV code to handle building the requests to the proxy server, if one wanted to.

Mark

Link to comment

QUOTE (Mark Yedinak @ Apr 23 2009, 03:55 PM)

If you are only sending some basic pages to the server I think you would be better off building your strings and sending them via the native TCP connections. If you do a trace using your ActiveX version you should see what messages are being passed to the server. Your earlier version may have simply been missing a message that was generated by the ActiveX component. The TCP VIs are fairly basic. You would essentially need to use three of them. They would be the open, write and close VIs. More likely than not you will want to open the connection on port 80. What types of problems were you encountering?

With TCP/IP connections I was trying a simple GET method but I would get ERROR 56 which gave an explanation from LabVIEW: The network operation exceeded the user-specified or system time limit. Here is a screenshot of a simple client that I just made.

Is there anybody that has worked with the ActiveX object WinHTTP successfully before so that they could maybe look at my code and help me out.

Thanks

Link to comment

QUOTE (mesmith @ Apr 23 2009, 11:06 AM)

IIRC, the original problem here was accessing web pages from behind a proxy server - LabVIEW TCP/IP vi's don't have any automatic way to handle that and WinHTTP does. Still, one could write some LV code to handle building the requests to the proxy server, if one wanted to.

Well HTTP proxy is really a whole layer above TCP/IP so there is no way the LabVIEW TCP/IP nodes should or even could support HTTP proxy functionality. That has to be built on top of those TCP/IP nodes and that is in fact fairly easy. As I have written elsewhere here, there is a non-released HTTP library on OpenG that supports proxy access and has worked fine for me in the past.

Non-released means you can't get the library through VIPM but have to get the actual VIs from the OpenG Toolkit CVS repository on Sourceforge. You can do that by using a CVS client such as Turtoise CVS or by using the Sourceforge Web Browser interface to their CVS service.

VIPM actually uses those VIs to access the code repositories! :shifty:

Rolf Kalbermatter

Link to comment

QUOTE (rolfk @ Apr 23 2009, 11:18 AM)

Well HTTP proxy is really a whole layer above TCP/IP so there is no way the LabVIEW TCP/IP nodes should or even could support HTTP proxy functionality. That has to be built on top of those TCP/IP nodes and that is in fact fairly easy. As I have written elsewhere here, there is a non-released HTTP library on OpenG that supports proxy access and has worked fine for me in the past.

Non-released means you can't get the library through VIPM but have to get the actual VIs from the OpenG Toolkit CVS repository on Sourceforge. You can do that by using a CVS client such as Turtoise CVS or by using the Sourceforge Web Browser interface to their CVS service.

VIPM actually uses those VIs to access the code repositories! :shifty:

Rolf Kalbermatter

Yep, I misspoke - I should have said LabVIEW doesn't support proxy servers since the TCP/IP layer is a lower level protocol. But the OpenG solution looks like a good way to avoid activeX ;)

Mark

Link to comment

My biggest problem is that I can do a GET method and get a bunch of html displaying as a response. I can do a GET with my ActiveX WinHTTP on pretty much any site. www.plexus-online.com I use to punch in at work and hermes.plexus-online.com would be used for the uploaded file from me. How come I can do a GET on the first webpage, but when I'm trying to do a GET on the hermes server I get the error that my security policy denies me access. My IT guy has opened up ports for the hermes server but it still doesn't work.

I was thinking that maybe the people that work with this hermes server haven't resolved my IP address even though I have given it to them?

Sorry if the question is out of this forum but I need help

Thank you

Link to comment

QUOTE (LVBeginner @ Apr 23 2009, 02:46 PM)

How come I can do a GET on the first webpage, but when I'm trying to do a GET on the hermes server I get the error that my security policy denies me access. My IT guy has opened up ports for the hermes server but it still doesn't work.

I think there's still some kind of configuration issue at hermes' end -- can you browse to the page in your browser? If so, you might have to fake a UserAgent header or the like. I get the security policy error you mention when trying to browse to the page, however.

Link to comment

QUOTE (asbo @ Apr 23 2009, 07:06 PM)

I think there's still some kind of configuration issue at hermes' end -- can you browse to the page in your browser? If so, you might have to fake a UserAgent header or the like. I get the security policy error you mention when trying to browse to the page, however.

I can't browse to the page with my browser, tried IE, Opera, and Mozilla. I have tried everything, and I'm coming to the point where I'm thinking that there is still some configuration to be done on hermes' end.

Link to comment

If you can't reach it with a browser, you might have some config issues, as stated.

But isn't an HTTP header terminated when you post an empty line, that is a consecutive CRLFCRLF (0x0d0a0d0a) sequence? Perhaps the empty lines in your string constant be tripping you up, or at least explain that error 56.

Link to comment

QUOTE (LVBeginner @ Apr 23 2009, 02:46 PM)

My biggest problem is that I can do a GET method and get a bunch of html displaying as a response. I can do a GET with my ActiveX WinHTTP on pretty much any site. http://www.plexus-online.com' rel='nofollow' target="_blank">www.plexus-online.com I use to punch in at work and hermes.plexus-online.com would be used for the uploaded file from me. How come I can do a GET on the first webpage, but when I'm trying to do a GET on the hermes server I get the error that my security policy denies me access. My IT guy has opened up ports for the hermes server but it still doesn't work.

I was thinking that maybe the people that work with this hermes server haven't resolved my IP address even though I have given it to them?

Sorry if the question is out of this forum but I need help

Thank you

When I browse to that server I get a dialog box that only IE is allowed to go there. When I use IE I get a login page. Now looking at the HTML code there seems to be some scripting done for this functionality. So it seems you would have to not only send a User Agent but in fact a very specific User Agent.

Trying with the OpenG VI a bit I can see that you need to use at least following information:

GET \ HTTP/1.0\r\n

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; WWTClient2; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)\r\n

Host: www.plexus-online.com\r\n

\r\n

to get a valid response. You probably can get rid of some of the software versions about .NET and Office in the User Agent string.

But that response contains JAVA scripting so there is the next problem!!!! I don't think you want to implement Java script in LabVIEW :rolleyes:

Rolf Kalbermatter

Link to comment

QUOTE (LVBeginner @ Apr 27 2009, 07:29 AM)

You tried http://www.plexus-online.com' rel='nofollow' target="_blank">www.plexus-online.com right? I can do a GET method on that page with my ActiveX program. It's when I try to do anything with the hermes server page, that I can't get any response from it.

And what the heck is hermes???????????????????????????????????????

Rolf Kalbermatter

Link to comment

QUOTE (LVBeginner @ Apr 27 2009, 09:54 AM)

Well I can't even access it so I have no idea what it looks like, or what it does. I don't even know that it exists for real when going there with my webbrowser.

Rolf Kalbermatter

Link to comment

QUOTE (rolfk @ Apr 27 2009, 02:56 PM)

Well I can't even access it so I have no idea what it looks like, or what it does. I don't even know that it exists for real when going there with my webbrowser.

Rolf Kalbermatter

Thank you Rolf

I think that they haven't given me access to their server even though I have given them my IP address which I would be using for the data transfer.

Thanks to everybody for the responses I think I have to try and hunt down somebody at that company.

Link to comment

Hey Guys

Just wanted to thank everybody one more time for all the help. My program is working now and the problem I was having was not on my side. I am able to send an xml file using the ActiveX object WinHTTP successfully. The problem was that they didn't resolve my IP address properly.

Thanks again

Igor

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.