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

Re: HTTP API Debugging conundrum



It's illegal in the HTTP protocol to put spaces in a URL.  Spaces are 
used in the actual network protocol to delimit the URL from the HTTP 
version -- so if you put a space in the URL, it thinks that everything 
after the space is the HTTP version -- and since it isn't, you get an 
illegal parameter, which results in the "400 Bad Request"

If you put an illegal URL like this into an old enough web browser, 
you'll have the same problem.

New browsers, however, are "dummy proof".  This started in some version 
of IE (I can't remember which one).  It started accepting illegal URLs, 
both in the address line, and in HTML <a> tags, and it starts 
automatically "fixing" them.   This caused many improperly coded web 
pages to be incomatible with Netscape -- so Netscape was forced to 
provide the same behavior.   Today, all browser are "dummy proof" and 
automatically fix the blanks for you.

However, HTTPAPI isn't a browser.  It's a tool provided for programmers 
to use in computer program code.  It didn't occur to me that I'd have to 
"dummy proof it" :)   Maybe I should.

but, for now -- you can fix your problem by translating blanks in your 
URL...   replace any blanks with '%20'


Fleming, Greg (ED) wrote:
>    We use the http_url_get procedure to post an xml request to an email
>    service (Exact Target), and receive back their response.
> 
> 
>    They have a couple different URL's for doing this, depending on what
>    kind of process is being requested.
> 
> 
>    We've been using one of them for a couple years successfully, and now
>    I have a new program trying to use the other one.
> 
>    When I run it, the return code from the http_url_get procedure is
>    "400", and the text captured in the IFS is "<h1>Bad Request</h1>"
> 
> 
>    However, when I put my program in debug, and stop it just before it
>    calls http_url_get, I can copy and paste the URL string into a
>    browser, and the response from the vendor indicates success, and I
>    receive the email I requested.
> 
> 
>    When I attempt to debug the HTTP API, it actually ends up returning a
>    -1 instead of 400, so I suspect that the fact that I am in debugging
>    is actually causing the routine to behave differently.
> 
>    Having said that, the response from ReqProc() is "1100", and then the
>    response from RespProc() is -1, which gets passed back up the chain to
>    the calling program, so this appears to be where it is choking when
>    I'm in debug, but I don't know why I get a different response when I
>    am not.  When this happens, there is no text captured in the IFS.  My
>    doc is there, but it is empty.
> 
> 
>    If it helps, here is the URL string I am passing to the http_url_get
>    procedure, with the User and Password changed for security.
> 
> 
>     http://api.dc1.exacttarget.com/integrate.aspx?qf=xml&xml=<exacttarget
>    ><authorization><username>XXXXX</username><password>YYYYY</password></
>    authorization><system><action>add</action><system_name>triggeredsend</
>    system_name><TriggeredSend
>    xmlns="http://exacttarget.com/wsdl/partnerAPI";
>    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";><TriggeredSendDe
>    finition><CustomerKey>71533</CustomerKey></TriggeredSendDefinition><Su
>    bscribers><SubscriberKey>gfleming@xxxxxxxxxxxxxxxxxxxx</SubscriberKey>
>    <EmailAddress>gfleming@xxxxxxxxxxxxxxxxxxxx</EmailAddress><Attributes>
>    <Name>First__Name</Name><Value>Greg</Value></Attributes><Attributes><N
>    ame>Last__Name</Name><Value>Fleming</Value></Attributes><Attributes><N
>    ame>Company__Name</Name><Value>Fritos R
>    Us</Value></Attributes><Attributes><Name>Keycode</Name><Value>J4356</V
>    alue></Attributes><Attributes><Name>Account__Number</Name><Value>12345
>    67</Value></Attributes><Attributes><Name>Source</Name><Value>GNeil</Va
>    lue></Attributes></Subscribers></TriggeredSend></system></exacttarget>
> 
> 
>    Judging from the changelog.txt, I think I am on version 1.15 of the
>    API.  If you think upgrading to the latest and greatest would help, I
>    could try that.  I haven't thus far just because that would mean
>    retesting our other programs that already use the API successfully.
> 
> 
>    Anything obvious jump out at anyone ?
> 
> 
>    Greg Fleming
> 
>    Senior Programmer/Analyst
> 
>    Everglades Direct, Inc.
> 
>    720 International Parkway
> 
>    Sunrise, FL 33325
> 
>    954.514.2258
> 
>    954.851.1201 Fax
> 
>    [1]gfleming@xxxxxxxxxxxxxxxxxxxx
> 
> References
> 
>    1. mailto:gfleming@xxxxxxxxxxxxxxxxxxxx
> 
> 
> 
> ------------------------------------------------------------------------
> 
> -----------------------------------------------------------------------
> 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
-----------------------------------------------------------------------