[wsf-c-dev] [jira] Commented: (WSFPHP-219) Providing custom classes and array format support for Schema AnyType

Dimuthu Gamage (JIRA) jira at wso2.org
Sun Feb 24 19:54:44 PST 2008


    [ https://wso2.org/jira/browse/WSFPHP-219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15713#action_15713 ] 

Dimuthu Gamage commented on WSFPHP-219:
---------------------------------------

For an example, for the following example

<types>
−	<xsd:schema elementFormDefault="qualified" targetNamespace="http://www.wso2.org/php">
−	<xsd:element name="echo">
−	<xsd:complexType>
−	<xsd:sequence>
            <xsd:element name="inMessage" type="xsd:anyType"/>
          </xsd:sequence>
          </xsd:complexType>
          </xsd:element>
−	<xsd:element name="echoResponse">
−	<xsd:complexType>
−	<xsd:sequence>
            <xsd:element name="returnVal" type="xsd:anyType"/>
          </xsd:sequence>
          </xsd:complexType>
          </xsd:element>
          </xsd:schema>
</types>

if you use the non-class (array) api,

you would be able to use something similar to this,

$response = $proxy->echo(array("int" => 5, "float=>3.5, "string=> "hi"));

echo $response["int"];
echo $response["float"];
echo $response["string"];

according to the user input this will create the following xml

<ns1:echo xmlns:ns1="http://www.wso2.org/php">
  <ns1:int>5</ns1:int>
  <ns1:float>3.5</ns1:float>
  <ns1:string>Hi</ns1:string>
</ns1:echo>

Note that the namespace is taken from the parent,

and when the response come the parser will create following response structure,

array("int" => 5, "float" => 3.5, "string" => "Hi")


The simmilar thing can be given to the classmap API,

i.e 

class echoType{
 public $int;  //assuming these are valid names..
 public $float;
 public $string;
}

$res = $proxy->echo(echoTypeInstance);

echo $res->int;
echo $res->float; //like that.

Note that if the response type is always on the form XMLSchemaAnyType class, which can hold any name as its properties, (there we can use PHP magic functions __get, __set.)



> Providing custom classes and array format support for Schema AnyType
> --------------------------------------------------------------------
>
>                 Key: WSFPHP-219
>                 URL: https://wso2.org/jira/browse/WSFPHP-219
>             Project: WSO2 WSF/PHP
>          Issue Type: Bug
>          Components: WSDL Mode
>         Environment: Linux, Windows
>            Reporter: Dimuthu Gamage
>            Assignee: Dimuthu Gamage
>            Priority: Critical
>             Fix For: 1.2.1
>
>
> Currently when there exist an AnyType in the WSDL, wsdl mode fails,
> We should fix this, so that when there is an anytype,
> in serializing,
>   should serialize xml for any given Array or Object structure defining elements name equal to their properties name and their namespace equal to the parent's namespace.
> in deserializing,
>    should build array or class object structure (depending on whether class map given or not) so that element names are mapped to the array key names or class property names respectively,

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://wso2.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the Wsf-c-dev mailing list