Re: NuSOAP assistance.

From: Date: Mon, 09 Jun 2008 09:09:15 +0000
Subject: Re: NuSOAP assistance.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-275130@lists.php.net to get a copy of this message
Quoting Dan Joseph <dmjoseph@gmail.com>:
Hi Everyone, This is kind of a follow up to my SOAP question on Friday. I have decided that NuSOAP is my quickest solution. I am having some issues though. Everything looks like I have it in place, but I must be doing something wrong since the WSDL won't work right. Wondering if someone could shed a light on this. http://new.vehicletransportusa.com/v2/services/URSQuoteServices.php http://new.vehicletransportusa.com/v2/services/URSQuoteServices.php?wsdl Here is the code: <?php require_once( "lib/nusoap.php" ); $NAMESPACE = 'Quotes'; $server = new soap_server; $server->configureWSDL('Quotes', $NAMESPACE); $server->wsdl->schemaTargetNamespace = $NAMESPACE; $server->wsdl->addComplexType(
    'VehiclesArray',
    'complexType',
    'array',
    '',
    'SOAP-ENC:Array',
    array(),
    array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:Vehicles[]')
    ),
    'tns:Vehicles'
); $server->wsdl->addComplexType(
    'VehicleQuote',
    'complexType',
    'struct',
    'all',
    '',
    array('id'=> array( 'name'=>'id', 'type'=>'xsd:string' ),
           'key'=> array( 'name'=>'key', 'type'=>'xsd:string' ),
           'firstname'=> array( 'name'=>'firstname', 'type'=>'xsd:string' ),
           'companyname'=> array( 'name'=>'lastname', 'type'=>'xsd:string'
),
           'dealername'=> array( 'name'=>'companyname', 'type'=>'xsd:string'
),
           'contact_address1'=> array( 'name'=>'dealername',
'type'=>'xsd:string' ),
           'contact_address1'=> array( 'name'=>'contact_address1',
'type'=>'xsd:string' ),
           'contact_address2'=> array( 'name'=>'contact_address2',
'type'=>'xsd:string' ),
           'contact_city'=> array( 'name'=>'contact_city',
'type'=>'xsd:string' ),
           'contact_state'=> array( 'name'=>'contact_state',
'type'=>'xsd:string' ),
           'contact_zip'=> array( 'name'=>'contact_zip',
'type'=>'xsd:string' ),
           'emailaddress'=> array( 'name'=>'emailaddress',
'type'=>'xsd:string' ),
           'phone'=> array( 'name'=>'phone', 'type'=>'xsd:string' ),
           'cellphone'=> array( 'name'=>'cellphone', 'type'=>'xsd:string' ),
           'fax'=> array( 'name'=>'fax', 'type'=>'xsd:string' ),
           'contactpref'=> array( 'name'=>'contactpref',
'type'=>'xsd:string' ),
           'referral'=> array( 'name'=>'referral', 'type'=>'xsd:string' ),
           'origin_contactname'=> array( 'name'=>'origin_contactname',
'type'=>'xsd:string' ),
           'origin_contactphone1'=> array( 'name'=>'origin_contactphone1',
'type'=>'xsd:string' ),
           'origin_contactphone2'=> array( 'name'=>'origin_contactphone2',
'type'=>'xsd:string' ),
           'origin_address1'=> array( 'name'=>'origin_address1',
'type'=>'xsd:string' ),
           'origin_address2'=> array( 'name'=>'origin_address2',
'type'=>'xsd:string' ),
           'origin_city'=> array( 'name'=>'origin_city',
'type'=>'xsd:string' ),
           'origin_state'=> array( 'name'=>'origin_state',
'type'=>'xsd:string' ),
           'origin_zip'=> array( 'name'=>'origin_zip', 'type'=>'xsd:string'
),
           'dest_contactname'=> array( 'name'=>'dest_contactname',
'type'=>'xsd:string' ),
           'dest_contactphone1'=> array( 'name'=>'dest_contactphone1',
'type'=>'xsd:string' ),
           'dest_contactphone2'=> array( 'name'=>'dest_contactphone2',
'type'=>'xsd:string' ),
           'dest_address1'=> array( 'name'=>'dest_address1',
'type'=>'xsd:string' ),
           'dest_address2'=> array( 'name'=>'dest_address2',
'type'=>'xsd:string' ),
           'dest_city'=> array( 'name'=>'dest_city', 'type'=>'xsd:string' ),
           'dest_state'=> array( 'name'=>'dest_state', 'type'=>'xsd:string'
),
           'dest_zip'=> array( 'name'=>'dest_zip', 'type'=>'xsd:string' ),
           'vin'=> array( 'name'=>'vin', 'type'=>'xsd:string' ),
           'year'=> array( 'name'=>'year', 'type'=>'xsd:string' ),
           'make'=> array( 'name'=>'make', 'type'=>'xsd:string' ),
           'model'=> array( 'name'=>'model', 'type'=>'xsd:string' ),
           'color'=> array( 'name'=>'color', 'type'=>'xsd:string' ),
           'vehicletype'=> array( 'name'=>'vehicletype',
'type'=>'xsd:string' ),
           'inop'=> array( 'name'=>'inop', 'type'=>'xsd:string' ),
           'buyer_id'=> array( 'name'=>'buyer_id', 'type'=>'xsd:string' ),
           'item_id'=> array( 'name'=>'item_id', 'type'=>'xsd:string' ),
           'engine_size'=> array( 'name'=>'engine_size',
'type'=>'xsd:string' ),
           'modified'=> array( 'name'=>'modified', 'type'=>'xsd:string' ),
           'enclosed_carrier'=> array( 'name'=>'enclosed_carrier',
'type'=>'xsd:string' ),
           'pickupdate'=> array( 'name'=>'pickupdate', 'type'=>'xsd:string'
),
           'latestpickupdate'=> array( 'name'=>'latestpickupdate',
'type'=>'xsd:string' ),
           'quote_type'=> array( 'name'=>'quote_type', 'type'=>'xsd:string'
),
           'savequote'=> array( 'name'=>'savequote', 'type'=>'xsd:string' ),
    )
); $server->register( 'getQuote',
                   array( 'id'=>'xsd:string' ),
                   array( 'key'=>'xsd:string' ),
                   array( 'firstname'=>'xsd:string' ),
                   array( 'lastname'=>'xsd:string' ),
                   array( 'companyname'=>'xsd:string' ),
                   array( 'dealername'=>'xsd:string' ),
                   array( 'contact_address1'=>'xsd:string' ),
                   array( 'contact_address2'=>'xsd:string' ),
                   array( 'contact_city'=>'xsd:string' ),
                   array( 'contact_state'=>'xsd:string' ),
                   array( 'contact_zip'=>'xsd:string' ),
                   array( 'emailaddress'=>'xsd:string' ),
                   array( 'phone'=>'xsd:string' ),
                   array( 'cellphone'=>'xsd:string' ),
                   array( 'fax'=>'xsd:string' ),
                   array( 'contactpref'=>'xsd:string' ),
                   array( 'referral'=>'xsd:string' ),
                   array( 'origin_contactname'=>'xsd:string' ),
                   array( 'origin_contactphone1'=>'xsd:string' ),
                   array( 'origin_contactphone2'=>'xsd:string' ),
                   array( 'origin_address1'=>'xsd:string' ),
                   array( 'origin_address2'=>'xsd:string' ),
                   array( 'origin_city'=>'xsd:string' ),
                   array( 'origin_state'=>'xsd:string' ),
                   array( 'origin_zip'=>'xsd:string' ),
                   array( 'dest_contactname'=>'xsd:string' ),
                   array( 'dest_contactphone1'=>'xsd:string' ),
                   array( 'dest_contactphone2'=>'xsd:string' ),
                   array( 'dest_address1'=>'xsd:string' ),
                   array( 'dest_address2'=>'xsd:string' ),
                   array( 'dest_city'=>'xsd:string' ),
                   array( 'dest_state'=>'xsd:string' ),
                   array( 'dest_zip'=>'xsd:string' ),
                   array( 'vin'=>'xsd:string' ),
                   array( 'year'=>'xsd:string' ),
                   array( 'make'=>'xsd:string' ),
                   array( 'model'=>'xsd:string' ),
                   array( 'color'=>'xsd:string' ),
                   array( 'vehicletype'=>'xsd:string' ),
                   array( 'inop'=>'xsd:string' ),
                   array( 'buyer_id'=>'xsd:string' ),
                   array( 'item_id'=>'xsd:string' ),
                   array( 'engine_size'=>'xsd:string' ),
                   array( 'modified'=>'xsd:string' ),
                   array( 'enclosed_carrier'=>'xsd:string' ),
                   array( 'pickupdate'=>'xsd:string' ),
                   array( 'latestpickupdate'=>'xsd:string' ),
                   array( 'quote_type'=>'xsd:string' ),
                   array( 'savequote'=>'xsd:string' ),
                   array( 'return'=>'tns:VehiclesArray' ),
                   $NAMESPACE                             );
function getQuote( $quoterequest ) {
    $vehicle = array();
    // Create book (hardcoded author)
    $vehicle[] = array( 'author' => "Jack London",
                        'title' => "blah",
                        'numpages' => "pages",
                        'toc' => "toc" );
    return $vehicle;
} $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA); ?> -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. "Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life."
The WSDL throws an error when the page is loaded. I don't think the SOAP client can parse the WSDL like this. Open the direct link to your WSDL and check the error. "htmlspecialchars() expects parameter 1 to be string, array given".

« previous php.general (#275130) next »