cancel
Showing results for 
Search instead for 
Did you mean: 

00045 The root node does not reference a valid XML namespace. PHP-SDK

Hello! Looking for solution for a long time, can't find anything, please help!

Using PHP-SDK, code based on "Sample Code" for credit card charge.

Transaction type - authCaptureTransaction

After $response = $controller->executeWithApiResponse("https://apitest.authorize.net");
var_dump($response);

 

object(net\authorize\api\contract\v1\CreateTransactionResponse)#153 (5) {  ["transactionResponse":"net\authorize\api\contract\v1\CreateTransactionResponse":private]=>  NULL  ["profileResponse":"net\authorize\api\contract\v1\CreateTransactionResponse":private]=>  NULL  ["refId":"net\authorize\api\contract\v1\ANetApiResponseType":private]=>  NULL  ["messages":"net\authorize\api\contract\v1\ANetApiResponseType":private]=>  NULL  ["sessionToken":"net\authorize\api\contract\v1\ANetApiResponseType":private]=>  NULL}

 LogFile:

 

[_sendRequest] (/public_html/vendor/lib/net/authorize/util/HttpClient.php : 77) - Request to AnetApi: 
<?xml version="1.0" encoding="UTF-8"?>
<createTransactionRequest>
  <ns-0fc19dc0:merchantAuthentication xmlns:ns-0fc19dc0="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
    <ns-0fc19dc0:name><![CDATA[mylogin]]></ns-0fc19dc0:name>
    <ns-0fc19dc0:transactionKey><![CDATA[mytranskey]]></ns-0fc19dc0:transactionKey>
  </ns-0fc19dc0:merchantAuthentication>
  <ns-0fc19dc0:clientId xmlns:ns-0fc19dc0="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><![CDATA[sdk-php-1.9.0]]></ns-0fc19dc0:clientId>
  <ns-0fc19dc0:refId xmlns:ns-0fc19dc0="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><![CDATA[ref1474550330]]></ns-0fc19dc0:refId>
  <ns-0fc19dc0:transactionRequest xmlns:ns-0fc19dc0="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
    <ns-0fc19dc0:transactionType><![CDATA[authCaptureTransaction]]></ns-0fc19dc0:transactionType>
    <ns-0fc19dc0:amount>1</ns-0fc19dc0:amount>
    <ns-0fc19dc0:payment>
      <ns-0fc19dc0:creditCard>
        <ns-0fc19dc0:cardNumber><![CDATA[xxxx]]></ns-0fc19dc0:cardNumber>
        <ns-0fc19dc0:expirationDate><![CDATA[0618]]></ns-0fc19dc0:expirationDate>
        <ns-0fc19dc0:cardCode><![CDATA[000]]></ns-0fc19dc0:cardCode>
      </ns-0fc19dc0:creditCard>
    </ns-0fc19dc0:payment>
    <ns-0fc19dc0:order>
      <ns-0fc19dc0:description><![CDATA[Order #1037]]></ns-0fc19dc0:description>
    </ns-0fc19dc0:order>
  </ns-0fc19dc0:transactionRequest>
</createTransactionRequest>

 [_sendRequest] (/public_html/vendor/lib/net/authorize/util/HttpClient.php : 89) - Sending 'XML' Request type
 [_sendRequest] (/public_html/vendor/lib/net/authorize/util/HttpClient.php : 94) - Sending http request via Curl
 [_sendRequest] (/public_html/vendor/lib/net/authorize/util/HttpClient.php : 96) - Response from AnetApi: <?xml version="1.0" encoding="utf-8"?><ErrorResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><messages><resultCode>Error</resultCode><message><code>E00045</code><text>The root node does not reference a valid XML namespace.</text></message><message><code>E00001</code><text>An error occurred during processing. Please try again.</text></message></messages></ErrorResponse>

 

loadbabe
Member
1 REPLY 1

Can you please provide the exact sample code request you are using. We see xmlns:ns-0fc19dc0 tag everywhere. Usually we have xs: tag everywhere else, while the xmlns tag is present only in the root createTransactionRequest.

 

Also from the logs, we see that you are not using the sample code repository,

/public_html/vendor/lib/net/authorize/util/HttpClient.php

 rather you seem to using the php-sdk repository, in which you have added one sample code. So, can you provide the directory structure in which you have placed the file w.r.t. the sdk as well?

ashu8uec
Contributor