Solved

Web Service Client

Posted on 2008-10-30
3
256 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
Comment Utility
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
Comment Utility
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
Comment Utility
Spirit,

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

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
This article discusses four methods for overlaying images in a container on a web page
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

772 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

11 Experts available now in Live!

Get 1:1 Help Now