You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Lisa Davis <lc...@yahoo.com> on 2006/08/22 03:30:16 UTC

XMLNetHTTPInfo questions

  Hi,
  I need to be able to parse a file on a remote server, so I am using the
  URLInputSource for the location of the xml file.
   
  My remote server sees the request but blocks the request out because our server requires some special HTTP headers for user authentication.
   
  I can see that I need to use the XMLNetHTTPInfo class to pass this data along,
  but I can't seem to get the data I load into this class across the wire.
   
  What do I need to do to get this to happen?
   
  The code basically looks like this:
   
  
  XMLNetHTTPInfo* http_info = new XMLNetHTTPInfo();
  http_info->fHTTPMethod = XMLNetHTTPInfo::GET;
  http_info->fHeaders = "Header1: Value\r\nHeader2: Value\r\n";
  http_info->fHeadersLen = strlen(http_info->fHeaders);
  XMLCh* burl = XMLString::transcode("http://blah blah blah/blah.xml");
  XMLURL* url = new XMLURL(burl);
  URLInputSource* inputSource = new URLInputSource(*url);
  parser->parse(*inputSource);
   
  The only header that comes across is the HTTP Host.
   
  thanks
   
  p.s. the blah blah blah is a real location in my code.
   

 		
---------------------------------
Stay in the know. Pulse on the new Yahoo.com.  Check it out. 

RE: XMLNetHTTPInfo questions

Posted by Lisa Davis <lc...@yahoo.com>.
That worked.  Thanks.

Alberto Massari <am...@datadirect.com> wrote:  Jesse is right; XMLNetHTTPInfo is a class used when using the 
XMLNetAccessor directly to fetch data from the net.
You should derive your own class from URLInputSource and redefine 
makeStream() as

BinInputStream* MyURLInputSource::makeStream() const
{
return XMLPlatformUtils::fgNetAccessor->makeNew(fURL, http_info);
}

Alberto

