尝试创建新的SoapClient时出现以下错误。
致命错误:未捕获的SoapFault异常:[HTTP]错误获取http C:\ Program Files中的标头 (x86)\ EasyPHP-5.3.9 \ www \ protocolo \ index2.php:61堆栈跟踪:#0 [内部函数]:SoapClient-> __ doRequest(' http://localhos...','',1,0)#1 C:\ Program Files (86)\的EasyPHP-5.3.9 \ WWW \ protocolo \ index2.php(61): SoapClient-> __ call(' solicitarProtoc ...',Array)#2 C:\ Program Files (86)\的EasyPHP-5.3.9 \ WWW \ protocolo \ index2.php(61): SoapClient-> solicitarProtocoloOperation(Array)#3 {main}引入 C:\ Program Files(x86)\ EasyPHP-5.3.9 \ www \ protocolo \ index2.php在线 61
这是我正在使用的wsdl文件:
<definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://schemas.xmlsoap.org/soap/encoding/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://gp.unimed.coop.br/solicitarProtocolo/webservices/V1_00_00" xmlns:gp="http://gp.unimed.coop.br/schemas/V1_00_00" name="solicitarProtocolo" targetNamespace="http://gp.unimed.coop.br/solicitarProtocolo/webservices/V1_00_00">
<wsdl:types>
<xsi:schema xmlns:tns="http://gp.unimed.coop.br/solicitarProtocolo/webservices/V1_00_00" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:gp="http://gp.unimed.coop.br/schemas/V1_00_00" targetNamespace="http://gp.unimed.coop.br/solicitarProtocolo/webservices/V1_00_00">
<xsi:import namespace="http://gp.unimed.coop.br/schemas/V1_00_00" schemaLocation="gp_Transacoes-V1_00_00.xsd" />
</xsi:schema>
</wsdl:types>
<message name="solicitarProtocoloRequest">
<part name="solicitarProtocoloRequest" element="gp:solicitarProtocoloWS" />
</message>
<message name="solicitarProtocoloResponse">
<part name="solicitarProtocoloResponse" element="gp:respostasolicitarProtocoloWS" />
</message>
<message name="ErroInesperadoFault">
<part name="ErroInesperadoFault" element="gp:erroInesperadoWS" />
</message>
<portType name="solicitarProtocoloPortType">
<operation name="solicitarProtocoloOperation">
<input message="tns:solicitarProtocoloRequest" />
<output message="tns:solicitarProtocoloResponse" />
<fault name="ErroInesperadoFault" message="tns:ErroInesperadoFault" />
</operation>
</portType>
<binding name="solicitarProtocoloBinding" type="tns:solicitarProtocoloPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="solicitarProtocoloOperation">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
<fault name="ErroInesperadoFault">
<soap:fault name="ErroInesperadoFault" use="literal" />
</fault>
</operation>
</binding>
<service name="solicitarProtocolo">
<port name="solicitarProtocoloPort" binding="tns:solicitarProtocoloBinding">
<soap:address location='http://localhost/protocolo/index2.php' />
</port>
</service>
这是我的php文件:
<?php
set_time_limit(0);
$conf=array(
'trace' =>true,
);
$client = new SoapClient('solicitarProtocolo_V1_00_00.wsdl',$conf);
$client->__setLocation('http://localhost/protocolo/index2.php');
$result = $client->solicitarProtocoloOperation(
array(
'cabecalhoTransacao' => array(
'codigoTransacao' => '001',
'tipoCliente' => 'UNIMED',
'codigoUnimedOrigemMensagem' => '1234',
'codigoUnimedDestinoMensagem' => '1234',
'numeroRegistroANS' => '348406'
),
'solicitarProtocolo' => array(
'numeroTransacaoPrestadora' => '0000000001',
'dataGeracao' => date("Y-m-d"),
'idUsuario' => 'User',
'identificacaoBeneficiario' => array(
'codigoUnimed' => '1234',
'codigoIdentificacao' => '123123123123'
),
'dadosBeneficiario' => array(
'nomeBenef' => 'Beneficiario Teste',
'cdCPF' => '12312312312',
'ddd' => '84',
'telefone' => '988888888',
'email' => 'email@email.com'
),
'identificacaoManifestacao' => array(
'tipoManifestacao' => '1',
'tipoCategoria' => '1',
'tipoSentimento' => '1'
),
'idresposta' => '',
'numeroTransacaoIntercambio' => '',
'numeroProtocoloAnterior' => '',
'mensagemLivre' => $texto,
'numeroVersaoProtocolo' => '001'
),
'hash' => 'arquivo.xml'
));
echo 'Response: ';
print_r($result);
?>
答案 0 :(得分:0)
在SoapClient的构造函数中,您应该提供URL而不是磁盘上的文件。