肥皂身体签署到信封标题

时间:2017-03-15 15:32:36

标签: php xml soap soap-client

我对Osuuspankki Webservice有疑问。我设法获得了证书,但是当我需要从银行获取数据时,几乎没有问题。

    function getArgumentsToDownload($customerid=null,$private_key=null, $public_key=null,$status="NEW",$action=null,$start_date=null,$end_date=null) {
    $xml = $this->createDocument();

    $ApplicactionRequest = $xml->createElement("ApplicationRequest");
    $ApplicactionRequest->setAttribute("xmlns", "http://bxd.fi/xmldata/");

    $CustomerId = $xml->createElement("CustomerId",$customerid);
    $ApplicactionRequest->appendChild($CustomerId);


   $Timestamp = $xml->createElement("Timestamp",date("c"));

    $ApplicactionRequest->appendChild($Timestamp);

    $Status = $xml->createElement("Status",$status);
    $ApplicactionRequest->appendChild($Status);

    $Environment = $xml->createElement("Environment",$this->Environment);
    $ApplicactionRequest->appendChild($Environment);

    $SoftwareId = $xml->createElement("SoftwareId",$this->SoftwareId);
    $ApplicactionRequest->appendChild($SoftwareId);

    $xml->appendChild($ApplicactionRequest);
    $objDSig = new XMLSecurityDSig();

    $objDSig->setCanonicalMethod(XMLSecurityDSig::EXC_C14N_COMMENTS);
    $objDSig->addReference($xml, XMLSecurityDSig::SHA1, array('http://www.w3.org/2000/09/xmldsig#enveloped-signature'));

    $objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type'=>'private'));
    //$objKey->loadKey($private_key,true);
    $objKey->loadKey($private_key,true);

    $objDSig->sign($objKey);

    $objDSig->add509Cert(file_get_contents($public_key),false);
    $objDSig->appendSignature($xml->documentElement);

    $signed_XML = $xml->saveXML();}

`

我可以签署Env身体,但它需要再次签名到Env-header。 https://www.op.fi/media/liitteet?cid=151240134&srcpl=4(第22/44页)。

public function getFileList($username=null, $private_key=null, $public_key=null,$status='NEW',$start_date=null, $end_date=null) {


    // Alustetaan muuttujat joita käytetään SOAP Clientissä datan lataamisessa Webservicestä.
    $arguments = $this->CI->getArgumentsToDownload($username,$private_key,$public_key);

    $client = new SoapClient($this->wsdl_test, array('trace' => true, 'exceptions' => false));

    // Asetetaan salainen avain
    $client->setPrivateKey($private_key);
    // Asetetaan julkinen avain
    $client->setPublicKey($public_key);

            $soap_header = new SoapHeader($this->ws_ns, "Timestamp",array("expires"));
            $client->__setSoapHeaders($soap_header);


    $return = $client->__soapCall('downloadFileList', array($arguments));
    }

我应该怎么做才能获得签名信封?

0 个答案:

没有答案