PHP使用soap发送XML返回未知错误

PHP使用soap发送XML返回未知错误,php,xml,soap,Php,Xml,Soap,我正在尝试使用soap将用户注册发送到另一台服务器。我正在用DOMdocument创建一个xml,然后在saveXML之后运行soap,它应该返回一个带有注册id的xml以及我在xml中发送的所有数据。 但是Soap返回未知错误。正是这样:stdClass对象([RegisztracioInsResult]=>stdClass对象([any]=>5未知错误)) 这就是我发送xml的方式 /*xml creation with DOMdocument*/ $xml = saveXML(); $ur

我正在尝试使用soap将用户注册发送到另一台服务器。我正在用DOMdocument创建一个xml,然后在saveXML之后运行soap,它应该返回一个带有注册id的xml以及我在xml中发送的所有数据。 但是Soap返回未知错误。正是这样:
stdClass对象([RegisztracioInsResult]=>stdClass对象([any]=>5未知错误))

这就是我发送xml的方式

/*xml creation with DOMdocument*/
$xml = saveXML();
$url = 'http://mx.biopont.com/services/Vision.asmx?wsdl';
$trace = '1';
$client = new SoapClient($url, array('trace' => $trace, "exceptions" => 0, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
$params = $client->RegisztracioIns(array('xml' => $xml));
$print_r($params);
如果我单击此URL上RegisztracioIns服务的描述,它会显示以下内容:

POST /services/Vision.asmx HTTP/1.1
Host: mx.biopont.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://mx.biopont.com/services/RegisztracioIns"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <RegisztracioIns xmlns="http://mx.biopont.com/services/">
      <xml>string</xml>
    </RegisztracioIns>
  </soap:Body>
</soap:Envelope>
POST/services/Vision.asmx HTTP/1.1
主持人:mx.biopont.com
内容类型:text/xml;字符集=utf-8
内容长度:长度
SOAPAction:“http://mx.biopont.com/services/RegisztracioIns"
一串
根据这一点,我认为我的上传是正确的,但也许不是,我没有太多的soap经验


我有什么遗漏吗?我还尝试将xml保存到我的服务器,然后使用文件\u get\u contents()获取内容。但是结果是一样的。

你应该可以这样做:

$res = $client->__soapCall( 'RegisztracioIns', array('xml'=>'my string to send'));
将wsdl包装到适当的标记中

您正在做类似的事情,但我不认为wsdl实际上是在包装您试图传递的字符串,而不传递任何内容,从而导致未知错误

您可以使用
$client->\uu getLastRequest()检查传出xml

(另外,最后一行代码中有一个小的输入错误,应该是
print\r($params);

如果失败,您可以尝试自己使用编写xml

在我看来,当wsdl为您包装所有内容时,它看起来更干净,但这总比在它完成之前将您的头撞在墙上要好

我试图用您的wsdl来实现这一点。尝试一下:

$wsdl = "http://mx.biopont.com/services/Vision.asmx?wsdl"; 
$client = new SoapClient($wsdl, array(  'soap_version' => SOAP_1_1,
                                    'trace' => true,
                                    )); 
try {

$xml = "<RegisztracioIns xmlns='http://mx.biopont.com/services/'>
            <xml>string</xml>
        </RegisztracioIns>";

$args= array(new SoapVar($xml, XSD_ANYXML)); 

$res = $client->__soapCall( 'RegisztracioIns', $args );
var_dump($res);

} catch (SoapFault $e) {

echo "Error: {$e}";

}
print_r($client->__getLastRequest());
print_r($client->__getLastResponse());
$wsdl=”http://mx.biopont.com/services/Vision.asmx?wsdl"; 
$client=新的SoapClient($wsdl,数组('soap\u version'=>soap\u 1,,
'trace'=>true,
)); 
试一试{
$xml=”
一串
";
$args=array(新的SoapVar($xml,XSD_ANYXML));
$res=$client->\uu soapCall('RegisztracioIns',$args);
var_dump($res);
}捕获(SoapFault$e){
echo“错误:{$e}”;
}
打印($client->u getLastRequest());
打印($client->uu getLastResponse());
我无法准确地理解我得到的回应,因为它是匈牙利语(我想是吧?)。所以让我知道这是否对你有效