phpxmlauthorize.netauthorize.net-arb

Name cannot begin with the ' ' character, in ARB Request


I have used the ARB in authorize.net, I am using the php and Xml to request for create subscriptions in ARB.Its working fine in local but i uploaded the files in server it is showing following error,

Error message: Name cannot begin with the ' ' character, hexadecimal value 0x20. Line 1, position 406.

Error Code: E00003

Could anyone please suggest how to resolve the issue, did i have to contact server?

Below is the Xml file i have used to request,

$content ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" .
        "<ARBCreateSubscriptionRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">" .
        "<merchantAuthentication>".
        "<name>5A3RXdSct55</name>".
        "<transactionKey>" . $transactionkey . "</transactionKey>".
        "</merchantAuthentication>".
        "<refId>" .$refId . "</refId>".
        "<subscription>".
        "<name>Monthly Subscription</name>".
        "<paymentSchedule>".
        "<interval>".
        "<length>". $length ."</length>".
        "<unit>". $unit ."</unit>".
        "</interval>".
        "<startDate>" . $startDate . "</startDate>".
        "<totalOccurrences>". $totalOccurrences . "</totalOccurrences>".
        "<trialOccurrences>". $trialOccurrences . "</trialOccurrences>".
        "</paymentSchedule>".
        "<amount>". $amount ."</amount>".
        "<trialAmount>" . $trialAmount . "</trialAmount>".
        "<payment>".
        "<creditCard>".
        "<cardNumber>" . $cardNumber . "</cardNumber>".
        "<expirationDate>" . $expirationDate . "</expirationDate>".
        "</creditCard>".
        "</payment>".
        "<billTo>".
        "<firstName>". $firstName . "</firstName>".
        "<lastName>" . $lastName . "</lastName>".
        "<company>" . $company . "</company>".
        "<address>" . $address . "</address>".
        "<city>" . $city . "</city>".
        "<state>" . $state . "</state>".
        "<zip>" . $zipcode . "</zip>".
        "<country>" . $country . "</country>".
        "</billTo>".
        "<shipTo>".
        "<firstName>". $firstName . "</firstName>".
        "<lastName>" . $lastName . "</lastName>".
        "<company>" . $company . "</company>".
        "<address>" . $address . "</address>".
        "<city>" . $city . "</city>".
        "<state>" . $state . "</state>".
        "<zip>" . $zipcode . "</zip>".
        "<country>" . $country . "</country>".
        "</shipTo>".
        "</subscription>".
        "</ARBCreateSubscriptionRequest>";

Solution

  • Finally i got the solution by using xml validator, i made a mistake in the $startdate variable it holds the date function, I haven't added the <?php tag to the date function.

    By using <?php it resolved the problem. Thanks for the suggestion cartalot.