我用php语言写了一个soap web服务,它在本地主机上正确工作,但是当我把它上传到服务器上时,我可以看到wsdl文件,并在soapUI中添加其URL,但是当我调用函数时,它显示内部服务器错误。
服务器的操作系统是centos6, php版本是php54,并且php soap已经存在。
怎么了?
<xs:element name="getServices">
<xs:complexType>
<xs:sequence>
<xs:element name="username" type="xs:string"/>
<xs:element name="password" type="xs:string"/>
<xs:element name="mobileNum" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
$client = new SoapClient("http://IpAddress/ws/ws?wsdl");
try {
$response = $client->getServices(
array(
'username' => 'username',
'password' => 'pass',
'mobileNum' => '1111111',
));
return $response;
}
catch(Exception $e)
{
return $e->getMessage();
}
试着查看服务器的错误日志文件,它会告诉你错误发生的原因的详细描述。
服务器内部错误通常发生在服务器无法执行脚本时,不是因为脚本和错误,而是因为它自己的限制,如max_execution time, max_upload_size, postrongize等。
您的wsdl缺少一些点:例如名称空间。
<?xml version="1.0" encoding="UTF-8"?>
<definitions name ="name"
targetNamespace="?"
xmlns:tns="?"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<xs:element name="getServices">
<xs:complexType>
<xs:sequence>
<xs:element name="username" type="xs:string"/>
<xs:element name="password" type="xs:string"/>
<xs:element name="mobileNum" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</port>
</service>
</definitions>