Solved

Web Service Client

Posted on 2008-10-30
3
264 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

777 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