My Adventures as an Only Developer™: Fun with third party integration.


  • mod

    So my current big project as an Only Developer™ involves integrating our software with that of a third party vendor. In order to properly integrate, we have to consume some web APIs they are providing, and they have to consume some web APIs we are providing. No big deal, right? (You'd think so, until you remember where you're reading this.)

    First, I start working on hooking into one of their APIs. IT has 4 required parameters and about 10 optional parameters. To make sure everything is working correctly, I first hook in using only the required parameters. The API promptly returns an error complaining that the optional parameters are null. :headdesk:

    Next, their team lead contacts me and tells me that they can't get a successful response from one of our APIs. I ask them to send over the request they are using. The request they send looks like:

    <req:request xmlns:req="https://example.com">
      <req:name>John Doe</req:name>
      <req:gender>M</req:gender>
      <req:children>
        <child>
          <name>Sally</name>
          <gender>F</gender>
          <name>Susan</name>
          <gender>F</gender>
          <name>Stephen</name>
          <gender>M</gender>
          <name>Jonathon</name>
          <gender>M</gender>
          <name>Jane</name>
          <gender>F</gender>
        </child>
      </req:children>
    </req:request>
    

    Right off, I notice that they forgot to wrap each child in its own <child> element :headdesk: and they didn't properly apply the namespace alias all the way through the request :headdesk:.

    It's bad enough that I have to deal with being an only developer for my company, but now I have to do their work, too? After all the shit I've picked up on for them (I've mentioned more in some other postings), this other company really needs to start paying me.



  • @abarker said:

    It's bad enough that I have to deal with being an only developer for my company, but now I have to do their work, too?

    Did you ask them about your error with their crap?



  • "Strange, that John Doe has no children, but instead one "∅:child" who has five names and is double-male and triple-female..."


  • BINNED

    Only dev having to half reverse engineer an API because the docs are a lying piece of shit?

    Who are you and when did you steal my life? I didn't notice it missing...


  • mod

    @boomzilla said:

    Did you ask them about your error with their crap?

    Yeah. I got no response, but it has since mysteriously started working …



  • @abarker said:

    Yeah. I got no response, but it has since mysteriously started working …

    Probably a coincidence.


  • mod

    @tar said:

    Probably a coincidence.

    I'm sure it'll be broken again next week.



  • @abarker said:

    Right off, I notice that they forgot to wrap each child in its own <child> element

    You didn’t notice there’s plenty of superfluous data in there that your software can [url=http://thedailywtf.com/articles/genderize]easily determine for itself[/url]?


  • mod

    @Gurth said:

    You didn’t notice there’s plenty of superfluous data in there that your software can [url=http://thedailywtf.com/articles/genderize]easily determine for itself[/url]?

    While I appreciate[1] the front page flashback, the XML sample in the OP is just for illustrative purposes. It is completely anonymized and tells you nothing about what our software actually does. The real XML doesn't actually have name or gender fields. :P

    [1] not really



  • The most common way to make this mistake is to build the XML as a big string. You are only at the beginning of a continuous stream of them having problems calling this. BTW, this should work:

    <request xmlns="https://example.com">
      <name>John Doe</name>
      <gender>M</gender>
      <children>
        <child>
          <name>Sally</name>
          <gender>F</gender>
          <name>Susan</name>
          <gender>F</gender>
          <name>Stephen</name>
          <gender>M</gender>
          <name>Jonathon</name>
          <gender>M</gender>
          <name>Jane</name>
          <gender>F</gender>
        </child>
      </children>
    </request>
    

    They actually put some effort into making their invalid request.


  • mod

    @Jaime said:

    BTW, this should work:

    Well, you fixed one of the two problems. That child still has five names and is still double male and triple female. Now go back and do it right.


  • BINNED

    @abarker said:

    That child still has five names and is still double male and triple female. Now go back and do it right.

    It's the equality bundle! I suspect that the real names are actually multicultural (but anonimised) and, if it were recorded, the race section would look like a bag of Skittles.


  • mod

    @abarker said:

    @Jaime said:
    BTW, this should work:

    Well, you fixed one of the two problems. That child still has five names and is still double male and triple female. Now go back and do it right.

    Also, you get no credit for pointing out how to do it right when I explicitly said what was wrong with the request in the OP.

    @abarker said:

    Right off, I notice that they forgot to wrap each child in its own <child> element and they didn't properly apply the namespace alias all the way through the request.



  • @abarker said:

    Also, you get no credit for pointing out how to do it right when I explicitly said what was wrong with the request in the OP.

    What I expected credit for was showing that doing it right was much easier than the wrong way they were on the road to doing. Adding prefixes to the rest of the tags would have just been completing the trip down the wrong road.


  • Grade A Premium Asshole

    @abarker said:

    double male and triple female

    PornHub is...erm? I mean..."generic p0rn site" is...over there somewhere. I wouldn't know. I never visit such places...


  • mod

    @Polygeekery said:

    PornHub is...erm? I mean..."generic p0rn site" is...over there somewhere. I wouldn't know. I never visit such places...

    Talking about children and that's where you go? Better watch out for those not-FBI people in the chat rooms.


  • Grade A Premium Asshole

    @abarker said:

    Talking about children and that's where you go?

    That's why I only quoted the part that made the joke not creepy. ;-)

    Don't mind me. I had to pull an all nighter last night and I am loopy.


  • Grade A Premium Asshole

    @abarker said:

    Better watch out for those not-FBI people in the chat rooms.



  • @abarker said:

    Right off, I notice that they forgot to wrap each child in its own <child> element

    WARNING - CAUTION - ALERT This could be by design. See: Apple's "plists." ALERT CAWSHUN


  • mod

    Well considering they were trying to call a service that I wrote, I guarantee it was not by design. Unless you mean that they were Doing It Wrong by design.



  • Oops. Reading comprehension fail.

    I guess I've just been foaming at the mouth since having to deal with plists.


  • Discourse touched me in a no-no place

    @Jaime said:

    BTW, this should work:

    Not if someone on the other side has decided that the best way to parse XML is with regexps…


  • BINNED

    @dkf said:

    Not if someone on the other side has decided that the best way to parse XML is with regexps…

    Is it a Discourse API we don't know about?



  • @abarker said:

    double male and triple female

    Is it a baby Drosophilia melanogaster that wound up with polysomy of the sex chromosomes?



  • @tarunik said:

    Drosophilia melanogaster



  • @tar said:

    fruit fly

    A fly that's made of fruit? How patently absurd!



  • @tar said:

    A fly that's made of fruit? How patently absurd

    If you think that's bad, you'll be really disappointed to find out what's in baby powder.



  • @TwelveBaud said:

    "Strange, that John Doe has no children, but instead one "∅:child" who has five names and is double-male and triple-female..."

    Do they have an actual developer working on the issue, or a team of monkeys attempting to write the next Game of Thrones?



  • @Keith said:

    If you think that's bad, you'll be really disappointed to find out what's in baby powder.

    Reading this somehow makes we want to be pussy-whipped. (Or does it?)


  • mod

    ##UPDATE:

    Now they are complaining that the following request doesn't work:

    <xmlns="https://example.com">
      <name>John Doe</name>
      <gender>M</gender>
      <ChildrenGroupType>
        <child>
          <name>Sally</name>
          <gender>F</gender>
        </child>
        <child>
          <name>Susan</name>
          <gender>F</gender>
        </child>
        <child>
          <name>Stephen</name>
          <gender>M</gender>
        </child>
        <child>
          <name>Jonathon</name>
          <gender>M</gender>
        </child>
        <child>
          <name>Jane</name>
          <gender>F</gender>
        </child>
      </ChildrenGroupType>
    </request>
    

    If you couldn't tell by the name, ChildrenGroupType is defined in the request schema as a type. They should be using the element id of children. I'm starting to wonder if I should request compensation from this third party company since I'm doing their work for them.



  • One of the children is also still a double male with two names...


  • mod

    @PleegWat said:

    One of the children is also still a double male with two names...

    Missed that when I was modifying the earlier sample to demonstrate the new issue. Corrected now.



  • Why don't you just give them the XSD? Am I missing something obvious?

    At least then, there's a million tools (Visual Studio, for one) that'll tell them what's wrong automatically.


  • sockdevs

    If they can't be bothered to follow @abarker's instructions, how do you think they're going to know to use the tools in VS? ;)



  • I'm guessing he hasn't given them the XSD because he doesn't have one. Because HE IS THE REAL WTF!


  • mod

    @blakeyrat said:

    Why don't you just give them the XSD? Am I missing something obvious?

    At least then, there's a million tools (Visual Studio, for one) that'll tell them what's wrong automatically.

    They have the XSD as part of the WSDL. That's what makes this so frustrating.

    Just checked, and apparently I forgot to mention that in the OP. Oops.



  • You know they can, and I know they can, but do THEY know they can check the file against the WSDL?


  • mod

    @blakeyrat said:

    You know they can, and I know they can, but do THEY know they can check the file against the WSDL?

    I doubt it. Based on previous experience with them, I doubt that they even know that XML schema validation is a thing.



  • So wouldn't your time be better-spent teaching them how to fish?



  • @blakeyrat said:

    Why don't you just give them the XSD?

    I've been through this.

    I gave the people I was working with the XSD and they asked "Can we have some examples?". I resisted stating that I was concerned they would work from the examples rather than the schema. Eventually, their boss was brought in to say "Come on, just give them some examples", so I gave the requested examples. Then, they simply ignored the XSD and built a text-based processor based on the examples.

    The first time a ">" came through the data stream, the process blew up.



  • @abarker said:

    They should be using the element id of children. I'm starting to wonder if I should request compensation from this third party company since I'm doing their work for them.

    Tell them to buy a copy of Altova XML Spy and that they are prohibited from asking question until they figure out how to validate a document against a schema with it.

    Then ask them what XML library they are using. Tell them that there are some buggy ones out there and you have a list of libraries that your process supports. If they ask for the list, put together a list of every library you can find on the Internet.


  • mod

    @Jaime said:

    Tell them to buy a copy of Altova XML Spy and that they are prohibited from asking question until they figure out how to validate a document against a schema with it.

    Then ask them what XML library they are using. Tell them that there are some buggy ones out there and you have a list of libraries that your process supports. If they ask for the list, put together a list of every library you can find on the Internet.

    Considering how buddy-buddy my boss is with the owners of their company, I'm not sure if I could get away with that. It might be worth a shot, though.


  • mod

    Just found out: they're building the XML using Java.


  • BINNED

    @abarker said:

    Just found out: they're building the XML using Java.

    Given what you've demonstrated so far, they are probably using StringBuilders.

    Because, you know, it makes sense. It's in the name!



  • I don't know shit about Java, but I bet that (like C#) you can just create a class matching the XSD and serialize that sucker.


  • mod

    @blakeyrat said:

    I don't know shit about Java, but I bet that (like C#) you can just create a class matching the XSD and serialize that sucker.

    That's what they say they are doing, and yet …



  • I actually have a little script that lets you go the other direction, too. Feed in an XSD, and it'll write the class(es) for you based on that. We used it depressingly often.


  • mod

    @blakeyrat said:

    I actually have a little script that lets you go the other direction, too. Feed in an XSD, and it'll write the class(es) for you based on that. We used it depressingly often.

    VS includes a CLI tool that will do that.



  • @blakeyrat said:

    I actually have a little script that lets you go the other direction, too. Feed in an XSD, and it'll write the class(es) for you based on that. We used it depressingly often.

    There's only been a sane way to handle XSDs in Java for the last 10 years.



  • You can have a tool create all the code from a WSDL:

    TL;DR: $ wsgen -keep -cp . com.mkyong.ws.ServerInfo -wsdl

    Fuck, that's the only good thing about SOAP.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.