English 中文(简体)
PHP SoapFault not WSDL Schema compliant in soapUI?
原标题:

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/">
   <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

最佳回答

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

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签