SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    <?php while(!sleep()){code();} G.Schuster's Avatar
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SOAP fails sometimes with exception "Bad Request (Code: 0)"

    Hi there,

    I've developed an API for handling some stuff on several remote servers.
    The case that seems to cause problems (sometimes) is an "upload" thing - that means I'm calling a method on the remote server and pass in base64-encoded file contents as the parameters.
    Most of the time it works fine, only sometimes it fails when sending multiple files (well, it often works fine with multiple files, too!).
    Seems to me as if this may be an issue with the file size - which, with the last failed request, was around 500KB in total (16 files).
    Or could it be that some special characters like umlauts cause that problem?
    Both cases worked fine in other uploads, even with bigger files so there doesn't seem to be any real pattern I could look out for.

    To be a bit more clear, here's an example:
    PHP Code:
    $soap->uploadFiles($userIdentifier$uploadType, array('filename.jpg' => $base64encoded'filename2.jpg' => $base64encoded2)); 
    Any ideas on this?
    It's driving me nuts as I get email reports of failed transactions regularly and some of the users may think the system is broken (which it seems to be in the mentioned cases).

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bad Request is a http error code. You can use wireshark to trace exactly what goes on at the http level. I would suggest that you try to provoke the error while tracking with wireshark, and then see if you can make sense of what is going wrong.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •