Solved

Web Service Client

Posted on 2008-10-30
3
260 Views
Last Modified: 2013-11-18
Hi,

I'm trying to consume a web servie to make onlyne payments with Authorize.Net, the thing is that the server is giving me this error: soap:Client: Server was unable to read request. ---> There is an error in XML document (1, 1132). ---> Input string was not in a correct format.

but i think that i have the correct xml, also i put it into a XML document: http://spirittechnologies.net/carlos/web_service/CBF%20authorize/SOAP/Transaction%20sample%20xml2.xml

Someone now what can be the problem?, I have also attach their api guide.
CIM-SOAP-guide.pdf
0
Comment
Question by:Spirit_US
  • 2
3 Comments
 
LVL 16

Expert Comment

by:alain34
ID: 22848503
Hello Spirit_US,

Could you post the code that you are using to send the data to the service, and experts will be able to se if there is aproblem with it.

Regards,

alain34
0
 

Author Comment

by:Spirit_US
ID: 22850060
I'm using a framework called NuSOAP.

This is my code:

<?
      /
   
      require_once('lib/nusoap.php');
   
   
      $url = 'https://apitest.authorize.net/soap/v1/Service.asmx?wsdl';
      $loginId =  '7q6Lu8X7';
      $transactionKey = '9YM4aUP5Ej77a854';
 
     
      $soapclient = new soapclient($url, true);


      $function = 'CreateCustomerProfileTransaction';
 

       
     
       
      $params = array('merchantAuthentication' => array('name' => $loginId, 'transactionKey' => $transactionKey),
                        'transaction' => array('profileTransAuthCapture' => array('amount' => '61.00',
                                                                               'customerProfileId' => '181463',
                                                                             'customerPaymentProfileId' => '175606',
                                                                             'tax' => array('amount' => '20',
                                                                                            'name' => 'TJ',
                                                                                            'description' => 'N/A',    
                                                                                    ),
                                                                             'shipping' => array('amount' => '20',
                                                                                            'name' => 'TJ',
                                                                                            'description' => 'N/A'
                                                                                            ),
                                                                             'duty' => array('amount' => '20',
                                                                                            'name' => 'TJ',
                                                                                            'description' => 'N/A'
                                                                                            ),
                                                                             'lineItems' => array('itemId' => '',
                                                                                                  'name' => '',
                                                                                                  'description' => '',
                                                                                                  'quantity' => '',
                                                                                                  'unitPrice' => '',
                                                                                                  'taxable' => 'FALSE'
                                                                                            ),
                                                                             'order' => array('invoiceNumber' => '',
                                                                                              'description' => '',
                                                                                              'purchaseOrderNumber' => ''
                                                                                        )
               
           
                                                                   )
                                          )
                                                             
                        );
 
      /
 
      $resultado = $soapclient->call( $function , $params );
 
       
 $err = $soapclient->getError();
if ($err) {
    // Display the error
    echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
    // At this point, you know the call that follows will fail
}

     
      print_r($resultado['customerProfileId']);
       print_r($resultado);

     
      echo "<br>";
      //echo $soapclient->response;
        // Check for a fault
        if ($soapclient->fault) {
            echo '<h2>Fault</h2>';
           
        } else {
            // Check for errors
            $err = $soapclient->getError();
            if ($err) {
                // Display the error
                echo '<h2>Error:</h2>'.$err ;
            }
        }
       
// Display the request and response
echo '<br>';
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($soapclient->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>';
// Display the debug messages
echo '<h2>Debug</h2>';
echo '<pre>' . htmlspecialchars($soapclient->debug_str, ENT_QUOTES) . '</pre>';

?>
0
 
LVL 16

Accepted Solution

by:
alain34 earned 500 total points
ID: 22850129
Spirit,

Thank you for the code.
I'm concerned that you haven't hidden the loginId and transactionId
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now