Thursday, December 30, 2010

How to statically serve a wsdl with WSF/PHP.

WSF/PHP has two modes of operations. When using wsdl mode, you will always start with a wsdl and hence, that wsdl will be served for ?wsdl request. On the other hand, you can write a service with annotations and the corresponding wsdl will be generated for you. However, when using the xml-in-out mode with WSMessage object as the input and output parameter for the operation, its better to be able to serve a wsdl that is saved in the server since auto generated wsdl’s schema might not match the operation accepted xml.

Getting this done is quite simple. all you need to do is to set the option “omitProcesswsdl” in WSService operations array to true. 

$opParams = array("testFunction"=>"WSMESSAGE");

$service = new WSService(array(  "wsdl"=>"mystaticwsdl.wsdl",
        "omitProcesswsdl"=>TRUE,
        "opParams"=>$opParams,
        "operations" => $operations,
        "actions"=>$actions );

By specifying omitProcesswsdl, you can prevent WSF/PHP from trying to process the operation as a WSDL Mode operation. Also note that you would need to set your function as of type WSMESSAGE by using opParams. This is a work about which is not required for current svn trunk.
 

No comments:

Post a Comment