Wrapped document/literal do not work for empty message parts
------------------------------------------------------------
Key: GERONIMO-684
URL: http://issues.apache.org/jira/browse/GERONIMO-684
Project: Geronimo
Type: Bug
Components: webservices
Versions: 1.0-M4
Reporter: Ivan Dubrov
Attachments: patch2
If WSDL contains message parts with empty XML type, NullPointerException is
thrown during the deployment.
Here is the relevant pieces from the WSDL:
Piece from the schema embedded in the WSDL:
<complexType name="methodResponseType">
<sequence/>
</complexType>
<element name=methodResponse" type="tns:methodResponseTyoe"/>
Snippet from the WSDL:
<message name="SomeEndpoint_someResponse">
<part name="result" element="ns2:someResponse"/>
</message>
The following patch shows the possible solution:
Index: HeavyweightOperationDescBuilder.java
===================================================================
--- HeavyweightOperationDescBuilder.java (revision 190889)
+++ HeavyweightOperationDescBuilder.java (working copy)
@@ -229,14 +229,17 @@
// schemaType should be complex using xsd:sequence compositor
SchemaParticle parametersType = operationType.getContentModel();
- if (SchemaParticle.ELEMENT == parametersType.getParticleType()) {
- expectedInParams.add(parametersType.getName().getLocalPart());
- } else if (SchemaParticle.SEQUENCE ==
parametersType.getParticleType()) {
- SchemaParticle[] parameters =
parametersType.getParticleChildren();
- for (int i = 0; i < parameters.length; i++) {
-
expectedInParams.add(parameters[i].getName().getLocalPart());
- }
- }
+ // check if parameters are exist
+ if(parametersType != null) {
+ if (SchemaParticle.ELEMENT ==
parametersType.getParticleType()) {
+
expectedInParams.add(parametersType.getName().getLocalPart());
+ } else if (SchemaParticle.SEQUENCE ==
parametersType.getParticleType()) {
+ SchemaParticle[] parameters =
parametersType.getParticleChildren();
+ for (int i = 0; i < parameters.length; i++) {
+
expectedInParams.add(parameters[i].getName().getLocalPart());
+ }
+ }
+ }
if (!inParamNames.equals(expectedInParams)) {
throw new DeploymentException("Not all wrapper children were
mapped for operation name" + operationName);
}
@@ -297,14 +300,17 @@
// schemaType should be complex using xsd:sequence compositor
SchemaParticle parametersType = operationType.getContentModel();
- if (SchemaParticle.ELEMENT == parametersType.getParticleType()) {
- expectedOutParams.add(parametersType.getName().getLocalPart());
- } else if (SchemaParticle.SEQUENCE ==
parametersType.getParticleType()) {
- SchemaParticle[] parameters =
parametersType.getParticleChildren();
- for (int i = 0; i < parameters.length; i++) {
-
expectedOutParams.add(parameters[i].getName().getLocalPart());
- }
- }
+ // check result exists
+ if(parametersType != null) {
+ if (SchemaParticle.ELEMENT ==
parametersType.getParticleType()) {
+
expectedOutParams.add(parametersType.getName().getLocalPart());
+ } else if (SchemaParticle.SEQUENCE ==
parametersType.getParticleType()) {
+ SchemaParticle[] parameters =
parametersType.getParticleChildren();
+ for (int i = 0; i < parameters.length; i++) {
+
expectedOutParams.add(parameters[i].getName().getLocalPart());
+ }
+ }
+ }
if (!outParamNames.equals(expectedOutParams)) {
throw new DeploymentException("Not all wrapper children were
mapped to parameters or a return value for operation " + operationName);
}
Note that problem is that operationType.getContentModel() returns null if it
consists of one empty sequence. If check is added, everything works fine.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira