You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Deepal Jayasinghe (JIRA)" <ji...@apache.org> on 2006/07/03 08:05:31 UTC

[jira] Resolved: (AXIS2-829) WSDL service builder fails to see service definition when it comes from an import

     [ http://issues.apache.org/jira/browse/AXIS2-829?page=all ]
     
Deepal Jayasinghe resolved AXIS2-829:
-------------------------------------

    Resolution: Fixed

fixed in current SVN

> WSDL service builder fails to see service definition when it comes from an import
> ---------------------------------------------------------------------------------
>
>          Key: AXIS2-829
>          URL: http://issues.apache.org/jira/browse/AXIS2-829
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: core
>     Versions: 1.0
>     Reporter: Marc Gagnon
>     Assignee: Deepal Jayasinghe
>  Attachments: WSDL11ToAxisServiceBuilder.patch, wsdl.zip
>
> When the service element of a WSDL is not in the first level file, there is an exception like this:
>     [java] Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL
>      [java] at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:94)
>      [java] at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
>      [java] at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
>      [java] Caused by: org.apache.axis2.AxisFault: No service element found in the WSDL; nested exception is:
>      [java] org.apache.axis2.AxisFault: No service element found in the WSDL
>      [java] at org.apache.axis2.description.WSDL2AxisServiceBuilder.populateService(WSDL2AxisServiceBuilder.java:243)
>      [java] at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:87)
> I am pretty sure the spec allows services definitions to be imported.
> The book from which I am learning web services has a specific example using this way of organizing WSDL (J2EE Web Services by Richard Monson-Haefel, page  136 : 5.2.4).
> So, assuming service definitions of imported WSDL should be visible, here is my patch:
> The reason for this problem is that the code in WSDL2AxisServiceBuilder method processImports does not recursively include the services in the current level's hash map:
> ...
>                             //add messages
>                             Map messagesMap = importedDef.getMessages();
>                             wsdl4JDefinition.getMessages().putAll(messagesMap);
>                             //add portypes
>                             Map porttypeMap = importedDef.getPortTypes();
>                             wsdl4JDefinition.getPortTypes().putAll(porttypeMap);
>                             //add bindings
>                             Map bindingMap = importedDef.getBindings();
>                             wsdl4JDefinition.getBindings().putAll(bindingMap);
> //------------------------------------------------------------------------------------------------
> // Must add services of imported definitions into current wsdl definitions.
> //-------------------------------------------------------------------------------------------------
>                         }
> ...
> I simply added:
> 						    //add services
> 						    Map serviceMap = importedDef.getServices();
> 						    wsdl4JDefinition.getServices().putAll(serviceMap);
> And it worked.
> I tested this using on the refactored version: WSDL11ToAxisServiceBuilder
> Here is the patch:
> Index: WSDL11ToAxisServiceBuilder.java
> ===================================================================
> --- WSDL11ToAxisServiceBuilder.java	(revision 415081)
> +++ WSDL11ToAxisServiceBuilder.java	(working copy)
> @@ -916,6 +916,9 @@
>                              Map bindingMap = importedDef.getBindings();
>                              wsdl4JDefinition.getBindings().putAll(bindingMap);
>  
> +				    //add services
> +				    Map serviceMap = importedDef.getServices();
> +				    wsdl4JDefinition.getServices().putAll(serviceMap);
>                          }
>  
>                      }

-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org