At 09.00 22/08/2006 -0400, Jesse Pelton wrote:
>You construct http_info but never use it. It looks like XMLNetHTTPInfo
>is not actually used by any of the stock classes. I suspect you'll need
>to create your own InputSource, possibly derived from URLInputSource. I
>think it will need some way to specify your XMLNetHTTPInfo (either in a
>constructor or in a setter) and an implementation of makeStream() that
>passes your XMLNetHTTPInfo to WinSockNetAccessor::makeNew().
>
>I'm more or less making this up based on inspecting the source code.
>Someone more familiar with input sources and net accessors (like
>Alberto, who introduced XMLNetHTTPInfo) may have more insight and/or a
>better suggestion.
>
>Note that your URL is invalid; spaces are not allowed. (See RFC 3986 at
>http://www.faqs.org/rfcs/rfc3986.html.)
>
>-----Original Message-----
>From: Lisa Davis [mailto:lcdavis1964@yahoo.com]
>Sent: Monday, August 21, 2006 9:30 PM
>To: c-users@xerces.apache.org
>Subject: XMLNetHTTPInfo questions
>
> Hi,
> I need to be able to parse a file on a remote server, so I am using
>the
> URLInputSource for the location of the xml file.
>
> My remote server sees the request but blocks the request out because
>our server requires some special HTTP headers for user authentication.
>
> I can see that I need to use the XMLNetHTTPInfo class to pass this
>data along,
> but I can't seem to get the data I load into this class across the
>wire.
>
> What do I need to do to get this to happen?
>
> The code basically looks like this:
>
>
> XMLNetHTTPInfo* http_info = new XMLNetHTTPInfo();
> http_info->fHTTPMethod = XMLNetHTTPInfo::GET;
> http_info->fHeaders = "Header1: Value\r\nHeader2: Value\r\n";
> http_info->fHeadersLen = strlen(http_info->fHeaders);
> XMLCh* burl = XMLString::transcode("http://blah blah blah/blah.xml");
> XMLURL* url = new XMLURL(burl);
> URLInputSource* inputSource = new URLInputSource(*url);
> parser->parse(*inputSource);
>
> The only header that comes across is the HTTP Host.
>
> thanks
>
> p.s. the blah blah blah is a real location in my code.
>
>
>
>---------------------------------
>Stay in the know. Pulse on the new Yahoo.com. Check it out.



 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

RE: XMLNetHTTPInfo questions

Posted by Alberto Massari <am...@datadirect.com>.
Jesse is right; XMLNetHTTPInfo is a class used when using the 
XMLNetAccessor directly to fetch data from the net.
You should derive your own class from URLInputSource and redefine 
makeStream() as

BinInputStream* MyURLInputSource::makeStream() const
{
     return XMLPlatformUtils::fgNetAccessor->makeNew(fURL, http_info);
}

Alberto

At 09.00 22/08/2006 -0400, Jesse Pelton wrote:
>You construct http_info but never use it.  It looks like XMLNetHTTPInfo
>is not actually used by any of the stock classes.  I suspect you'll need
>to create your own InputSource, possibly derived from URLInputSource.  I
>think it will need some way to specify your XMLNetHTTPInfo (either in a
>constructor or in a setter) and an implementation of makeStream() that
>passes your XMLNetHTTPInfo to WinSockNetAccessor::makeNew().
>
>I'm more or less making this up based on inspecting the source code.
>Someone more familiar with input sources and net accessors (like
>Alberto, who introduced XMLNetHTTPInfo) may have more insight and/or a
>better suggestion.
>
>Note that your URL is invalid; spaces are not allowed.  (See RFC 3986 at
>http://www.faqs.org/rfcs/rfc3986.html.)
>
>-----Original Message-----
>From: Lisa Davis [mailto:lcdavis1964@yahoo.com]
>Sent: Monday, August 21, 2006 9:30 PM
>To: c-users@xerces.apache.org
>Subject: XMLNetHTTPInfo questions
>
>   Hi,
>   I need to be able to parse a file on a remote server, so I am using
>the
>   URLInputSource for the location of the xml file.
>
>   My remote server sees the request but blocks the request out because
>our server requires some special HTTP headers for user authentication.
>
>   I can see that I need to use the XMLNetHTTPInfo class to pass this
>data along,
>   but I can't seem to get the data I load into this class across the
>wire.
>
>   What do I need to do to get this to happen?
>
>   The code basically looks like this:
>
>
>   XMLNetHTTPInfo* http_info = new XMLNetHTTPInfo();
>   http_info->fHTTPMethod = XMLNetHTTPInfo::GET;
>   http_info->fHeaders = "Header1: Value\r\nHeader2: Value\r\n";
>   http_info->fHeadersLen = strlen(http_info->fHeaders);
>   XMLCh* burl = XMLString::transcode("http://blah blah blah/blah.xml");
>   XMLURL* url = new XMLURL(burl);
>   URLInputSource* inputSource = new URLInputSource(*url);
>   parser->parse(*inputSource);
>
>   The only header that comes across is the HTTP Host.
>
>   thanks
>
>   p.s. the blah blah blah is a real location in my code.
>
>
>
>---------------------------------
>Stay in the know. Pulse on the new Yahoo.com.  Check it out.


RE: XMLNetHTTPInfo questions

Posted by Jesse Pelton <js...@PKC.com>.
You construct http_info but never use it.  It looks like XMLNetHTTPInfo
is not actually used by any of the stock classes.  I suspect you'll need
to create your own InputSource, possibly derived from URLInputSource.  I
think it will need some way to specify your XMLNetHTTPInfo (either in a
constructor or in a setter) and an implementation of makeStream() that
passes your XMLNetHTTPInfo to WinSockNetAccessor::makeNew().

I'm more or less making this up based on inspecting the source code.
Someone more familiar with input sources and net accessors (like
Alberto, who introduced XMLNetHTTPInfo) may have more insight and/or a
better suggestion.

Note that your URL is invalid; spaces are not allowed.  (See RFC 3986 at
http://www.faqs.org/rfcs/rfc3986.html.)

-----Original Message-----
From: Lisa Davis [mailto:lcdavis1964@yahoo.com] 
Sent: Monday, August 21, 2006 9:30 PM
To: c-users@xerces.apache.org
Subject: XMLNetHTTPInfo questions

  Hi,
  I need to be able to parse a file on a remote server, so I am using
the
  URLInputSource for the location of the xml file.
   
  My remote server sees the request but blocks the request out because
our server requires some special HTTP headers for user authentication.
   
  I can see that I need to use the XMLNetHTTPInfo class to pass this
data along,
  but I can't seem to get the data I load into this class across the
wire.
   
  What do I need to do to get this to happen?
   
  The code basically looks like this:
   
  
  XMLNetHTTPInfo* http_info = new XMLNetHTTPInfo();
  http_info->fHTTPMethod = XMLNetHTTPInfo::GET;
  http_info->fHeaders = "Header1: Value\r\nHeader2: Value\r\n";
  http_info->fHeadersLen = strlen(http_info->fHeaders);
  XMLCh* burl = XMLString::transcode("http://blah blah blah/blah.xml");
  XMLURL* url = new XMLURL(burl);
  URLInputSource* inputSource = new URLInputSource(*url);
  parser->parse(*inputSource);
   
  The only header that comes across is the HTTP Host.
   
  thanks
   
  p.s. the blah blah blah is a real location in my code.
   

 		
---------------------------------
Stay in the know. Pulse on the new Yahoo.com.  Check it out.