0

I'm trying to pass my request, but im getting all kind of error. Seems like is my method of auth is not working. It works fine when I use SoapUI. I'm trying to implement this via PHP.

SoapUI add that xml to the header. How I am supposed to add it with PHP. It looks like does info are dinamic not static.

<?php

/*
<wsse:Security xmlns:wsse=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd xmlns:wsu=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd>
<ds:Signature Id=SIG-DAB3AC9FCFC1D2CFFE147510914159070 xmlns:ds=http://www.w3.org/2000/09/xmldsig#>
    <ds:SignedInfo>
        <ds:CanonicalizationMethod Algorithm=http://www.w3.org/TR/2001/REC-xml-c14n-20010315/>
        <ds:SignatureMethod Algorithm=http://www.w3.org/2000/09/xmldsig#rsa-sha1/>
        <ds:Reference URI=#id-DAB3AC9FCFC1D2CFFE147510914159069>
            <ds:Transforms>
                <ds:Transform Algorithm=http://www.w3.org/2001/10/xml-exc-c14n#>
                <InclusiveNamespaces PrefixList=v2 whol xmlns=http://www.w3.org/2001/10/xml-exc-c14n#/>
                </ds:Transform>
            </ds:Transforms>
            <ds:DigestMethod Algorithm=http://www.w3.org/2000/09/xmldsig#sha1/>
            <ds:DigestValue>Kfw1HATmg4wLayS1zEeSKzLgaLE=</ds:DigestValue>
        </ds:Reference>
    </ds:SignedInfo>
    <ds:SignatureValue>VA6ETCI+RzMGWsITElyP4DuXgl27hxmlp827ShCVz/1CuOA0Es9oDWpXIOB8KMO+cmG4/UMf/wTg
    XMly9QW0U79Czgyue7EtjAPdpfDLMesqY116IUkx4Aq+G8cT8T2/Mxw8e6Up71DtoR6F6oa7uPNP
    mJkTwXRphcZi7AlVS70=</ds:SignatureValue>
    <ds:KeyInfo Id=KI-DAB3AC9FCFC1D2CFFE147510914158967>
        <wsse:SecurityTokenReference wsu:Id=STR-DAB3AC9FCFC1D2CFFE147510914159068>
            <ds:X509Data>
                <ds:X509IssuerSerial>
                    <ds:X509IssuerName>O=Sprint,C=US</ds:X509IssuerName>
                    <ds:X509SerialNumber>1192967129</ds:X509SerialNumber>
                </ds:X509IssuerSerial>
            </ds:X509Data>
        </wsse:SecurityTokenReference>
    </ds:KeyInfo>
</ds:Signature>
</wsse:Security>
*/

$timestamp = date("c");

$local_cert = realpath(dirname(__FILE__))."/ecomobile-01.jks";
$options = array(
    'local_cert' => $local_cert,
    'passphrase' => 'Gogr33n!', 
    'keep_alive' => true,
    "trace" => 1
);

$headerbody = array('trackingMessageHeader' => array('applicationId' => '2014091601', 'applicationUserId' => 'Ecomobile', 'messageId' => rand(100000, 500000), 'timeToLive' => 60, 'messageDateTimeStamp' => $timestamp));       
$ns = 'http://integration.sprint.com/common/header/WSMessageHeader/v2';
$header = new SOAPHeader($ns, 'wsMessageHeader', $headerbody);

$deviceInfo = array('deviceDetailInfo' => array('esnMeidDec' => '09104990674'));

$soapclient = new SoapClient('https://webservicesgatewaytest.sprint.com:444/rtb1/services/mvno/WholesaleQueryDeviceInfoService/v1?wsdl', $options);
$soapclient->__setSoapHeaders($header);

$params = array('deviceInfo' => $deviceInfo, 'resellerPartnerId' => '210246456764464');

try{
    $response = $soapclient->wholesaleValidateDeviceV3($params);
    var_dump($response);
} catch (SoapFault $e) {
    echo "====== REQUEST HEADERS =====<br>";
    var_dump($soapclient->__getLastRequestHeaders());
    echo "<br>========= REQUEST ==========<br>";
    var_dump($soapclient->__getLastRequest());
    echo "<br>========= RESPONSE HEADER =========<br>" ;
    var_dump($soapclient->__getLastResponseHeaders());
    echo "<br>========= RESPONSE =========<br>" ;
    echo $e->getMessage();
}

?>

Error I'm getting:

====== REQUEST HEADERS =====
NULL
========= REQUEST ==========
string(984) " xxxxxxxxx "
========= RESPONSE HEADER =========
NULL
========= RESPONSE =========
Could not connect to host
Erba Aitbayev
  • 4,167
  • 12
  • 46
  • 81
oovooman1
  • 1
  • 1
  • Please add the error message you are receiving – Vini.g.fer Sep 29 '16 at 22:23
  • ====== REQUEST HEADERS ===== NULL ========= REQUEST ========== string(984) " xxxxxxxxx " ========= RESPONSE HEADER ========= NULL ========= RESPONSE ========= Could not connect to host – oovooman1 Sep 29 '16 at 22:31

0 Answers0