Pergunta

I'm creating a one-way operation in a WSDL that has several other working two-way (request/response) operations.

Code generation using wsdl2java via maven is failing with the following error:

[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:2.7.3:wsdl2java (default) on project mft-shared-ws: Execution default of goal org.apache.cxf:cxf-codegen-plugin:2.7.3:wsdl2java failed:
[ERROR] Summary:  Failures: 1, Warnings: 0
[ERROR] 
[ERROR] <<< ERROR!
[ERROR] file:/C:/workspace/.../ConfigMgr.wsdl:[270,7]
[ERROR] Caused by {http://mydomain.com/configmgr/ws}[portType:ConfigMgrPortType][operation:sendFileTransferEventNotification][input:fileTransferEventNotification] not exist.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.cxf:cxf-codegen-plugin:2.7.3:wsdl2java (default) on project mft-shared-ws: Execution default of goal org.apache.cxf:cxf-codegen-plugin:2.7.3:wsdl2java failed: 
 Summary:  Failures: 1, Warnings: 0

 <<< ERROR! 
file:/C:/workspace/.../ConfigMgr.wsdl:[270,7] 
 Caused by {http://mydomain.com/configmgr/ws}[portType:ConfigMgrPortType][operation:sendFileTransferEventNotification][input:fileTransferEventNotification] not exist.


    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal org.apache.cxf:cxf-codegen-plugin:2.7.3:wsdl2java failed: 
 Summary:  Failures: 1, Warnings: 0

 <<< ERROR! 
file:/C:/workspace/.../ConfigMgr.wsdl:[270,7] 
 Caused by {http://mydomain.com/configmgr/ws}[portType:ConfigMgrPortType][operation:sendFileTransferEventNotification][input:fileTransferEventNotification] not exist.


    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 25 more
Caused by: org.apache.cxf.tools.common.ToolException: 
 Summary:  Failures: 1, Warnings: 0

 <<< ERROR! 
file:/C:/workspace/.../ConfigMgr.wsdl:[270,7] 
 Caused by {http://mydomain.com/configmgr/ws}[portType:ConfigMgrPortType][operation:sendFileTransferEventNotification][input:fileTransferEventNotification] not exist.


    at org.apache.cxf.tools.validator.internal.WSDL11Validator.isValid(WSDL11Validator.java:139)
    at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.validate(JAXWSDefinitionBuilder.java:204)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:182)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:142)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:300)
    at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
    at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo.generate(WSDL2JavaMojo.java:427)
    at org.apache.cxf.maven_plugin.AbstractCodegenMoho.execute(AbstractCodegenMoho.java:308)
    at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo.execute(WSDL2JavaMojo.java:524)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    ... 26 more

The generation completes if I remove name attribute from the wsdl:input element. However, the server code implementation does not get triggered.

XSD:

...
<xsd:element name="FileTransferEventNotification" type="tns:FileTransferEvent"/>
<xsd:complexType name="FileTransferEvent">
  <xsd:sequence>
    <xsd:element name="success" type="xsd:boolean" />
    <xsd:element name="filename" type="xsd:string"/>
    <xsd:element name="fileSize" type="xsd:unsignedLong"/>
  </xsd:sequence>
</xsd:complexType>
...

WSDL:

  <wsdl:message name="fileTransferEventNotification">
    <wsdl:part name="fileTransferEventNotification" element="tns:FileTransferEventNotification" />
  </wsdl:message>

  ...

  <wsdl:portType name="ConfigMgrPortType">
    <wsdl:operation name="sendFileTransferEventNotification">
      <wsdl:input message="tns:fileTransferEventNotification" />
    </wsdl:operation>
    ...
  </wsdl:portType>

  ...

  <wsdl:binding name="ConfigMgrSoapBinding" type="tns:ConfigMgrPortType">
    <wsdl:operation name="sendFileTransferEventNotification">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="fileTransferEventNotification">
        <soap:body use="literal"/>
      </wsdl:input>
    </wsdl:operation>
    ...
  </wsdl:binding>

Any thoughts? Help is appreciated!

Foi útil?

Solução

It turns out the input message in the portType/operation needs a name attribute. This does not appear to be the case for request/response calls within the same WSDL.

WSDL:

  <wsdl:message name="fileTransferEventNotification">
    <wsdl:part name="fileTransferEventNotification" element="tns:FileTransferEventNotification" />
  </wsdl:message>

  ...

  <wsdl:portType name="ConfigMgrPortType">
    <wsdl:operation name="sendFileTransferEventNotification">
      <wsdl:input message="tns:fileTransferEventNotification" name="fileTransferEventNotification"/>
    </wsdl:operation>
    ...
  </wsdl:portType>

  ...

  <wsdl:binding name="ConfigMgrSoapBinding" type="tns:ConfigMgrPortType">
    <wsdl:operation name="sendFileTransferEventNotification">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="fileTransferEventNotification">
        <soap:body use="literal"/>
      </wsdl:input>
    </wsdl:operation>
    ...
  </wsdl:binding>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top