0

I'm communicating with a SOAP service created with EJB -- it intermittently fails, and I've found a case where I can reliably reproduce.

I'm getting a funky ass SOAP fault that says "looks like we got not XML," however, when retrieving the last response I get what is listed below (and what looks like valid XML to me).

Any thoughts?

Soap Fault:

object(SoapFault)#2 (9) { 
    ["message:protected"]=>  string(33) "looks like we got no XML document" 
    ["string:private"]=>  string(0) "" 
    ["code:protected"]=>  int(0) 
    ["file:protected"]=>  string(40) "/Users/josh/Sites/blahblahblah/test-update.php" 
    ["line:protected"]=>  int(26) 
    ["trace:private"]=>  array(2) { 
        [0]=>  array(4) { 
            ["function"]=>  string(6) "__call" 
            ["class"]=>  string(10) "SoapClient" 
            ["type"]=>  string(2) "->" 
            ["args"]=>  array(2) { 
                [0]=>  string(24) "UpdateApplicationProfile" 
                [1]=>  array(1) { 
                    [0]=>  array(2) { 
                        ["suid"]=>  string(36) "62eb56ee-45de-4971-9234-54d72bbcd0e4" 
                        ["appid"]=>  string(36) "6be2f269-4ddc-48af-9d47-30b7cf3d0499" 
                    } 
                } 
            } 
        } 
        [1]=>  array(6) { 
            ["file"]=>  string(40) "/Users/josh/Sites/blahblahblah/test-update.php" 
            ["line"]=>  int(26) 
            ["function"]=>  string(24) "UpdateApplicationProfile" 
            ["class"]=>  string(10) "SoapClient" 
            ["type"]=>  string(2) "->" 
            ["args"]=>  array(1) { 
                [0]=>  array(2) { 
                    ["suid"]=>  string(36) "62eb56ee-45de-4971-9234-54d72bbcd0e4" 
                    ["appid"]=>  string(36) "6be2f269-4ddc-48af-9d47-30b7cf3d0499" 
                } 
            } 
        } 
    } 
    ["faultstring"]=>  string(33) "looks like we got no XML document" 
    ["faultcode"]=>  string(6) "Client" 
    ["faultcodens"]=>  string(41) "http://schemas.xmlsoap.org/soap/envelope/" 
}

And the actual raw XML response using client->__getLastResponse():

<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
    <env:Header> 
    </env:Header>
    <env:Body>
        <ns2:UpdateApplicationProfileResponse xmlns:ns2="blahblahblah">
            <paramname>status</paramname>
            <paramname>location</paramname>
            <paramname>timezone</paramname>
            <paramname>homepage</paramname>
            <paramname>nickname</paramname>
            <paramname>firstName</paramname>
            <paramname>languages</paramname>
            <paramname>color</paramname>
            <paramname>lastName</paramname>
            <paramname>gender</paramname>
            <paramvalue></paramvalue>
            <paramvalue></paramvalue>
            <paramvalue></paramvalue>
            <paramvalue></paramvalue>
            <paramvalue>XXX XXX</paramvalue>
            <paramvalue>XXX</paramvalue>
            <paramvalue></paramvalue>
            <paramvalue>CA0008</paramvalue>
            <paramvalue>XXX</paramvalue>
            <paramvalue></paramvalue>
        </ns2:UpdateApplicationProfileResponse>
    </env:Body>
</env:Envelope>
2
  • 1
    Can you try using wireshark to see exactly what's going over the line? Commented Jul 28, 2009 at 20:17
  • unfortunately, its all being tunneled through a VPN in my testing ennvironment, so all I'm getting is ipsec packets... I took a look when it was not getting passed through vpn though, at the very beginning of this problem, and it looks totally valid (no stray whitespace) Commented Jul 29, 2009 at 21:59

3 Answers 3

2

Yeah, so the problem has SOMETHING to do with a piece of bad character data or something being passed in one of the paramvalue children. It DOESN'T appear to be visible, or its stripped, even using the trace and __getLastRequest().

I unfortunately don't have direct access to the server code. Its outputted directly from a WS created using EJB -- the developer has no access to the XML itself, so there is no stray whitespace. Doesn't appear to be any whitespace at all -- certainly is no whitespace using __getLastRequest(), though that was a great place to look for the cause of the error, according to comments on the php page for SoapClient.

I solved the problem by basically ignoring the bad call, and "resetting" each of the paramnames and paramvalues, such that I wipe out the bad data...

Anyway, bummer that I didn't explicitly figure out what was causing it, but disaster averted for the moment.

Edit: Solved this since A control character was slipping in to xml returned by the EJB framework. It was supposed to be null, so it used a control character to represent it, and php SOAP barfed because its not "valid" xml. I resolved the problem by writing a manual parse of the response using __getLastRequest() in the case of an exception.

Sign up to request clarification or add additional context in comments.

Comments

1

Hard to tell here; Couple of things you might check:

  • make sure there is no (absolutely none) white space either at the beginning or the end of the XML/SOAP data
  • maybe there could be some error that is echoed to the standard output (i.e., before/after the SOAP data?)

What kind of output do you get if you try to call the Webservice's URL from your browser?

(It would do much, as you won't be using SOAP but it should say something like "Bad request")

Do you get any kind of trace on the server side, that could indicate there's been an error/a problem/whatever might be useful?

If there is still no way to find anything, last time I worked with web services and got errors I could not find why, I ended up using ethereal (now called Wireshark) to "sniff" what was going on on the network. Sometimes helps, but I hate doing that.

Comments

0

I think there is an issue with PHP 5.2.6 and below that causes PHP to choke when parsing a SOAP return envelope Bug #44882 SOAP extension object decoding bug. I have some code that works flawlessly on 5.2.10 and 5.3.5 that fails silently on 5.2.6. Instead of raising an exception or return false, SoapClient->methodName(params) just sliently returns a blank object. Update to the latest 5.2 or 5.3 release if you are seeing similar issues.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.