Spring: измените конверт webServiceTemplate 'env' на 'soapenv' - PullRequest
0 голосов
/ 18 декабря 2018

Я пытаюсь позвонить в организацию, и у меня нет WSDL.Я пытаюсь сделать запрос SOAP с помощью webServiceTemplate.

        <ws:RegistrarEntrada xmlns:ws="http://ws.rtaws.rtaws.jccm.es" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
        <sUsuario>user</sUsuario> 
        <sClave>pass</sClave> 
        <strXML> 
            &lt;Datos&gt;
            &lt;AcuseRecibo&gt;N&lt;/AcuseRecibo&gt;
            &lt;CodSIACI&gt;SJT3&lt;/CodSIACI&gt;
            &lt;CodUniOrgDest&gt;850&lt;/CodUniOrgDest&gt;
            &lt;Observaciones&gt;Registro.&lt;/Observaciones&gt;
            &lt;ExisteRep&gt;N&lt;/ExisteRep&gt;
            &lt;NumDocumentos&gt;0&lt;/NumDocumentos&gt;
            &lt;/Datos&gt;
        </strXML> 
    </ws:RegistrarEntrada>

Когда будет выполнен запрос SOAP, в webServiceTemplate.sendSourceAndReceiveToResult(source, result); добавляется конверт и запрос:

 <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
 <env:Header/>
 <env:Body>
    <ws:RegistrarEntrada xmlns:ws="http://ws.rtaws.rtaws.jccm.es" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
        <sUsuario>user</sUsuario> 
        <sClave>pass</sClave> 
        <strXML> 
            &lt;Datos&gt;
            &lt;AcuseRecibo&gt;N&lt;/AcuseRecibo&gt;
            &lt;CodSIACI&gt;SJT3&lt;/CodSIACI&gt;
            &lt;CodUniOrgDest&gt;850&lt;/CodUniOrgDest&gt;
            &lt;Observaciones&gt;Registro.&lt;/Observaciones&gt;
            &lt;ExisteRep&gt;N&lt;/ExisteRep&gt;
            &lt;NumDocumentos&gt;0&lt;/NumDocumentos&gt;
            &lt;/Datos&gt;
        </strXML> 
        </ws:RegistrarEntrada>
    </env:Body>
</env:Envelope>

Вот что я вижу в своем журнале при отправке запроса:

 12:30:32,233 DEBUG sent:649 - Sent request [
 <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
 <env:Header/>
 <env:Body>
    <ws:RegistrarEntrada xmlns:ws="http://ws.rtaws.rtaws.jccm.es" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
        <sUsuario>user</sUsuario> 
        <sClave>pass</sClave> 
        <strXML> 
            &lt;Datos&gt;
            &lt;AcuseRecibo&gt;N&lt;/AcuseRecibo&gt;
            &lt;CodSIACI&gt;SJT3&lt;/CodSIACI&gt;
            &lt;CodUniOrgDest&gt;850&lt;/CodUniOrgDest&gt;
            &lt;Observaciones&gt;Registro.&lt;/Observaciones&gt;
            &lt;ExisteRep&gt;N&lt;/ExisteRep&gt;
            &lt;NumDocumentos&gt;0&lt;/NumDocumentos&gt;
            &lt;/Datos&gt;
        </strXML> 
        </ws:RegistrarEntrada>
    </env:Body>
</env:Envelope>]

12:30:33,722 DEBUG received:706 - Received response [

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <ns1:RegistrarEntradaResponse xmlns:ns1="http://ws.rtaws.rtaws.jccm.es" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
            <RegistrarEntradaReturn xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:string">
        &lt;?xml version="1.0" encoding="iso-8859-1"?&gt
        ;&lt;RTA-JCCM&gt;
        &lt;resultado&gt;0
        &lt;/resultado&gt;
        &lt;fecha&gt;04/12/2018 12:30:34
        &lt;/fecha&gt;
        &lt;/RTA-JCCM&gt;</RegistrarEntradaReturn>
    </ns1:RegistrarEntradaResponse>
</soapenv:Body>
</soapenv:Envelope>

] 

ОШИБКА: 'Пространство имен для префикса' soapenv 'не было объявлено.'

Как изменить префикс 'env' на 'soapenv' в webServiceTemplate для отправки правильного запроса?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...