[wsf-c-dev] [Ruby][PHP] MIXED value under op_params option of WSService

Samisa Abeysinghe samisa at wso2.com
Sat Apr 26 20:20:04 PDT 2008


Dimuthu Gamage wrote:
> Hi Janapriya,
>
> I think the API Documentation of the "opParams" should be corrected to
>
> This option specifies what a PHP function corresponding to the service 
> operation would accept as arguments.  If the 'wsdl' option is set this 
> option is default to MIXED, otherwise it is default to WSMESSAGE. If 
> you are using the service for WSDL Generations with the use of doc 
> comments, you have to set this parameter to MIXED explicitly.
>
> I think we have to update the default value section too.
>
> wsdl2php.php doesn't generate opParams because there the wsdl option 
> is given in the service. if the code generation fails or the generated 
> code is not working it should be due to some other reason. So Please 
> raise a jira on it.

And attach the WSDL you used.

Samisa...
>
> Thanks
> Dimuthu
>
> Ruwan Janapriya wrote:
>> Since we do not have wsdl mode support currently, the WSF/Ruby 
>> document does
>> not have enough information on the usage of "MIXED" as op_params. 
>> With the
>> completion of WSDL mode for Ruby, we need to update the doc as well.
>>
>> I went through the documentation + API of WSF/PHP.
>>
>> WSF/PHP API mentions the opParams as,
>>
>> "opParams"
>>  array
>>  "WSMESSAGE" | "MIXED"
>>  "WSMESSAGE"
>>  This option specifies what a PHP function corresponding to the service
>> operation would accept as arguments. This option is only required when
>> writing a service to use in the WSDL mode. By default, the WSMESSAGE is
>> assumed, which means that each function would have a single parameter 
>> of the
>> type WSMessage.
>>
>> The wsdl_11_service.php sample (see [1]), has QueryPurchaseOrderFunction
>> function accepting multiple arguments but WITHOUT setting the opParams
>> option. As per the above API comment, the default option should be
>> "WSMESSAGE" and the function should accept only one argument. so I 
>> set the
>> opParams to "MIXED" and the sample continued to work. Next I changed the
>> opParam to "WSMESSAGE" and received an error. So the conclusion is 
>> WSService
>> is using "MIXED" as default value, which is inconsistent with the API.
>>
>> WSF/PHP Docs + the above conclusion, helped me to believe, when used 
>> "MIXED"
>> under opParams,
>>
>> 1. the function would accept multiple arguments as described in wsdl
>> or
>> 2. the function would accept single argument (an object) if used with 
>> class
>> map.
>>
>> e.g. for the wsdl, sample_wsdl_11.wsdl (see [2] listing) the function 
>> would
>> be,
>> function QueryPurchaseOrderFunction($productName, $quantity, $date,
>> $orderNo) {
>>             return $return_array;
>> }
>> *OR*
>> function QueryPurchaseOrderFunction($input) {
>>     // NOTE: $input is of type orderInfo
>>     // NOTE: should return an object of type orderDetails
>> }
>>
>> I will continue on implementing the WSF/Ruby wsdl mode for service 
>> according
>> to the above conclusions.
>>
>> BTW, I encountered an error when I used the code generated by 
>> wsdl2php.php
>> [3]. Simply the service replied with an Fatal error. Also the 
>> generated code
>> does NOT set the $opParams variable which is used as an option. IMO, it
>> should be corrected.
>>
>> I didn't create a JIRA for the above, since I wanted to be clear 
>> about the
>> opParams option and discuss about it with the group before hand.
>>
>> regards,
>>
>> Janapriya.
>>
>> [1] extracted from wsdl_11_service.php,
>>
>> function QueryPurchaseOrderFunction($pro_name, $quantity, $date, 
>> $orderNo) {
>>    .....
>>     return $return_value
>> }
>>
>> $operations = array("QueryPurchaseOrder" => 
>> "QueryPurchaseOrderFunction");
>>
>> $svr = new WSService(array("wsdl"=>"sample_wsdl_11.wsdl",
>>                            "operations" => $operations));
>>
>> $svr->reply();
>>
>> [2]
>>
>> <xsd:element name="orderInfo">
>>  ...
>>                        <xsd:element name="productName"
>> type="xsd:string"></xsd:element>
>>                         <xsd:element name="quantity"
>> type="xsd:float"></xsd:element>
>>                         <xsd:element name="date"
>> type="xsd:dateTime"></xsd:element>
>>                         <xsd:element name="orderNo"
>> type="xsd:int"></xsd:element>
>> ...
>>  </xsd:element>
>> <wsdl:operation name="QueryPurchaseOrder">
>>             <wsdl:input
>> message="tns:QueryPurchaseOrderRequest"></wsdl:input>
>>  .....
>> <wsdl:message name="QueryPurchaseOrderRequest">
>>         <wsdl:part name="QueryPurchaseOrderRequest"
>> element="tns:orderInfo">
>>  .....
>>
>> [3]
>> <?php
>>
>> // PHP classes corresponding to the data types in defined in WSDL
>>
>> class orderInfo {
>>     public $productName; // string
>>     public $quantity; // float
>>     public $date; // dateTime
>>     public $orderNo; // int
>> }
>>
>> class orderDetails {
>>     public $shipTo; // address
>>     public $billTo; // address
>>     public $product; // productInfo
>> }
>>
>> class address {
>>     public $name; // string
>>     public $street; // string
>>     public $city; // string
>>     public $state; // string
>>     public $zip; // decimal
>> }
>>
>> class productInfo {
>>     public $productId; // int
>>     public $shippingDate; // dateTime
>>     public $status; // boolean
>> }
>>
>> // define the class map
>> $class_map = array(
>>  "anyType" => "anyType", "orderInfo" => "orderInfo", "orderDetails" =>
>> "orderDet
>> ails", "address" => "address", "productInfo" => "productInfo");
>>
>> // define PHP functions that maps to WSDL operations
>> function QueryPurchaseOrder($input) {
>>     // TODO: fill in the business logic
>>     // NOTE: $input is of type orderInfo
>>     // NOTE: should return an object of type orderDetails
>> }
>>
>>
>> // define the operations map
>> $operations = array(
>>  "QueryPurchaseOrder" => "QueryPurchaseOrder");
>>
>> // define the actions => operations map
>> $actions = array(
>>  "http://www.wso2.org/php/QueryPurchaseOrder" => "QueryPurchaseOrder");
>>
>> // create service in WSDL mode
>> $service = new WSService(array ("wsdl" =>"C:/sample_wsdl_11.wsdl",
>>         "operations" => $operations,
>>         "opParams" => $opParams,
>>         "actions" => $actions,
>>         "classmap" => $class_map,
>>                             ));
>>
>> // process client requests and reply
>> $service->reply();
>>
>> ?>
>>
>> On Sat, Apr 26, 2008 at 4:30 PM, Samisa Abeysinghe <samisa at wso2.com> 
>> wrote:
>>
>>> Ruwan Janapriya wrote:
>>>
>>>> Hi All,
>>>>
>>>> Currently I am integrating/implementing wsdl mode to WSF/Ruby. I came
>>>> across following in the WSService API [1].
>>>>
>>>> *parameter option : *op_params     *type: *hash     *value domain :
>>>> *"WSMESSAGE" | "MIXED"    *default value : * "WSMESSAGE"    
>>>> *description : *
>>>> This option specifies what a Ruby function corresponding to the 
>>>> service
>>>> operation would accept as arguments. This option is only required when
>>>> writing a service to use in the WSDL mode. By default, the 
>>>> WSMESSAGE is
>>>> assumed, which means that each function would have a single 
>>>> parameter of the
>>>> type WSMessage.
>>>>
>>>> could anyone please explain about the value "MIXED" ? How the input
>>>> parameter of the function would behave when op_params is set to 
>>>> "MIXED"?
>>>>
>>> Is not the doc explain MIXED? If not that is a bug that must be 
>>> fixed :(
>>> If you cannot understand, how can we expect the users to understand ;)
>>>
>>> BTW, please also have a look into the PHP doc.
>>>
>>> Samisa...
>>>
>>>
>>> _______________________________________________
>>> Wsf-c-dev mailing list
>>> Wsf-c-dev at wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/wsf-c-dev
>>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Wsf-c-dev mailing list
>> Wsf-c-dev at wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/wsf-c-dev
>
>
> _______________________________________________
> Wsf-c-dev mailing list
> Wsf-c-dev at wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/wsf-c-dev
>
>


-- 
Samisa Abeysinghe 
Director, Engineering; WSO2 Inc.

http://www.wso2.com/ - "The Open Source SOA Company"




More information about the Wsf-c-dev mailing list