Consume WebService using RobRichards resources

54 views Asked by At

I have to consume an ASP.net webservice. I have the definition of it in url: https://wsproves.orgt.diba.cat/AutoliquidacioGenerica/AutoliquidacioGenericaService.svc/mex?singleWsdl

I need to call method called ConsultaAutoliquidacio. A digitalsignature must be added using digital certificate.

The request must have following structure:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <s:Header>
    <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <u:Timestamp u:Id="_0">
        <u:Created>2020-06-18T11:33:06.167Z</u:Created>
        <u:Expires>2020-06-18T11:38:06.167Z</u:Expires>
      </u:Timestamp>
      <o:BinarySecurityToken>
        <!-- Removed-->
      </o:BinarySecurityToken>
      <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
        <SignedInfo>
          <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></CanonicalizationMethod>
          <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod>
          <Reference URI="#_0">
            <Transforms>
              <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></Transform>
            </Transforms>
            <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod>
            <DigestValue>oYgJxgs/SZJiKgdy8/</DigestValue>
          </Reference>
        </SignedInfo>
        <SignatureValue>guSrn66YDWLxXzUpWSgjzA6Eqp46+ecg7o6a5FEEJQrR64PtgljAhjktGZRiDWiLJ3gR/iPNux4LqbQ14MR+3P/Oa0NneYlyqazGUx4hP5WgA+7P9eVdZbgaBvT/9yay2bjr7clS/NAfa3QCICThCpnwiXf+HYOA4xJwNvvOCQS5jSzNmuBIivmLWQcTl3kX1SHSomQwQ/gGgJSzSKJq9u1L2R7R3Hbn1cHS32BGalgRfmkND+dY7wo/MUsKQmDgZRFo1R3rnHJVgDyHuuI6CPTAye4vLwAKmo7vkA7JQx5/AW//gD8XspC+fNj</SignatureValue>
        <KeyInfo>
          <o:SecurityTokenReference>
            <o:Reference ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" URI="#uuid-64875e3e-aacf-4cba-a5ef-aa508cde34f7-1"></o:Reference>
          </o:SecurityTokenReference>
        </KeyInfo>
      </Signature>
    </o:Security>
    <To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">https://wsproves16/AutoliquidacioGenerica/AutoliquidacioGenericaService.svc</To>
    <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://orgt.diba.cat/XML/Recaptacio/AutoliquidacioGenerica/IAutoliquidacioGenericaService/ConsultaAutoliquidacio</Action>
  </s:Header>
  <s:Body>
    <ConsultaAutoliquidacio xmlns="http://orgt.diba.cat/XML/Recaptacio/AutoliquidacioGenerica">
      <autoliquidacio xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        <AdrecaFiscalDestinatari></AdrecaFiscalDestinatari>
        <AdrecaObjecteTributari></AdrecaObjecteTributari>
        <AnyContret>2020</AnyContret>
        <Caixeti>
          <Linia></Linia>
        </Caixeti>
        <CodiINE10>0818030008</CodiINE10>
        <CodiPostalDestinatari>00000</CodiPostalDestinatari>
        <ConcepteTributari>16</ConcepteTributari>
        <Contret></Contret>
        <DNINIFContribuent>11111111H</DNINIFContribuent>
        <DataLiquidacio>2020-06-18T13:33:06.1561197+02:00</DataLiquidacio>
        <DataVencimentAutoliquidacio>2020-06-18T13:33:06.1571168+02:00</DataVencimentAutoliquidacio>
        <DestinatariFiscal></DestinatariFiscal>
        <DocumentAbonare i:nil="true"></DocumentAbonare>
        <Exercici>2020</Exercici>
        <ImportDeute>0</ImportDeute>
        <MunicipiFiscal></MunicipiFiscal>
        <NomContribuent></NomContribuent>
        <NumeroReferenciaAutoliquidacio>13</NumeroReferenciaAutoliquidacio>
        <ReferenciaAjuntament></ReferenciaAjuntament>
        <ReferenciaTributaria></ReferenciaTributaria>
        <Subconceptes></Subconceptes>
      </autoliquidacio>
    </ConsultaAutoliquidacio>
  </s:Body>
</s:Envelope>

Anyone knows which php code I need in order to consume this webservice? I have build an enviroment with RobRichards resources in a local site under xampp:

require_once 'vendor/autoload.php';

use RobRichards\XMLSecLibs\XMLSecurityDSig;
use RobRichards\XMLSecLibs\XMLSecurityKey;
use RobRichards\WsePhp\WSSESoap;
use RobRichards\WsePhp\WSASoap;*

Thank you very much Francesc

0

There are 0 answers