2016-08-29 9 views
0

axis2를 사용하여 wsdl에서 Java 코드를 생성하는 데 문제가 있습니다 (버전 1.6.2 및 1.7.3에서이 문제가 발생했습니다) : 이 도구 사용 (wsdl2java -uri % MY_WSDL_LOCATION % -d jaxbri) 내가 얻을 : 내가 사용하고Axis2 wsdl2java가 InvocationTargetException을 던졌습니다

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 

은 WSDL :

<?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> 

나는 같은 결과 윈도우 10, 윈도우 7 PC의에서이 작업을 시도했습니다.

답변

1

생성 된 클래스 이름에 이름 충돌이 있습니다. 당신은 당신이 오류를 볼 수 있습니다 wsimport를 실행하는 경우 :

[ERROR] A class/interface with the same name "ru.rg.ens.DayClosingResponse" is already in use. Use a class customization to resolve this conflict.

당신은 DayClosingResponse 에 DayClosingResponseType에서 결과 요소의 유형 이름을 변경하여 해결할 수

는 그래서 래퍼 요소와 충돌하지 않는 이름, 예. 다음을 포함합니다 :

<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> 
+0

문제가 해결되었습니다. –