Clickatell SOAP wsdl到JAXB java类

11 java web-services

我正在尝试从Clickatell wsdl生成JAXB类:你可以在这里找到wsdl定义它非常大:http: //api.clickatell.com/soap/webservice.php?WSDL

当尝试从此Wsdl生成java类时,我收到以下错误:[错误] undefined简单或复杂类型'SOAP-ENC:Array'[ERROR] undefined attribute'SOAP-ENC:arrayType'

我希望有人可以帮助我.干杯,蒂姆

dan*_*ter 19

您的模式引用了类型SOAP-ENC:在模式xmlns中定义的数组:SOAP-ENC ="http://schemas.xmlsoap.org/soap/encoding/"但该模式不包含在wsdl中.

我有类似的问题,不得不使用目录告诉jaxb/xjc在哪里找到架构.

转到http://schemas.xmlsoap.org/soap/encoding/并另存为soapenc.xsd

然后创建包含以下内容的纯文本文件

PUBLIC "http://schemas.xmlsoap.org/soap/encoding/" "soapenc.xsd"
Run Code Online (Sandbox Code Playgroud)

然后将该文件作为目录文件传递给xjc


更新:如果你是maven,这就是它们如何挂在一起的方式.

将架构,soapenc.xsd和catalog.cat(纯文本文件)放在src/main/resources中

然后告诉jaxb插件将目录传递给xjc

<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <executions>
      <execution>
        <id>wsdl-generate</id>
        <configuration>
          <schemaIncludes>
            <include>*.wsdl</include>
          </schemaIncludes>
          <catalog>${project.basedir}/src/main/resources/catalog.cat</catalog>
        </configuration>
        <goals>
          <goal>generate</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
Run Code Online (Sandbox Code Playgroud)

  • Maven 解决方案对我不起作用。目录文件中的“soapenc.xsd”似乎被简单地忽略了。 (3认同)
  • 如果我添加soapenc.xsd,则 arrayType 错误消失,但它与其他类型冲突,例如:“positiveInteger”已定义。有任何想法吗? (2认同)

Tej*_*eni -1

JAXB 不支持 RPC/编码。使用JAX-RPC来解决这个问题。

  • 这与 JAXB 无关,这是 JAX-WS 问题 (3认同)