我的XML如下:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:proc="http://servicos.saude.gov.br/sigtap/v1/procedimentoservice" xmlns:grup="http://servicos.saude.gov.br/schema/sigtap/procedimento/nivelagregacao/v1/grupo" xmlns:sub="http://servicos.saude.gov.br/schema/sigtap/procedimento/nivelagregacao/v1/subgrupo" xmlns:com="http://servicos.saude.gov.br/schema/corporativo/v1/competencia" xmlns:pag="http://servicos.saude.gov.br/wsdl/mensageria/v1/paginacao">
<soap:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="Id-0001334008436683-000000002c4a1908-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>SIGTAP.PUBLICO</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">sigtap#2015public</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soap:Header>
<soap:Body>
<proc:requestPesquisarProcedimentos>
<grup:codigoGrupo>05</grup:codigoGrupo>
<sub:codigoSubgrupo>04</sub:codigoSubgrupo>
<com:competencia>201501</com:competencia>
<pag:Paginacao>
<pag:registroInicial>01</pag:registroInicial>
<pag:quantidadeRegistros>20</pag:quantidadeRegistros>
<pag:totalRegistros>100</pag:totalRegistros>
</pag:Paginacao>
</proc:requestPesquisarProcedimentos>
</soap:Body>
</soap:Envelope>
如何创建PHP请求?
我正在尝试:
$soapClientOptions = array(
'Username' => 'SIGTAP.PUBLICO',
'Password' => 'sigtap#2015public'
);
$client = new SoapClient("https://servicoshm.saude.gov.br/sigtap/ProcedimentoService/v1?wsdl", $soapClientOptions);
$params = array(
'codigoGrupo' => '05',
'competencia' => '201901',
'Paginacao' => array(
'registroInicial' => '01',
'quantidadeRegistros' => '20',
'totalRegistros' => '100'
)
);
$response = $client->__soapCall("pesquisarProcedimentos", array($params));
var_dump($response);
我对SOAP不熟悉,我不知道如何创建正确的代码。我使用的代码无法正常工作。我有强制电路异常。
有帮助吗?
答案 0 :(得分:1)
如果您不想知道如何使用OOP方法以及PhpStorm或任何不错的IDE中具有自动完成功能的原生PHP SoapClient类构造PHP请求,强烈建议您使用WSDL to PHP生成器。 尝试https://github.com/WsdlToPhp/PackageGenerator。 对于WsSecurity标头,您还可以使用https://github.com/WsdlToPhp/WsSecurity。