[
https://issues.apache.org/jira/browse/TUSCANY-3778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12933993#action_12933993
]
Simon Nash commented on TUSCANY-3778:
-------------------------------------
There's a small but significant difference between the code committed to 1.x
and the code comitted to 2.x to fix the exception namespace problem.
The 2.x fix changes the faultName variable to a QName in the WSDL definition's
namespace. This is fine when faultName is used as the QName of the WSDL
message for the fault. However it causes a problem when faultName is used
later as the QName for the wrapper, because this creates a wrapper for the
exception in the WSDL target namespace. This isn't consistent with the
namespace used for the generated reference to the wrapper in the message part
of the fault message.
This is probably best illustrated by an example. For the following Java
interface:
package jtest;
import org.osoa.sca.annotations.Remotable;
@Remotable
public interface TestService {
void throwException() throws Exception;
}
the current 2.x code generates the following WSDL. See the WSDL comments for
details of the problem.
<wsdl:definitions name="TestServiceService" targetNamespace="http://jtest/"
xmlns:ns4="http://lang.java/"
xmlns:tns="http://jtest/" 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"/> <!-- unchanged,
wrapper generated by JAXB in Java package namespace -->
<xs:complexType name="Exception"> <!-- unchanged, exception type
generated by JAXB in Java package namespace -->
<xs:sequence>
<xs:element minOccurs="0" name="message" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xs:schema targetNamespace="http://jtest/" version="1.0"
xmlns:ns0="http://lang.java/"
xmlns:tns="http://jtest/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://lang.java/"/>
<xs:element name="throwException">
<xs:complexType/>
</xs:element>
<xs:element name="throwExceptionResponse">
<xs:complexType/>
</xs:element>
<xs:element name="Exception" type="ns0:Exception"/> <!-- new problem,
wrapper generated by Tuscany in wrong namespace -->
</xs:schema>
</wsdl:types>
<wsdl:message name="throwException">
<wsdl:part name="throwException" element="tns:throwException">
</wsdl:part>
</wsdl:message>
<wsdl:message name="throwExceptionResponse">
<wsdl:part name="throwExceptionResponse"
element="tns:throwExceptionResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="Exception">
<wsdl:part name="Exception" element="ns4:Exception"> <!-- unchanged,
points to wrapper in Java package namespace -->
</wsdl:part>
</wsdl:message>
<wsdl:portType name="TestService">
<wsdl:operation name="throwException">
<wsdl:input message="tns:throwException">
</wsdl:input>
<wsdl:output message="tns:throwExceptionResponse">
</wsdl:output>
<wsdl:fault name="Exception" message="tns:Exception"> <!-- now fixed,
points to message in WSDL target namespace -->
</wsdl:fault>
</wsdl:operation>
</wsdl:portType>
....
</wsdl:definitions>
The 1.x fix doesn't have this problem because it leaves the faultName variable
as a QName in the Java package's namespace. This results in the following
generated WSDL:
<wsdl:definitions name="TestServiceService" targetNamespace="http://jtest/"
xmlns:ns4="http://lang.java/"
xmlns:tns="http://jtest/" 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"/> <!-- unchanged,
wrapper generated by JAXB in Java package namespace -->
<xs:complexType name="Exception"> <!-- unchanged, exception type
generated by JAXB in Java package namespace -->
<xs:sequence>
<xs:element minOccurs="0" name="message" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xs:schema targetNamespace="http://jtest/" version="1.0"
xmlns:ns0="http://lang.java/"
xmlns:tns="http://jtest/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://lang.java/"/>
<xs:element name="throwException">
<xs:complexType/>
</xs:element>
<xs:element name="throwExceptionResponse">
<xs:complexType/>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="throwException">
<wsdl:part name="throwException" element="tns:throwException">
</wsdl:part>
</wsdl:message>
<wsdl:message name="throwExceptionResponse">
<wsdl:part name="throwExceptionResponse"
element="tns:throwExceptionResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="Exception">
<wsdl:part name="Exception" element="ns4:Exception"> <!-- unchanged,
points to wrapper in Java package namespace -->
</wsdl:part>
</wsdl:message>
<wsdl:portType name="TestService">
<wsdl:operation name="throwException">
<wsdl:input message="tns:throwException">
</wsdl:input>
<wsdl:output message="tns:throwExceptionResponse">
</wsdl:output>
<wsdl:fault name="Exception" message="tns:Exception"> <!-- now fixed,
points to message in WSDL target namespace -->
</wsdl:fault>
</wsdl:operation>
</wsdl:portType>
....
</wsdl:definitions>
Note the lack of any generated wrapper in the WSDL target namespace.
> WSDLGen problem with byte[] and Exceptions in alternative namespaces
> --------------------------------------------------------------------
>
> Key: TUSCANY-3778
> URL: https://issues.apache.org/jira/browse/TUSCANY-3778
> Project: Tuscany
> Issue Type: Bug
> Components: Java SCA Axis Binding Extension
> Affects Versions: Java-SCA-1.6.1
> Environment: All
> Reporter: Simon Laws
> Assignee: Simon Nash
> Fix For: Java-SCA-1.x
>
>
> I've just extended the HelloWorldService interface in the itest/wsdlgen with
> two new remote methods to demonstrate two issues.
> 1/ byte[] getGreetingsByteArray(byte[] input);
> Leads to Tuscany generated types as follows:
> <xs:element name="getGreetingsByteArray">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0"
> name="arg0" nillable="true"
> type="xs:byte" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> While JAXWS wsgen produces
> <xs:complexType name="getGreetingsByteArray">
> <xs:sequence>
> <xs:element name="arg0" type="xs:base64Binary" nillable="true"
> minOccurs="0"/>
> </xs:sequence>
> </xs:complexType>
> 2/ String getGreetingsException(String input) throws HelloWorldException;
> When HelloWorldException is in a different package when compared to the
> service interface the wrong reference is generated in the WSDL
> <wsdl:operation name="getGreetingsException">
> <wsdl:input message="getGreetingsException">
> </wsdl:input>
> <wsdl:output message="getGreetingsExceptionResponse">
> </wsdl:output>
> <wsdl:fault name="HelloWorldException"
> message="ns4:HelloWorldException">
> </wsdl:fault>
> </wsdl:operation>
> The ns4 here is correct for the actual type but the "HelloWorldException"
> message is declared in the WSDL so is in the WSDL target namespace and not in
> the types target namespace.
> Interestingly JAXWS wsgen seems to generate the exception type into the same
> namespace as all of the other types even though it's in a separate package.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.