[wsf-c-dev] [jira] Commented: (WSFPHP-306) Response doesn't validate in WSDL mode when returning an empty array
Thomas Kelder (JIRA)
jira at wso2.org
Thu Jul 31 01:02:52 PDT 2008
[ https://wso2.org/jira/browse/WSFPHP-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18422#action_18422 ]
Thomas Kelder commented on WSFPHP-306:
--------------------------------------
Below is a patch (on wso2-wsf 1.3.2) I created to add 'minOccurs="0"' for arrays to the generated wsdl. After applying this patch, the response validates against the xml schema and the error in the Axis2/ADB client is resolved. Could this be included in the next release? I'd say it's valid to set 'minOccurs="0"' as default, since an array can be empty.
diff -c wsdl/WS_WSDL_Consts.php wsdl-patched/WS_WSDL_Consts.php
*** wsdl/WS_WSDL_Consts.php 2008-07-31 08:24:37.000000000 +0200
--- wsdl-patched/WS_WSDL_Consts.php 2008-07-31 08:25:48.000000000 +0200
***************
*** 145,150 ****
--- 145,152 ----
const WS_WSDL_ATTR_MAX_OCCURS = "maxOccurs";
const WS_WSDL_ATTR_VALUE_UNBOUNDED = "unbounded";
+ const WS_WSDL_ATTR_MIN_OCCURS = "minOccurs";
+
const WS_WSDL_SCHEMA_TYPE_DEFAULT_NS = "http://www.wso2.org/php/xsd";
static public $defaultTypes = array(
diff -c wsdl/WS_WSDL_Type.php wsdl-patched/WS_WSDL_Type.php
*** wsdl/WS_WSDL_Type.php 2008-06-04 13:19:06.000000000 +0200
--- wsdl-patched/WS_WSDL_Type.php 2008-07-31 08:27:04.000000000 +0200
***************
*** 169,174 ****
--- 169,175 ----
if($paramValue["array"] == "array")
{
$ele->setAttribute(WS_WSDL_Const::WS_WSDL_ATTR_MAX_OCCURS, WS_WSDL_Const::WS_WSDL_ATTR_VALUE_UNBOUNDED);
+ $ele->setAttribute(WS_WSDL_Const::WS_WSDL_ATTR_MIN_OCCURS, "0");
}
if($paramValue["object"] == "object")
> Response doesn't validate in WSDL mode when returning an empty array
> --------------------------------------------------------------------
>
> Key: WSFPHP-306
> URL: https://wso2.org/jira/browse/WSFPHP-306
> Project: WSO2 WSF/PHP
> Issue Type: Bug
> Components: WSDL Generation , WSDL Mode
> Reporter: Thomas Kelder
>
> see: http://wso2.org/forum/thread/3884
> I'm setting up a webservice using the WSO2 WSF/php module. The service uses automatic WSDL generation from php code. One of the operations returns an array of objects, which normally works fine. However, when I return an empty array, my client in Java (using Axis2 with ADB) fails with the following error:
> org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement getRecentChangesResponse
> When I look at the xml response using soapUI, this seems ok:
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Header/>
> <soapenv:Body>
> <ns1:getRecentChangesResponse xmlns:ns1="http://www.wso2.org/php/xsd"/>
> </soapenv:Body>
> </soapenv:Envelope>
> However, it doesn't validate against the definition in the wsdl:
> <xsd:element name="getRecentChangesResponse">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="pathways" maxOccurs="unbounded" type="ns1:WSPathwayInfo"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> This could be resolved by adding 'minOccurs="0"' to the xsd:sequence tag (this fixed both the xml validation and the ADB client)
--
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