Web [Service] 1.0



  • While integrating a 3rd-party CRM app, most of the documentation - no, I'm just kidding, there isn't any documentation - most of the responses from its homebrew XML API are encapsulated in a pretty simple structure with a success tag and a message tag. Our "update the website" code is thus pretty simple, and can generically parse most responses for the "success" value, and fail/retry if it's false, while logging the details. Simple stuff.

    Client calls us, complains that nothing is being updated on their website. The user log contains no information about the response. The debug log contains this hunk of crap, representing the full response from the API call:

    <WTFAPI mode="Insert">
        <tracking>
            <successful>False</successful>
            <message>System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'aaaaaTrackingNumbers_PK'. Cannot insert duplicate key in object 'TrackingNumbers'.
    The statement has been terminated.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteScalar()
       at Sql_Misc50.Class_SQL50.ExecuteSQLTextReturnScalar_MsSQL(Object& SqlConnection_, String& sSQL, Boolean bDispose, Boolean bLog_SQL_Usage, Object[]& SqlParameters)
    INSERT INTO [TrackingNumbers]
    ([OrderID], [ShipDate], [TrackingNumber])
    VALUES
    (@OrderID , @ShipDate , @TrackingNumber )
    SELECT @@IDENTITY;</message>
        </tracking>
    </WTFAPI>

    People, if you're going to use XML for webservices and for some reason not use an established toolkit:

    1. Escape your output or just use the DOM, for chrissakes (wtf do I care that you pass your connection object by reference? All I care is that it's NOT VALID XML, ASSHOLE)
    2. Stop putting stacktraces into your output altogether - that's what logs are for
    3. Stop putting raw SQL commands into your output - see above
    4. Try to friggin design an API that doesn't force me to telepathically understand your DB structure, knowing that it may be slightly silly to make an API where one is required to C, U and D without being able to R.

    And namespaces like "Sql_Misc50" and "Class_SQL50" and methods like "ExecuteSQLTextReturnScalar_MsSQL" lead me to believe that your code is not, how to put this nicely, a joy to work with. Especially if it's anything like your API.



  •  Hmm,

    I have a project to integrate a B2B web app. I was going to send the other business an XML document. My initial design was way too simple. This will make the other web developer who has to write the parser cry. 

     

     



  • Heh. This is on par with that web service that made my client barf when it returned text from a CORBA exception.

    Or that other one where I expect a four-letter return code, but sometimes returns stuff like

    ERROR: [ODBC][MS SQL Server 2000] user 'fudge' does not exist in database 'someseriousstuff'.

    I've had to register 'ERRO' as "Some idiotic internal error" ever since.



  •  



  • @Vechni said:

    Worst use of the wtfmeter ever



  • @belgariontheking said:

    @Vechni said:

    Worst use of the wtfmeter ever

    And he got the meme wrong.  "Holy shit" my arse, everyone knows it should be "Whaaat?"



  • @DaveK said:

    @belgariontheking said:

    @Vechni said:

    Worst use of the wtfmeter ever

    And he got the meme wrong.  "Holy shit" my arse, everyone knows it should be "Whaaat?"

    [i]And[/i] he made it 1x1. WTF?



  • @DaveK said:

    @belgariontheking said:

    @Vechni said:

    Worst use of the wtfmeter ever

    And he got the meme wrong.  "Holy shit" my arse, everyone knows it should be "Whaaat?"

    Yeah, but that's the official WTF Meter, from the guy who originally made it.



  • @Kyanar said:

    @DaveK said:

    @belgariontheking said:

    @Vechni said:

    Worst use of the wtfmeter ever

    And he got the meme wrong.  "Holy shit" my arse, everyone knows it should be "Whaaat?"

    Yeah, but that's the official WTF Meter, from the guy who originally made it.

    Pardon me if my sarcasm detector is off, but it is neither of those things you described.



  • @belgariontheking said:

    @Kyanar said:

    @DaveK said:

    @belgariontheking said:

    @Vechni said:

    Worst use of the wtfmeter ever

    And he got the meme wrong.  "Holy shit" my arse, everyone knows it should be "Whaaat?"

    Yeah, but that's the official WTF Meter, from the guy who originally made it.

    Pardon me if my sarcasm detector is off, but it is neither of those things you described.

    Actually, it's both of the things I described. From this thread, dtech is the creator of it. dtech owns dtechnology.nl. The meter in this thread is from dtechnology.nl. Hence, it's the original WTF meter.



  • @Kyanar said:

    Actually, it's both of the things I described. From this thread, dtech is the creator of it. dtech owns dtechnology.nl. The meter in this thread is from dtechnology.nl. Hence, it's the original WTF meter.

    The word official would imply that it was somehow sanctioned by Alex.  Please learn how to use words.



  • @morbiuswilters said:

    @Kyanar said:

    Actually, it's both of the things I described. From this thread, dtech is the creator of it. dtech owns dtechnology.nl. The meter in this thread is from dtechnology.nl. Hence, it's the original WTF meter.

    The word official would imply that it was somehow sanctioned by Alex.  Please learn how to use words.

    And while dtech took it to the next level, the idea was originally from fredfoobar.  Vechni is not its originator, and that's who it's "from" in this case.


  • @belgariontheking said:

    @morbiuswilters said:

    @Kyanar said:

    Actually, it's both of the things I described. From this thread, dtech is the creator of it. dtech owns dtechnology.nl. The meter in this thread is from dtechnology.nl. Hence, it's the original WTF meter.

    The word official would imply that it was somehow sanctioned by Alex.  Please learn how to use words.

    And while dtech took it to the next level, the idea was originally from fredfoobar.  Vechni is not its originator, and that's who it's "from" in this case.
     

    Sure glad we settled that. Vechni, please see dtech and fredfoobar to remit your royalty payments.



  • @belgariontheking said:

    And while dtech took it to the next level, the idea was originally from fredfoobar.  Vechni is not its originator, and that's who it's "from" in this case.

    I knew I could count on you to sort things out. 


Log in to reply