我必须为给定的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
我检查了架构,并且“actor”属性存在....
有什么问题?
由于
安德烈
答案 0 :(得分:1)
有不同的编码types of WSDLs,如RPC / encoded,RPC / literal,Document / encoded,Document / literal。我认为您的WSDL使用RPC / encoded。 Axis2不直接支持RPC /编码编码样式。
本文是关于使用RPC/encoded WSDLs with Axis2的。我希望这会有所帮助。
答案 1 :(得分:0)
轴2不支持 rpc / encoded 样式的webservices。您必须使用轴1