2

我必须为给定的 wsdl 创建一个客户端...

<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:base="http://www.impresainungiorno.gov.it/schema/base" xmlns:bus="http://www.cnipa.it/schemas/2003/eGovIT/Busta1_0/" xmlns:eb="http://www.metaware.it/geofront2/estensioni_busta.xsd" xmlns:ns0="http://www.impresainungiorno.gov.it/schema/suap/ri/spc/ws" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:spc="http://www.impresainungiorno.gov.it/schema/suap/ri/spc" targetNamespace="http://www.impresainungiorno.gov.it/schema/suap/ri/spc/ws">
  <wsdl:types>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:pi="http://www.impresainungiorno.gov.it/schema/base" xmlns:ri="http://www.impresainungiorno.gov.it/schema/suap/ri/spc" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://www.impresainungiorno.gov.it/schema/suap/ri/spc" version="1.0.0" xmlns:spc="http://www.impresainungiorno.gov.it/schema/suap/ri/spc">
    <!--  
    -->
    <xs:import namespace="http://www.impresainungiorno.gov.it/schema/base"/>

........

    <xsd:element name="Intestazione">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="IntestazioneMessaggio"/>
                <xsd:element minOccurs="0" ref="ListaRiscontri"/>
                <xsd:element minOccurs="0" ref="ListaTrasmissioni"/>
                <xsd:element minOccurs="0" ref="ListaEccezioni"/>
            </xsd:sequence>
            <xsd:attribute fixed="http://www.cnipa.it/eGov_it/portadominio" ref="SOAP_ENV:actor" use="required"/>
            <xsd:attribute fixed="1" ref="SOAP_ENV:mustUnderstand" use="required"/>
        </xsd:complexType>
    </xsd:element>

........

我正在使用命令行中的axis2 1.6.2 wsdl2java 工具,但遇到以下错误:

Retrieving document at 'richiesta-iscrizione-impresa-RI.wsdl'.
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:293)
    at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
    at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(XMLBeansExtension.java:126)
    at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:246)
    ... 2 more
Caused by: java.lang.reflect.InvocationTargetException
    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.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(XMLBeansExtension.java:115)
    ... 3 more
Caused by: java.lang.RuntimeException: org.apache.xmlbeans.XmlException: error: src-resolve: attribute 'actor@http://schemas.xmlsoap.org/soap/envelope/' not found.
    at org.apache.axis2.xmlbeans.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:325)
    ... 8 more
Caused by: org.apache.xmlbeans.XmlException: error: src-resolve: attribute 'actor@http://schemas.xmlsoap.org/soap/envelope/' not found.
    at org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:225)
    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.apache.xmlbeans.XmlBeans.compileXmlBeans(XmlBeans.java:667)
    at org.apache.axis2.xmlbeans.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:189)
    ... 8 more

我检查了架构并且存在“演员”属性....

有什么问题?

谢谢

安德烈亚

4

2 回答 2

2

WSDL有不同的编码类型,例如 RPC/encoded、RPC/literal、Document/encoded、Document/literal。我认为您的 WSDL 正在使用 RPC/编码。Axis2 不直接支持 RPC/encoded 编码样式。

本文是关于在 Axis2 中使用 RPC/编码的 WSDL。我希望这将有所帮助。

于 2013-03-29T11:31:20.987 回答
1

轴 2 不支持rpc/编码风格的 web 服务。您将不得不使用轴 1

于 2016-11-21T21:32:46.867 回答