views:

200

answers:

1

Hi all,

I came across a strange one today, it goes like this:

I'm setting up test suites for QAing a web service of mine, which is written in PHP5 - making use of the class SoapFault among others.

I use the class to return error message to the clients. Example:

if (!$this->CheckHost(getenv('REMOTE_ADDR')))
{
    return new SoapFault(S_CLIENT, S_STRING_IP, "", S_DETAIL_IP);
}

Returning a SoapFault if the client is not authorized...

Now, if I add an Schema Compliance assertion in soapUI 3.0.1 it tells me that the returned message is not compliant to it's wsdl file.

The WSDL-file is written by me and does in deed not contain a description of the actual SoapFault class. Would that be needed? Thought not because SoapFault is spezified in Soap 1.1 anyways.

The actual response looks like this:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode>SOAP-ENV:Client</faultcode>
         <faultstring>ERR_102</faultstring>
         <faultactor/>
         <detail>IP error message</detail>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The soapUI error message is:

Element 'detail' with element-only content type cannot have text content.

Does anyone have a hint what I'm doing wrong?

tia

K

+1  A: 

Hi!

The soap 1.1 xml schema (http://schemas.xmlsoap.org/soap/envelope/) defines the detail element as

   <xs:complexType name="detail"><xs:sequence> 
      <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" /> 
    </xs:sequence> 
    <xs:anyAttribute namespace="##any" processContents="lax" /> 
  </xs:complexType> 

meaning that it can not contain just text as in your fault. Try changing the response to something like

...
   <detail><msg>IP error message</msg></detail>
...

Hope this helps!

regards,

/Ole eviware.com

olensmar
Thx for your reply, I gave it a shot and found that for some reason "<msg>".S_SOAP_FAULT_DETAIL_INVALID_TICKET."</msg>" get's escaped to html ltMSGgt ... and soapUI gets me an error stating "Unecpected CDATA". Any ideas how to pass that error detail? TIA
KB22