[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: FW: Help with new method?



   Hi Alvin,
   if they won't or can't change it, I have a XMLreader that can read
   most ;-) It is written entirely in RPGLE and can also read most HTML
   pages (HTML is just in many cases "not very wellformed" XML where you
   have to bypass whatever people comes into their <SCRIPT> and <STYLE>
   sections).
   And it is a free as HTTPAPI.
   Regards
   Henrik

   "Alvin Strasburger" <alvins@xxxxxxxxxxxxx>
   Sent by: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx

   07-05-2010 15:18

                             Please respond to
        HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>

                                                                       To

   "HTTPAPI and FTPAPI Projects" <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>

                                                                       cc

                                                                  Subject

   RE: FW: Help with new method?

   Thanks, Scott (and Henrik).
   I have sent the request and reply to the tech support for the server.
   Alvin
   -----Original Message-----
   From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Scott
   Klement
   Sent: Friday, May 07, 2010 12:32 AM
   To: HTTPAPI and FTPAPI Projects
   Subject: Re: FW: Help with new method?
   Hi Alvin,
   Here is the XML document that's being sent to you (from your debug
   file):
   <?xml version="1.0" encoding="ISO-8859-1"?>
   <RateQuote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:noNamespaceSchemaLocation="http://www.con-way.com/XML/RateQuote.xs
   d"
   schemaVersion="1.0" />Error 500:
   Notice the 'Error 500:' at the end of this XML document you're
   receiving?  That's not within the XML document itself -- but it's
   still
   there.  That's not legal in XML syntax.
   So it says "Junk after document element" because the document element
   (named <RateQuote> in this case) which encloses the whole document has
   already ended -- yet there's still more stuff there.
   So the XML data is not legal. And this is a clearly a bug on the
   server
   side -- they are sending a document that is not well formed.   (Or if
   you look at it from another angle, you could say "they are sending a
   document that _is_ well formed, but it's followed by extra junk")
   Anyway -- if you're able, ask the sender to fix their XML document.
   If you're not able (or you don't want to try to get them to change
   becuase they're a good customer or something like that) then you
   should
   try receiving the document, then removing the extra stuff from the end
   (the Error 500: stuff) and then try running it through teh XML parser
   after that has been removed.
   Good luck
   Alvin Strasburger wrote:
   > Spent a good bit of time with this today, but new we keep getting a
   "junk
   > after document element".  Most of the time that is all that is in
   the
   debug
   > file, but after starting a new session, I finally got a file
   complete
   debug
   > to attach.  Below is the code that we are running.
   >
   > Can someone help us with what's wrong here?
   >
   > Thanks,
   >
   > Alvin
   >
   >
   > /free
   >   begsr getpasswd;
   >     rc = http_getauth(basic: digest: realm);
   >     if rc < 0;
   >       msg = HTTP_ERROR;
   >       dsply msg;
   >       return;
   >     endif;
   >    userid = 'enter user id for' + realm;
   >    dsply userid;
   >
   >    pass = 'enter passwd for ' + realm;
   >    dsply pass;
   >
   >    if Digest;
   >      callp http_setauth(HTTP_AUTH_MD5_DIGEST:
   >                       userid: pass);
   >    else;
   >      callp http_setauth(HTTP_AUTH_BASIC:
   >                       userid: pass);
   >    endif;
   >
   >    rc = http_post_xml(URL
   >                       : %addr(Data) + 2
   >                       : %len(Data)
   >                       : %paddr(StartOfElement)
   >                       : %paddr(EndOfElement)
   >                        : *NULL );
   >
   >      if        rc <> 1;
   >        eval      msg = HTTP_ERROR;
   >        dsply                   msg;
   >        return;
   >      endif;
   >    endsr;
   > /end-free
   >
   >
   > -----Original Message-----
   > From: Alvin Strasburger [mailto:alvins@xxxxxxxxxxxxx]
   > Sent: Wednesday, May 05, 2010 3:46 PM
   > To: HTTPAPI and FTPAPI Projects
   > Subject: RE: Help with new method?
   >
   > Mike:
   > We already have eight HTTPAPI applications either in testing or
   production.
   > Some are REST, some SOAP and some use the WEBFORM tool to add the
   parameters
   > to the URL.  They are all parsing the XML replies for us.  So we
   understand
   > how to make that part work even though we don't really understand
   what
   goes
   > on under the covers.  All of these applications accept the USERID
   and PW
   > either within the XML or as part of the WEBFORM portion of the URL.
    The
   > difference with Con-Way is that they require a login first.  This is
   where
   > our lack of HTTP knowledge comes into play.
   >
   > Do we basically combine the Example of supplying user/pass to HTTP
   server
   > (old example 7) with say the UPS tracking example?  (ie.
   http_getauth
   > followed by the http_url_post_xml)?
   >
   > Sorry to be o bother, but we have been researching and studying the
   code
   for
   > some time now and know just enough to understand how much knowledge
   we
   > really lack.
   >
   > Alvin
   >
   >
   > -----Original Message-----
   > From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   > [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Mike
   Krebs
   > Sent: Wednesday, May 05, 2010 1:40 PM
   > To: HTTPAPI and FTPAPI Projects
   > Subject: RE: Help with new method?
   >
   > Alvin,
   >
   > Take a look at EXAMPLE14. Without seeing the documentation for the
   Con-way
   > service, it is hard to know exactly.
   >
   > EXAMPLE14 "posts" XML and parses it "interactively". So, assuming
   the
   > con-way service calls for you to send some XML (post), receive some
   XML,
   and
   > you want to parse the XML immediately, this is a good example. You
   will
   have
   > to add the authentication from EXAMPLE7 or from Thomas' example
   code.
   >
   > If you look at EXAMPLE14, you will find a http_url_post_xml at 130.
   This
   is
   > sending the XML data in the postData variable. When the response
   comes
   back,
   > the StartOfElement and EndOfElement procedures are invoked for the
   start
   of
   > each xml element and the end of each xml element. Again, without
   > understanding what Con-way wants or what your specific requirements
   are,
   we
   > have a hard time helping you.
   >
   > Besides the authentication, yes, it is one statement to send and
   receive
   > XML.
   >
   > Mike Krebs
   >
   >
   >
   >> -----Original Message-----
   >> From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-
   >> bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Alvin Strasburger
   >> Sent: Wednesday, May 05, 2010 8:54 AM
   >> To: HTTPAPI and FTPAPI Projects
   >> Subject: RE: Help with new method?
   >>
   >> Thomas,
   >> Thanks for the simple explanation of the FALSE parm.  You are
   correct
   >> that
   >> this example code is VBScript.  However, rather than from shipwire,
   >> this is
   >> a nearly identical example from the Con-way Freight Rating tools.
   >> Examples
   >> are also available in Cold Fusion, Java, JSP, Perl, PHP and a few
   >> others.
   >>
   >> I'm still a bit hazy regarding exactly which functions (procedures)
   to
   >> call
   >> from HTTPAPI.  From using Example7 to get a successful login, it
   >> appears
   >> that we must begin with http_setauth.  We are unsure exactly which
   >> method(s)
   >> to use after that.  We do want to parse the XML reply.  Can you
   suggest
   >> which modules to call or which HTTPAPI example program best
   >> demonstrates the
   >> necessary steps to interact with this company's offering?
   >>
   >> Alvin
   >> Alvin Strasburger
   >> Printgear Sportswear
   >> Phone    803-744-2310
   >> Toll Free 800-763-7763
   >> mailto:alvins@xxxxxxxxxxxxx
   >> www.printgear.com
   >>
   >> -----Original Message-----
   >> From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   >> [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
   >> thomas.raddatz@xxxxxx
   >> Sent: Wednesday, May 05, 2010 2:27 AM
   >> To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
   >> Subject: Re: Help with new method?
   >>
   >>
   >> Alvin and Scott,
   >>
   >> I assume that the programming language of the example code is
   VBScript
   >> and
   >> the the complete example is taken from here:
   >>
   >>    http://www.shipwire.com/exec/XML_Order_ASP_sample_code.htm
   >>
   >> A description of the "open" methof of "ServerXMLHTTP" can be found
   >> here:
   >>
   >>    http://msdn.microsoft.com/en-us/library/ms763809%28VS.85%29.aspx
   >>
   >> Regading to that description the "false" indicates a synchronous
   call
   >> which is exactly what HTTP API does.
   >>
   >> <quote>
   >> bAsync(optional)
   >>    Boolean. Indicator as to whether the call is asynchronous.
   >>    The default is False (the call does not return immediately).
   >> </quote>
   >>
   >> Thomas.
   >>
   >>
   >> ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx schrieb am 05.05.2010
   06:59:46:
   >>
   >>> Von:
   >>>
   >>> sk@xxxxxxxxxxxxxxxx
   >>>
   >>> An:
   >>>
   >>> ftpapi@xxxxxxxxxxxxxxxxxxxxxx
   >>>
   >>> Datum:
   >>>
   >>> 05.05.2010 07:04
   >>>
   >>> Betreff:
   >>>
   >>> Re: Help with new method?
   >>>
   >>> Gesendet von:
   >>>
   >>> ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   >>>
   >>> Hi Alvin,
   >>>
   >>> Which programming language was that code written in?  I don't
   >> recognize
   >>> the syntax.  You'll need to look up the parameters for the 'open'
   >> method
   >>
   >>> of the "Microsoft.XMLHTTP" class in whatever programming language
   >> that
   >>> is...  this'll tell you what 'false' does.
   >>>
   >>> Good luck!
   >>>
   >>>
   >>> Alvin Strasburger wrote:
   >>>>    We have now been successful with posting XML and SOAP requests
   >> and
   >>>>    parsing the replies as well as using the WEBFORMS tool to send
   >> simple
   >>>>    strings.  We have tried to learn as much as we could in the
   >> process.
   >>>>    Unfortunately, we have much more knowledge about RPG
   programming
   >> and
   >>>>    business logic than we have about web programming.
   >>>>
   >>>>
   >>>>     We are in the final stages of integrating freight rating into
   >> our
   >>>>    order entry system and do not quite understand what is
   required
   >> for
   >>>>    one specific carrier's system.  We have found the following
   >> excerpt
   >>>>    from an example in their documentation and help translating it
   >> to
   >> the
   >>>>    "HTTPAPI language".
   >>>>
   >>>>
   >>>> set httpConn = Server.CreateObject("Microsoft.XMLHTTP")
   >>>> 'or alternately depending on what is installed on your server:
   >>>> 'set httpConn = Server.CreateObject("MSXML2.ServerXMLHTTP")
   >>>> 'or whatever parser you have installed
   >>>>
   >>>> ' open synchronous connection to X-ShipmentStatus
   >>>> httpConn.open "POST",xxxxxxXmlUrl,false,username,password
   >>>>
   >>>>
   >>>> 'set post data type, and post data
   >>>> httpConn.setRequestHeader "Content-type","application/x-www-form-
   >>> urlencoded"
   >>>> httpConn.Send requestType & "=" & xmlRequest
   >>>>
   >>>>
   >>>>    We know that xxxxxXmlUrl is a constant containing the URL and
   >> that
   >>>>    xmlRequest is a constant containing the XML of our request.
   We
   >> also
   >>>>    know the ID and Password.  We also know that we need to send
   the
   >> ID
   >>>>    and PW first in order to log in.  We are not sure what the
   >> parameter
   >>>>    false is for.  It is not documented as a constant.
   >>>>
   >>>>
   >>>>    Can someone help us by listing the specific functions we need
   to
   >> call
   >>>>    and in what order?
   >>>>
   >>>>
   >>>>    Thanks,
   >>>>
   >>>>    Alvin
   >>>>
   >>>>    Alvin Strasburger
   >>>>
   >>>>    Printgear Sportswear
   >>>>
   >>>>    Phone    803-744-2310
   >>>>
   >>>>    Toll Free 800-763-7763
   >>>>
   >>>>    [1]mailto:alvins@xxxxxxxxxxxxx
   >>>>
   >>>>    [2]www.printgear.com
   >>>>
   >>>> References
   >>>>
   >>>>    1. mailto:alvins@xxxxxxxxxxxxx
   >>>>    2. http://www.printgear.com/
   >>>>
   >>>>
   >>>>
   >>>>
   >>
   ----------------------------------------------------------------------
   -
   >> -
   >>>>
   >>
   ----------------------------------------------------------------------
   -
   >>>> This is the FTPAPI mailing list.  To unsubscribe, please go to:
   >>>> http://www.scottklement.com/mailman/listinfo/ftpapi
   >>>>
   >>
   ----------------------------------------------------------------------
   -
   >>>
   ---------------------------------------------------------------------
   >> --
   >>> This is the FTPAPI mailing list.  To unsubscribe, please go to:
   >>> http://www.scottklement.com/mailman/listinfo/ftpapi
   >>>
   ---------------------------------------------------------------------
   >> --
   >>
   >> --
   >> IMPORTANT NOTICE:
   >> This email is confidential, may be legally privileged, and is for
   the
   >> intended recipient only. Access, disclosure, copying, distribution,
   or
   >> reliance on any of it by anyone else is prohibited and may be a
   >> criminal
   >> offence. Please delete if obtained in error and email confirmation
   to
   >> the
   >> sender.
   >>
   ----------------------------------------------------------------------
   -
   >> This is the FTPAPI mailing list.  To unsubscribe, please go to:
   >> http://www.scottklement.com/mailman/listinfo/ftpapi
   >>
   ----------------------------------------------------------------------
   -
   >>
   >> No virus found in this incoming message.
   >> Checked by AVG - www.avg.com
   >> Version: 9.0.814 / Virus Database: 271.1.1/2854 - Release Date:
   >> 05/04/10
   >> 14:27:00
   >>
   >>
   ----------------------------------------------------------------------
   -
   >> This is the FTPAPI mailing list.  To unsubscribe, please go to:
   >> http://www.scottklement.com/mailman/listinfo/ftpapi
   >>
   ----------------------------------------------------------------------
   -
   >
   ----------------------------------------------------------------------
   -
   > This is the FTPAPI mailing list.  To unsubscribe, please go to:
   > http://www.scottklement.com/mailman/listinfo/ftpapi
   >
   ----------------------------------------------------------------------
   -
   >
   > No virus found in this incoming message.
   > Checked by AVG - www.avg.com
   > Version: 9.0.814 / Virus Database: 271.1.1/2854 - Release Date:
   05/05/10
   > 02:26:00
   >
   >
   >
   ----------------------------------------------------------------------
   --
   >
   >
   ----------------------------------------------------------------------
   -
   > This is the FTPAPI mailing list.  To unsubscribe, please go to:
   > http://www.scottklement.com/mailman/listinfo/ftpapi
   >
   ----------------------------------------------------------------------
   -
   ----------------------------------------------------------------------
   -
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   http://www.scottklement.com/mailman/listinfo/ftpapi
   ----------------------------------------------------------------------
   -
   No virus found in this incoming message.
   Checked by AVG - www.avg.com
   Version: 9.0.819 / Virus Database: 271.1.1/2858 - Release Date:
   05/06/10
   14:26:00
   ----------------------------------------------------------------------
   -
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   http://www.scottklement.com/mailman/listinfo/ftpapi
   ----------------------------------------------------------------------
   -
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------