简体   繁体   中英

axis2 error creating java code from wsdl

i have to create a client for a given 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>

........

i'm using axis2 1.6.2 wsdl2java tool from comand line but i'm experiencing the following error:

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

I checked the schema and the "actor" attribute exists ....

What's the problem?

Thanks

andrea

There are different encoding types of WSDLs like RPC/encoded, RPC/literal, Document/encoded, Document/literal. I think your WSDL is using RPC/encoded. RPC/encoded encoding style is not supported directly by Axis2.

This article is about using RPC/encoded WSDLs with Axis2 . I hope this will help.

axis 2 does not support rpc/encoded style webservices. You will have to use axis 1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM