Hi,all

      I use tuscany sca (1.6.2) publish java bean to WebService with
binding.ws,  e.g. "<binding.ws uri="/ws/Test" />";

But this binding.ws auto generated WSDL is wrong format. (e.g.
http://localhost/xx/ws/Test?wsdl)

There has some ERROR when I use some WSDL2Java tools want to generate
client source with this wsdl file;
with some modification about this wsdl, the wsdl2java work ok.

Is this tuscany's BUG?

Can any body help me? or provide a solution?
I can't modify all wsdl manual, because I have so many Web Service
throught tuscany publish.


Thanks.


Those is my code:
-------------------------------------------------------------------

Interface:(so simple code)
-------------------------------------------------------------------
package com.shine.test;

import javax.jws.WebService;

@WebService
public interface TestWebCtrl {

    String testSingle(String str) throws Exception;
}


Composite config:
-------------------------------------------------------------------
<service name="TestWebCtrl">
      <binding.ws uri="/ws/Test" />
 </service>


This is tuscany generate wsdl:(http://127.0.0.1:8080/TestService/ws/Test?wsdl)
-------------------------------------------------------------------
<wsdl:definitions xmlns="http://test.shine.com/";
xmlns:ns4="http://lang.java/";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:SOAP11="http://schemas.xmlsoap.org/wsdl/soap/";
name="TestWebCtrlService" targetNamespace="http://test.shine.com/";>
<wsdl:types>
<xs:schema xmlns:tns="http://lang.java/";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
targetNamespace="http://lang.java/"; version="1.0">
<xs:element name="Exception" type="tns:Exception"/>
<xs:complexType name="Exception">
<xs:sequence>
<xs:element minOccurs="0" name="message" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xs:schema xmlns:tns="http://test.shine.com/";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
attributeFormDefault="qualified" elementFormDefault="unqualified"
targetNamespace="http://test.shine.com/";>
<xs:element name="testSingle">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="testSingleResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="testSingle">
<wsdl:part name="testSingle" element="testSingle"></wsdl:part>
</wsdl:message>
<wsdl:message name="Exception">
<wsdl:part name="Exception" element="ns4:Exception"></wsdl:part>
</wsdl:message>
<wsdl:message name="testSingleResponse">
<wsdl:part name="testSingleResponse" element="testSingleResponse"></wsdl:part>
</wsdl:message>
<wsdl:portType name="TestWebCtrl">
<wsdl:operation name="testSingle">
<wsdl:input message="testSingle"></wsdl:input>
<wsdl:output message="testSingleResponse"></wsdl:output>
<wsdl:fault name="Exception" message="ns4:Exception"></wsdl:fault>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TestWebCtrlBinding" type="TestWebCtrl">
<SOAP:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="testSingle">
<SOAP:operation/>
<wsdl:input>
<SOAP:body use="literal"/>
</wsdl:input>
<wsdl:output>
<SOAP:body use="literal"/>
</wsdl:output>
<wsdl:fault name="Exception">
<SOAP:fault name="Exception" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TestWebCtrlService">
<wsdl:port name="TestWebCtrlPort" binding="TestWebCtrlBinding">
<SOAP:address location="http://127.0.0.1:8080/TestService/ws/Test"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>


There is some error when use some wsdl2java tools

(e.g. jdk6's wsimport):
wsimport -keep -p test.client http://127.0.0.1:8080/TestService/ws/Test?wsdl
-------------------------------------------------------------------
parsing WSDL...


[ERROR] wsdl:message "{http://lang.java/}Exception"; not found in the
wsdl: http://127.0.0.1:8080/TestService/ws/Test?wsdl



(e.g. Tuscany generator):
org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator
http://127.0.0.1:8080/TestService/ws/Test?wsdl
-------------------------------------------------------------------
ERROR:
java.util.NoSuchElementException
        at java.util.HashMap$HashIterator.nextEntry(HashMap.java:796)
        at java.util.HashMap$ValueIterator.next(HashMap.java:822)
        at 
org.apache.tuscany.tools.wsdl2java.generate.JavaInterfaceGenerator.generateFaults(JavaInterfaceGenerator.java:265)
        at 
org.apache.tuscany.tools.wsdl2java.generate.JavaInterfaceGenerator.<init>(JavaInterfaceGenerator.java:111)
        at 
org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator.generateFromWSDL(WSDL2JavaGenerator.java:240)
        at 
org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator.main(WSDL2JavaGenerator.java:154)
Exception in thread "main" java.lang.IllegalArgumentException:
java.util.NoSuchElementException
        at 
org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator.generateFromWSDL(WSDL2JavaGenerator.java:248)
        at 
org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator.main(WSDL2JavaGenerator.java:154)
Caused by: java.util.NoSuchElementException
        at java.util.HashMap$HashIterator.nextEntry(HashMap.java:796)
        at java.util.HashMap$ValueIterator.next(HashMap.java:822)
        at 
org.apache.tuscany.tools.wsdl2java.generate.JavaInterfaceGenerator.generateFaults(JavaInterfaceGenerator.java:265)
        at 
org.apache.tuscany.tools.wsdl2java.generate.JavaInterfaceGenerator.<init>(JavaInterfaceGenerator.java:111)
        at 
org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator.generateFromWSDL(WSDL2JavaGenerator.java:240)
        ... 1 more




It look like the wsdl:portType/wsdl:fault.message has wrong
namespace,it shout be Exception without namespace ns4:
-------------------------------------------------------------------
<wsdl:portType name="TestWebCtrl">
<wsdl:operation name="testSingle">
<wsdl:input message="testSingle"></wsdl:input>
<wsdl:output message="testSingleResponse"></wsdl:output>
<wsdl:fault name="Exception" message="ns4:Exception"></wsdl:fault>
</wsdl:operation>
</wsdl:portType>


this is wsdl I have modified:(I have modified  [<wsdl:fault
name="Exception" message="ns4:Exception"></wsdl:fault>] to
[<wsdl:fault name="Exception" message="Exception"></wsdl:fault>]
-------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="TestWebCtrlService"
targetNamespace="http://test.shine.com/";
xmlns="http://test.shine.com/"; xmlns:ns4="http://lang.java/";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:SOAP11="http://schemas.xmlsoap.org/wsdl/soap/";>
  <wsdl:types>
    <xs:schema targetNamespace="http://lang.java/"; version="1.0"
xmlns:tns="http://lang.java/";
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
<xs:element name="Exception" type="tns:Exception"/>
<xs:complexType name="Exception"><xs:sequence><xs:element
minOccurs="0" name="message"
type="xs:string"/></xs:sequence></xs:complexType>
</xs:schema>
    <xs:schema attributeFormDefault="qualified"
elementFormDefault="unqualified"
targetNamespace="http://test.shine.com/";
xmlns:tns="http://test.shine.com/";
xmlns:xs="http://www.w3.org/2001/XMLSchema";><xs:element
name="testSingle"><xs:complexType><xs:sequence><xs:element
minOccurs="0" name="arg0" nillable="true"
type="xs:string"/></xs:sequence></xs:complexType></xs:element><xs:element
name="testSingleResponse"><xs:complexType><xs:sequence><xs:element
minOccurs="0" name="return" nillable="true"
type="xs:string"/></xs:sequence></xs:complexType></xs:element></xs:schema>
  </wsdl:types>
  <wsdl:message name="testSingle">
    <wsdl:part name="testSingle" element="testSingle">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="Exception">
    <wsdl:part name="Exception" element="ns4:Exception">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="testSingleResponse">
    <wsdl:part name="testSingleResponse" element="testSingleResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="TestWebCtrl">
    <wsdl:operation name="testSingle">
      <wsdl:input message="testSingle">
    </wsdl:input>
      <wsdl:output message="testSingleResponse">
    </wsdl:output>
      <wsdl:fault name="Exception" message="Exception">
    </wsdl:fault>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="TestWebCtrlBinding" type="TestWebCtrl">
    <SOAP:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="testSingle">
      <SOAP:operation/>
      <wsdl:input>
        <SOAP:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <SOAP:body use="literal"/>
      </wsdl:output>
      <wsdl:fault name="Exception">
        <SOAP:fault name="Exception" use="literal"/>
      </wsdl:fault>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="TestWebCtrlService">
    <wsdl:port name="TestWebCtrlPort" binding="TestWebCtrlBinding">
      <SOAP:address location="http://127.0.0.1:8080/TestService/ws/Test"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>


Generate again:
wsimport -keep -p test.client test.wsdl_ok.xml
-------------------------------------------------------------------
parsing WSDL...


generating code...


compiling code...


-------------------------------------------------------------------
It this a BUG? some suggestion???


-- 
Jet Knight

Reply via email to