Cdiscount / API-MarketPlace-SDK-PHP

15 stars 42 forks source link

InternalServiceFault in getOrderClaimList #27

Closed Crease29 closed 3 years ago

Crease29 commented 6 years ago

Hello, I have a problem receiving the orderClaimList:

PHP:

<?php

/** @var CDSApiClient $apiClient */
$apiClient = $this->getApplication()->getService(
    'CDiscount.service.api_client'
);

$token = $apiClient->init();
if ($token == null || !$apiClient->isTokenValid()) {
    $output->writeln('Could not get API token from CDiscount.');
    exit;
}

$discussionPoint = $apiClient->getDiscussionPoint();
$claimFilter = new ClaimFilter();
$claimFilter->addStatus(DiscussionStatusEnum::Open);
$claimList = $discussionPoint->getOrderClaimList(
    $claimFilter
);

$claimList->getOrderClaimList();

XML-Response:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cdis="http://www.cdiscount.com"
            xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <s:Body>
        <GetOrderClaimList xmlns="http://www.cdiscount.com">
            <headerMessage
                    xmlns:a="http://schemas.datacontract.org/2004/07/Cdiscount.Framework.Core.Communication.Messages"
                    xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                <a:Context>
                    <a:CatalogID>1</a:CatalogID>
                    <a:CustomerPoolID>1</a:CustomerPoolID>
                    <a:SiteID>100</a:SiteID>
                </a:Context>
                <a:Localization>
                    <a:Country>Fr</a:Country>
                    <a:Currency>Eur</a:Currency>
                    <a:DecimalPosition>2</a:DecimalPosition>
                    <a:Language>Fr</a:Language>
                </a:Localization>
                <a:Security>
                    <a:DomainRightsList i:nil="true"/>
                    <a:IssuerID i:nil="true"/>
                    <a:SessionID i:nil="true"/>
                    <a:SubjectLocality i:nil="true"/>
                    <a:TokenId>XXX</a:TokenId>
                    <a:UserName i:nil="true"/>
                </a:Security>
                <a:Version>1.0</a:Version>
            </headerMessage>
            <cdis:orderClaimFilter>
                <cdis:BeginCreationDate i:nil="true"/>
                <cdis:BeginModificationDate i:nil="true"/>
                <cdis:EndCreationDate i:nil="true"/>
                <cdis:EndModificationDate i:nil="true"/>
                <cdis:StatusList>
                    <cdis:DiscussionStateFilter>Open</cdis:DiscussionStateFilter>
                </cdis:StatusList>
                <cdis:OrderNumberList i:nil="true"/>
                <cdis:OnlyWithMessageFromCdsCustomerService>false</cdis:OnlyWithMessageFromCdsCustomerService>
            </cdis:orderClaimFilter>
        </GetOrderClaimList>
    </s:Body>
</s:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <s:Fault>
            <faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">
                a:InternalServiceFault
            </faultcode>
            <faultstring xml:lang="fr-FR">The server was unable to process the request due to an internal error. For
                more information about the error, either turn on IncludeExceptionDetailInFaults (either from
                ServiceBehaviorAttribute or from the &lt;serviceDebug&gt; configuration behavior) on the server in order
                to send the exception information back to the client, or turn on tracing as per the Microsoft .NET
                Framework SDK documentation and inspect the server trace logs.
            </faultstring>
        </s:Fault>
    </s:Body>
</s:Envelope>

Did I miss something here?

Crease29 commented 6 years ago

Any news on this? Is this repository maintained?

gregz1 commented 6 years ago

I can see in the xml provided that there is an error :

The alias "i" is declared in the headerMessage of the soap call but it is also used in the orderClaimFilter. This alias must be declared at a higher level to be used out of the headerMessage.

at the moment this issue seems to have been solved on the last version of the SDK.

regards,

Crease29 commented 6 years ago

Thank you, I've updated to the latest version and the error doesn't occur anymore. Now I'm getting a read timeout:


  [Zend\Http\Client\Adapter\Exception\TimeoutException (1000)]  
  Read timed out                                                

Exception trace:
 () at /var/www/cdiscount-api/src/Cilex/Provider/cDiscount/vendor/cdiscount-api/vendor/zendframework/zend-http/src/Client/Adapter/Curl.php:457
 Zend\Http\Client\Adapter\Curl->write() at /var/www/cdiscount-api/src/Cilex/Provider/cDiscount/vendor/cdiscount-api/vendor/zendframework/zend-http/src/Client.php:1439
 Zend\Http\Client->doRequest() at /var/www/cdiscount-api/src/Cilex/Provider/cDiscount/vendor/cdiscount-api/vendor/zendframework/zend-http/src/Client.php:930
 Zend\Http\Client->send() at /var/www/cdiscount-api/src/Cilex/Provider/cDiscount/vendor/cdiscount-api/sdk/src/core/HttpTools/CDSApiRequest.php:91
 Sdk\HttpTools\CDSApiRequest->execute() at /var/www/cdiscount-api/src/Cilex/Provider/cDiscount/vendor/cdiscount-api/sdk/src/core/Auth/Token.php:87
 Sdk\Auth\Token->_generateNewToken() at /var/www/cdiscount-api/src/Cilex/Provider/cDiscount/vendor/cdiscount-api/sdk/src/core/Auth/Token.php:115
 Sdk\Auth\Token->getToken() at /var/www/cdiscount-api/src/Cilex/Provider/cDiscount/vendor/cdiscount-api/sdk/src/public/ApiClient/CDSApiClient.php:161
 Sdk\ApiClient\CDSApiClient->init() at /var/www/cdiscount-api/src/Cilex/Command/CDiscountFetchOrderClaimListCommand.php:75
 Cilex\Command\CDiscountFetchOrderClaimListCommand->execute() at /var/www/cdiscount-api/vendor/symfony/console/Command/Command.php:262
 Symfony\Component\Console\Command\Command->run() at /var/www/cdiscount-api/vendor/symfony/console/Application.php:906
 Symfony\Component\Console\Application->doRunCommand() at /var/www/cdiscount-api/vendor/symfony/console/Application.php:224
 Symfony\Component\Console\Application->doRun() at /var/www/cdiscount-api/vendor/symfony/console/Application.php:125
 Symfony\Component\Console\Application->run() at /var/www/cdiscount-api/src/Cilex/Application.php:130
 Cilex\Application->run() at /var/www/cdiscount-api/bin/run.php:21
Crease29 commented 6 years ago

@gregz1 ?

Crease29 commented 6 years ago

Any news on this?

Klemart3D commented 6 years ago

Are you dealing with preprod or prod environment ? I had same problem with preprod because of closing days, with prod I never catch a timeout error.

gregz1 commented 6 years ago

You can get a timeout if you try to get to many discussions at the same time. By default the date filter is set on last 30 days Try to apply a more restrictive filter it can solve your problem. I confirm preproduction is not available 1 or 2 days by week.