Reputation: 75
I'm having a problem with generating Java code from wsdl using axis2(tried this with versions 1.6.2 and 1.7.3): Using this tool(wsdl2java -uri %MY_WSDL_LOCATION% -d jaxbri), I get:
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:294)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:50)
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.JAXBRIExtension.engage(JAXBRIExtension.java:112)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:247)
... 2 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.axis2.wsdl.codegen.extension.JAXBRIExtension.engage(JAXBRIExtension.java:101)
... 3 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Unable to generate code using jaxbri
at org.apache.axis2.jaxbri.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:355)
... 8 more
Caused by: java.lang.RuntimeException: Unable to generate code using jaxbri
at org.apache.axis2.jaxbri.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:247)
... 8 more
the wsdl i'm using:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://rg.ru/ens" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" targetNamespace="http://site.ru/ens">
<types>
<s:schema elementFormDefault="qualified" targetNamespace="http://site.ru/ens">
<s:element name="GetGiftCardBalance">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" name="CardNumber" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetGiftCardBalanceResponse">
<s:complexType>
<s:sequence>
<s:element name="GetGiftCardBalanceResult" type="s0:Balance"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="Balance">
<s:sequence>
<s:element minOccurs="0" name="CardNumber" type="s:string"/>
<s:element minOccurs="0" name="Value" type="s:string"/>
<s:element minOccurs="0" name="Status" type="s0:Status"/>
</s:sequence>
</s:complexType>
<s:complexType name="Status">
<s:sequence>
<s:element minOccurs="0" name="code" type="s:long"/>
<s:element minOccurs="0" name="description">
<s:simpleType>
<s:restriction base="s:string">
<s:maxLength value="1000"/>
</s:restriction>
</s:simpleType>
</s:element>
<s:element minOccurs="0" name="type">
<s:simpleType>
<s:restriction base="s:string">
<s:enumeration value="PLAIN"/>
<s:enumeration value="HTML"/>
</s:restriction>
</s:simpleType>
</s:element>
</s:sequence>
</s:complexType>
<s:element name="dayClosing">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" name="day" type="s:date"/>
<s:element minOccurs="0" name="shop">
<s:simpleType>
<s:restriction base="s:string">
<s:maxLength value="2"/>
</s:restriction>
</s:simpleType>
</s:element>
<s:element minOccurs="0" name="cashbox" type="s:long"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="dayClosingResponse">
<s:complexType>
<s:sequence>
<s:element name="dayClosingResult" type="s0:DayClosingResponse"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="DayClosingResponse">
<s:sequence>
<s:element minOccurs="0" name="status" type="s0:Status"/>
<s:element minOccurs="0" name="operations" type="s0:ArrayOfItemsOperation"/>
</s:sequence>
</s:complexType>
<s:complexType name="ArrayOfItemsOperation">
<s:sequence>
<s:element maxOccurs="unbounded" minOccurs="0" name="Items" nillable="true" type="s0:Operation"/>
</s:sequence>
</s:complexType>
<s:complexType name="Operation">
<s:sequence>
<s:element minOccurs="0" name="eventStamp" type="s:dateTime"/>
<s:element minOccurs="0" name="card" type="s:string"/>
<s:element minOccurs="0" name="sum" type="s:long"/>
</s:sequence>
</s:complexType>
<s:element name="getGiftCardBalanceWithPIN">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" name="PINCode" type="s:string"/>
<s:element minOccurs="0" name="CardNumber" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="getGiftCardBalanceWithPINResponse">
<s:complexType>
<s:sequence>
<s:element name="getGiftCardBalanceWithPINResult" type="s0:Balance"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="purchase">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" name="card" type="s:string"/>
<s:element minOccurs="0" name="sum" type="s:long"/>
<s:element minOccurs="0" name="OrderNumber" type="s:string"/>
<s:element minOccurs="0" name="shop">
<s:simpleType>
<s:restriction base="s:string">
<s:maxLength value="2"/>
</s:restriction>
</s:simpleType>
</s:element>
<s:element minOccurs="0" name="cashbox" type="s:long"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="purchaseResponse">
<s:complexType>
<s:sequence>
<s:element name="purchaseResult" type="s0:Status"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</types>
<message name="GetGiftCardBalanceSoapIn">
<part name="parameters" element="s0:GetGiftCardBalance"/>
</message>
<message name="GetGiftCardBalanceSoapOut">
<part name="parameters" element="s0:GetGiftCardBalanceResponse"/>
</message>
<message name="dayClosingSoapIn">
<part name="parameters" element="s0:dayClosing"/>
</message>
<message name="dayClosingSoapOut">
<part name="parameters" element="s0:dayClosingResponse"/>
</message>
<message name="getGiftCardBalanceWithPINSoapIn">
<part name="parameters" element="s0:getGiftCardBalanceWithPIN"/>
</message>
<message name="getGiftCardBalanceWithPINSoapOut">
<part name="parameters" element="s0:getGiftCardBalanceWithPINResponse"/>
</message>
<message name="purchaseSoapIn">
<part name="parameters" element="s0:purchase"/>
</message>
<message name="purchaseSoapOut">
<part name="parameters" element="s0:purchaseResponse"/>
</message>
<portType name="ProcessingSoap">
<operation name="GetGiftCardBalance">
<input message="s0:GetGiftCardBalanceSoapIn"/>
<output message="s0:GetGiftCardBalanceSoapOut"/>
</operation>
<operation name="dayClosing">
<input message="s0:dayClosingSoapIn"/>
<output message="s0:dayClosingSoapOut"/>
</operation>
<operation name="getGiftCardBalanceWithPIN">
<input message="s0:getGiftCardBalanceWithPINSoapIn"/>
<output message="s0:getGiftCardBalanceWithPINSoapOut"/>
</operation>
<operation name="purchase">
<input message="s0:purchaseSoapIn"/>
<output message="s0:purchaseSoapOut"/>
</operation>
</portType>
<binding name="ProcessingSoap" type="s0:ProcessingSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="GetGiftCardBalance">
<soap:operation soapAction="http://site.ru/ens/giftcards.Processing.GetGiftCardBalance" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="dayClosing">
<soap:operation soapAction="http://site.ru/ens/giftcards.Processing.dayClosing" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="getGiftCardBalanceWithPIN">
<soap:operation soapAction="http://site.ru/ens/giftcards.Processing.getGiftCardBalanceWithPIN" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="purchase">
<soap:operation soapAction="http://site.ru/ens/giftcards.Processing.purchase" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="Processing">
<port name="ProcessingSoap" binding="s0:ProcessingSoap">
<soap:address location="http://ip:57772/csp/crm/giftcards.Processing.cls"/>
</port>
</service>
</definitions>
I've tried this on windows 10, windows 7 PC's with the same result.
Upvotes: 1
Views: 4704
Reputation: 5320
You have a name collision in the generated class names. If you run wsimport you'll see the error:
[ERROR] A class/interface with the same name "ru.rg.ens.DayClosingResponse" is already in use. Use a class customization to resolve this conflict.
You can fix by changing the type name of the result element from DayClosingResponse to DayClosingResponseType so it doesn't collide with the wrapper element name, e.g. with:
<s:element name="dayClosingResponse">
<s:complexType>
<s:sequence>
<s:element name="dayClosingResult" type="s0:DayClosingResponseType"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="DayClosingResponseType">
<s:sequence>
<s:element minOccurs="0" name="status" type="s0:Status"/>
<s:element minOccurs="0" name="operations" type="s0:ArrayOfItemsOperation"/>
</s:sequence>
</s:complexType>
Upvotes: 2