它必须看起来像:
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
xmlns:ns1="http://tempuri.org/" xmlns:ns2="http://www.w3.org/2005/08/addressing"
xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:rgs="Rgs.Ufo" xmlns:xsi="xsi">
现在是
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="Rgs.Ufo" xmlns:ns2="http://www.w3.org/2005/08/addressing">
我需要添加xmlns:rgs =“ Rgs.Ufo”和xmlns:xsi =“ xsi”
我尝试类似
$params[] = new \SoapVar('',XSD_ANYXML, '123', null, 'Envelope', 'http://www.w3.org/2001/XMLSchema');
$params[] = new \SoapVar('',XSD_ANYXML, '', null, 'Envelope', 'http://www.w3.org/2001/XMLSchema-instance');
.....
$data = $client->SomeFucntion(new \SoapVar($params, XSD_ANYXML));
没有帮助
完整
$client = new \SoapClient('https://someurl',array("soap_version" => SOAP_1_2,"trace" => 1,'use' => SOAP_LITERAL, ));
$header = $this->getWsseSoapHeaders(); // some headers with login/pass
$client->__setSoapHeaders($header);
.....
$string = 'some xml body';
.....
$params[]= new \SoapVar($string, XSD_ANYXML);
$params[] = new \SoapVar('',XSD_ANYXML, '123', null, 'Envelope', 'http://www.w3.org/2001/XMLSchema');
$params[] = new \SoapVar('',XSD_ANYXML, '', null, 'Envelope', 'http://www.w3.org/2001/XMLSchema-instance');
try {
$data = $client->SomeFucntion(new \SoapVar($params, XSD_ANYXML));
} catch (\SoapFault $exception) {
}