Google Answers Logo
View Question
 
Q: Problem using NuSOAP with PHP ( No Answer,   2 Comments )
Question  
Subject: Problem using NuSOAP with PHP
Category: Computers > Programming
Asked by: abw-ga
List Price: $100.00
Posted: 02 Feb 2006 09:08 PST
Expires: 04 Feb 2006 22:29 PST
Question ID: 440511
We are developing using PHP and nusoap.  The wsdl file we are reading
has a line such as <xs:extension base="ac:Request">

So here is the answer we need:
- Generate a request (using nusoap preferrably) that includes the
elements of Request.

We need a request that looks like this:
---- BEGIN GOOD EXAMPLE ---
<feeLookupRequest xmlns="http://www.moneygram.com/AgentConnect40">
            <unitProfileID>11111</unitProfileID>
            <agentID>1234567</agentID>
            <agentSequence>1</agentSequence>
            <token>123TOKEN456</token>
            <timeStamp>2006-01-30T22:29:20Z</timeStamp>
            <apiVersion>1</apiVersion>
            <clientSoftwareVersion>1</clientSoftwareVersion>
            <productType>SEND</productType>
            <receiveAmount>555</receiveAmount>
            <receiveCountry>USA</receiveCountry>
            <deliveryOption>OTHER</deliveryOption>
        </feeLookupRequest>
---- END   GOOD EXAMPLE ---

NOT LIKE THIS:

---- BEGIN   BAD EXAMPLE ---
<feeLookupRequest xmlns="http://www.moneygram.com/AgentConnect40">
            <productType>SEND</productType>
            <receiveAmount>555</receiveAmount>
            <receiveCountry>USA</receiveCountry>
            <deliveryOption>OTHER</deliveryOption>
        </feeLookupRequest>
---- END   BAD EXAMPLE ---




And
$client = new
soapclient('https://tws.moneygram.com/extws/AgentConnect40.NET.wsdl' , 'wsdl');

-- BEGIN CODE --
 <?php
require_once('lib/nusoap.php');
$client = new
soapclient('https://tws.moneygram.com/extws/AgentConnect40.NET.wsdl' ,
'wsdl'); $err = $client->getError(); if ($err) { echo '<h2>Constructor
error</h2><pre>' . $err . '</pre>'; }

$the_gm_date = gmdate("Y-m-d\TH:i:s\Z"); $request = array(
    'unitProfileID'         => 11111
  , 'agentID'               => 1234567
  , 'agentSequence'         => 1
  , 'token'                 => '123TOKEN123'
  , 'timeStamp'             => $the_gm_date
  , 'apiVersion'            => 1
  , 'clientSoftwareVersion' => 1
);
$param = array(
    'productType'           => 'SEND'
  , 'receiveAmount'         => '999'
  , 'receiveCountry'        => 'USA'
  , 'deliveryOption'        => 'OTHER'
);

## FILL IN THE_BLANK (not using a scalar (string) see below) $result =
$client->call('feeLookup', THE_BLANK);

echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';

/* This hack does work, but is not 'proper'
 * $string = '';
 * $string .= '<feeLookupRequest
xmlns="http://www.moneygram.com/AgentConnect40">';
 * foreach ($param as $key => $value) { $string .= "<$key>$value</$key>\n"; }
 * $string .= '</feeLookupRequest>';
 * $result = $client->call('feeLookup',$string);
 */


-- END CODE --
Answer  
There is no answer at this time.

Comments  
Subject: Re: Problem using NuSOAP with PHP
From: grauler-ga on 02 Feb 2006 17:54 PST
 
In soap.php:
* @author   Dietrich Ayala <dietrich@ganx4.com>
* @version  $Id: nusoap.php,v 1.94 2005/08/04 01:27:42 snichol Exp $

About line 1689 the following check needs to be there:
     if (isset($etype['extensionBase'])) {
       $this->elements[$type]['extensionBase'] = $etype['extensionBase'];
     }

Otherwise the extension base=XXX will not be seen.
Subject: Re: Problem using NuSOAP with PHP
From: grauler-ga on 02 Feb 2006 17:55 PST
 
I mean nusoap.php

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy