NuSoap PHP: Unexpected character \'>\' (code 62) in content after \'<\' (malformed start element?)

260 Views Asked by At

I'm trying to consume a webservice of "Ventanilla unica" and I also copied the sample request and shows the same error.

Sample request code of Ventanillaunica:

$wsdlRequest = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"xmlns:con=\"http://www.ventanillaunica.gob.mx/pedimentos/ws/oxml/consultarpedimentocompleto\"xmlns:com=\"http://www.ventanillaunica.gob.mx/pedimentos/ws/oxml/comunes\"><soapenv:Header><wsse:Security soapenv:mustUnderstand=\"1\" xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis200401-wss-wssecurity-secext-1.0.xsd\"><wsse:UsernameToken><wsse:Username>AIN921110FJ5</wsse:Username><wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-tokenprofile1.0#PasswordText\">vHYoEbLjRjvqqKnNFXqvYWB0De2/NL9oNlzZaiUcqDw0hAgAPuDlXVmA6T5eahj1</wsse:Password></wsse:UsernameToken></wsse:Security></soapenv:Header><soapenv:Body><con:consultarPedimentoCompletoPeticion><con:peticion><com:aduana>070</com:aduana><com:patente>3600</com:patente><com:pedimento>2050961</com:pedimento></con:peticion></con:consultarPedimentoCompletoPeticion></soapenv:Body></soapenv:Envelope>";

This is my code:

$url = "https://www.ventanillaunica.gob.mx/ventanilla-ws-pedimentos/ConsultarPartidaService?wsdl";
$wsdlRequest = "
    <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:con=\"http://www.ventanillaunica.gob.mx/pedimentos/ws/oxml/consultarpartida\" xmlns:com=\"http://www.ventanillaunica.gob.mx/pedimentos/ws/oxml/comunes\">
        <soapenv:Header>
            <wsse:Security soapenv:mustUnderstand=\"0\" xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis200401-wss-wssecurity-secext-1.0.xsd\">
                <wsse:UsernameToken>
                    <wsse:Username>{$this->user}</wsse:Username>
                    <wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-tokenprofile1.0#PasswordText\">{$this->pass}</wsse:Password>
                </wsse:UsernameToken>
            </wsse:Security>
        </soapenv:Header>
        <soapenv:Body>
            <con:consultarPartidaPeticion>
                <con:peticion>
                    <com:aduana>{$data->aduana}</com:aduana>
                    <com:patente>{$data->patente}</com:patente>
                    <com:pedimento>{$data->pedimento}</com:pedimento>
                    <con:numeroOperacion>{$data->numeroOperacion}</con:numeroOperacion>
                    <con:numeroPartida>{$data->numeroPartida}</con:numeroPartida>
                </con:peticion>
            </con:consultarPartidaPeticion>
        </soapenv:Body>
    </soapenv:Envelope>
";

This is the error log:

S:Client: Couldn't create SOAP message due to exception: XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '>' (code 62) in content after '<' (malformed start element?) at [row,col {unknown-source}]: [21,37]

And this is the response:

HTTP/1.1 500 Internal Server Error
Date: Thu, 30 Dec 2021 19:25:16 GMT
Server: Apache/2.2.15 (Oracle)
X-Powered-By: Servlet/2.5 JSP/2.1
Connection: close
Transfer-Encoding: chunked
Content-Type: text/xml;charset=utf-8
<?xml version=\'1.0\' encoding=\'UTF-8\'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
            <faultcode>S:Client</faultcode>
            <faultstring>Couldn\'t create SOAP message due to exception: XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character \'>\' (code 62) in content after \'&lt;\' (malformed start element?).
            at [row,col {unknown-source}]: [21,37]
            </faultstring>
        </S:Fault>
    </S:Body>
 </S:Envelope>
0

There are 0 best solutions below