logo       

Re: Re: abstract type using nusoap causing error: msg#00060

php.nusoap.general

Subject: Re: Re: abstract type using nusoap causing error


Let's quickly review some of the relationship between the XML Schema in WSDL
and the way one programs in PHP using NuSOAP.

An XML Schema complexType for something resembling a "C" structure is something
like

<s:complexType name="LatLong">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" default="0" name="Latitude"
type="s:double"/>
<s:element minOccurs="0" maxOccurs="1" default="0" name="Longitude"
type="s:double"/>
</s:sequence>
</s:complexType>

In PHP, one uses an associative array, where the element names in the
complexType are used as keys in the associative array, like

$latLong = array('Latitude' => 42.5, 'Longitude' => 33.6);

There are two different ways an array can be defined in WSDL. For an
rpc/encoded method, the SOAP 1.1 spec defines an Array type that gets used.
This kind of array corresponds very directly to a simple array in PHP. The
WSDL looks like

<complexType name="ArrayOfint">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:int[]"/>
</restriction>
</complexContent>
</complexType>

And the PHP to create such an array would be

$ints = array(1, 3, 5);

An "array" in doc/lit needs to be defined slightly differently than an array in
rpc/encoded. For rpc/encoded, the SOAP 1.1 spec defines an Array type that
gets used. For doc/lit, the Array type is not available in the XML Schema.
Instead, a common way to define something corresponding to an array is
something like

<s:complexType name="ArrayOfInt">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="int" type="s:int"/>
</s:sequence>
</s:complexType>

Like other complex types, you would construct this in PHP as an associative
array like

$ints = array('int' => something);

In this case, the 'something' is a simple array

$ints = array('int' => array(1, 3, 5));

As an example, here is how I would construct two of the elements of a
MapSpecification. That definition is

<s:complexType name="MapSpecification">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="DataSourceName"
type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="HighlightedEntityIDs"
type="s0:ArrayOfInt"/>
<s:element minOccurs="0" maxOccurs="1" name="Options"
type="s0:MapOptions"/>
<s:element minOccurs="0" maxOccurs="1" name="Pushpins"
type="s0:ArrayOfPushpin"/>
<s:element minOccurs="0" maxOccurs="1" name="Route" type="s0:Route"/>
<s:element minOccurs="0" maxOccurs="1" name="Views"
type="s0:ArrayOfMapView"/>
</s:sequence>
</s:complexType>

// A doc/lit "array" of integers
// The key 'int' comes from the element name in ArrayOfInt
$entityIDs = array('int' => array(1, 3, 5));

// A doc/lit "array" of Pushpin
// First, construct a simple array
$apushpins[] = array(
'IconDataSource' => '...',
'IconName' => '...',
'Label' => '...',
'LatLong' => $latLong, // $latLong is constructed elsewhere
'PinID' => '...',
'Pixel' => $pixelCoord, // $pixelCoord is constructed elsewhere
'ReturnsHotArea' => true,
'LabelNearbyRoads' => true
);
$apushpins[] = array(
'IconDataSource' => '...',
'IconName' => '...',
'Label' => '...',
'LatLong' => $latLong2, // $latLong2 is constructed elsewhere
'PinID' => '...',
'Pixel' => $pixelCoord2, // $pixelCoord2 is constructed elsewhere
'ReturnsHotArea' => true,
'LabelNearbyRoads' => true
);
// Second, construct the associative array for the complexType
// The key 'PushPin' comes from the definition of ArrayOfPushpin
$pushpins = array('PushPin' => $apushpins);

// mapSpecification
$mapSpecification = array(
'DataSourceName' => '...',
'HighlightedEntityIDs' => $entityIds,
'Options' => $mapOptions, // $mapOptions is constructed elsewhere
'Pushpins' => $pushPins,
'Route' => $route, // $route is constructed elsewhere
'Views' => $views // $views is constructed elsewhere
);

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message -----
From: "James Yang" <jyang@xxxxxxxxxxx>
To: "Scott Nichol" <snicholnews@xxxxxxxxxxxxxxx>;
<nusoap-general@xxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, April 16, 2004 8:13 AM
Subject: RE: [Nusoap-general] Re: abstract type using nusoap causing error



Thanks for the wsdlclient9.php example. this is a great help. Now in the
"GetMap" wsdl function (its skin in the example) there is a section where
you can set your pins, it looks like this (see below) . How should the
"pushpin" be represent as input parameter, if I wanted more than one
element to be pass in, say two or three elements of a "Pushpin".


- <s:complexType name="ArrayOfPushpin">
- <s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="Pushpin"
nillable="true" type="s0:Pushpin" />
</s:sequence>
</s:complexType>
- <s:complexType name="Pushpin">
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="IconDataSource"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="IconName" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Label" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="LatLong" type="s0:LatLong" />
<s:element minOccurs="0" maxOccurs="1" name="PinID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Pixel" type="s0:PixelCoord"
/>
<s:element minOccurs="1" maxOccurs="1" name="ReturnsHotArea"
type="s:boolean" />
<s:element minOccurs="1" maxOccurs="1" name="LabelNearbyRoads"
type="s:boolean" />
</s:sequence>
</s:complexType>




> -----Original Message-----
> From: nusoap-general-admin@xxxxxxxxxxxxxxxxxxxxx
> [mailto:nusoap-general-admin@xxxxxxxxxxxxxxxxxxxxx]On Behalf Of Scott
> Nichol
> Sent: Tuesday, April 13, 2004 9:35 AM
> To: nusoap-general@xxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [Nusoap-general] Re: abstract type using nusoap causing
> error
>
>
> > I was following the example of mappoint and was trying to
> >
> > render an image and keep getting an error
> >
> >
> >
> > The specified type is abstract: name='MapView'
> >
> > Is this a bug or am I missing something? Thank you for any
> >
> > help.
>
> There were two issues that prevented NuSOAP client code for this
> service method from working. First, the method includes as part
> of its parameter structure a "doc/lit array". This is an XML
> Schema complexType in which an element has maxOccurs="unbounded",
> rather than a SOAP encoded array used by rpc/encoded services.
> Second, the array is defined to have elements of an abstract XML
> Schema type. It is therefore required that the consumer of the
> service specify the concrete type of the data actually sent.
>
> I have made code changes to NuSOAP to address both of these
> issues. I have also added yet another sample, this one to call
> the GetMap method and exercise the NuSOAP changes.
>
> The changes and sample have been added to CVS. As always, there
> will be some delay before the changes are available through anonymous CVS.
>
> Scott Nichol
>
> Do not send e-mail directly to this e-mail address,
> because it is filtered to accept only mail from
> specific mail lists.
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=ick
> _______________________________________________
> Nusoap-general mailing list
> Nusoap-general@xxxxxxxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/nusoap-general
>


__________________________________________________________________________
Disclaimer: This e-mail message is intended only for the personal use of
the recipient(s) named above. If you are not an intended recipient, you
may not review, copy or distribute this message. If you have received this
communication in error, please notify us immediately by e-mail and delete
the original message.
This e-mail expresses views only of the sender, which are not to be
attributed to Rite Aid Corporation and may not be copied or distributed
without this statement.



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise