1

I have the XML below:

<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>

How to create a PHP request?

I am trying:

$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);

I am noob on SOAP and I have no idea to how create a correct code. The code that I use is not working. I have a Forced circuit exception.

Any help?

1 Answer 1

1

If you don’t want to wonder how to construct the PHP request using an OOP approach + the native PHP SoapClient class with autocompletion in PhpStorm or any decent IDE, I strongly advise you to use a WSDL to PHP generator. Try the https://github.com/WsdlToPhp/PackageGenerator. For the WsSecurity header, you can also use the https://github.com/WsdlToPhp/WsSecurity.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.