Scenarios
Bottom Up
A: Client Reference -> interface.java -> Databinding(JAXB) -> binding.sca -> binding.sca -> Databinding(JAXB) -> interface.java -> Service -> implementation.java(local)
B: Client Reference -> interface.java -> Databinding(JAXB) -> binding.sca -> binding.sca -> Databinding(JAXB) -> interface.java -> Service -> implementation.java(@Remotable)
C: Client Reference -> interface.java -> Databinding(JAXB) -> Databinding(Axiom) -> binding.ws -> binding.ws -> interface.java -> Databindng(Axiom) -> Databinding(JAXB) -> Service -> implementation.java(@Remotable)
D C/MTOM: Client Reference -> interface.wsdl java -> Databinding(JAXB) -> Databinding(Axiom) -> binding.ws -> SOAP/MTOM -> binding.ws -> interface.wsdl java -> Databindng(Axiom) -> Databinding(JAXB) -> Service -> implementation.java(@Remotable)
Top Down
ED: Client Reference -> interface.java wsdl (doc/lit/wrapped) -> Databinding(JAXB) -> Databinding(Axiom) -> binding.ws -> binding.ws -> interface.wsdl -> Databindng((doc/lit/wrapped) -> Databindng(Axiom) -> Databinding(JAXB) -> Service -> implementation.java(@Remotable)
F D/MTOM: Client Reference -> interface.wsdl (doc/lit/wrapped) -> Databinding(JAXB) -> Databinding(Axiom) -> binding.ws -> SOAP/MTOM -> binding.ws -> interface.java wsdl(doc/lit/wrapped) -> Databindng(Axiom) -> Databinding(JAXB) -> Service -> implementation.java(@Remotable)
Support
E: Reference -> interface.java -> Databinding(JAXB) -> Databinding(Axiom) -> binding.ws -> binding.ws -> interface.wsdl(doc/lit/wrapped) -> Databindng(Axiom) -> Databinding(JAXB) -> Service -> implementation.java(@Remotable)
F: Reference -> interface.wsdl(doc/lit/wrapped) -> Databinding(JAXB) -> Databinding(Axiom) -> binding.ws -> binding.ws -> interface.java -> Databindng(Axiom) -> Databinding(JAXB) -> Service -> implementation.java(@Remotable)
G: Reference -> interface.wsdl (doc/lit/bare) -> Databinding(JAXB) -> Databinding(Axiom) -> binding.ws -> binding.ws -> interface.wsdl(doc/lit/bare) -> Databindng(Axiom) -> Databinding(JAXB) -> Service -> implementation.java(@Remotable)
H: Reference -> interface.java -> Databinding(JAXB) -> Databinding(Axiom) -> binding.ws -> binding.ws -> interface.wsdl(doc/lit/bare) -> Databindng(Axiom) -> Databinding(JAXB) -> Service -> implementation.java(@Remotable)
I: Reference -> interface.wsdl(doc/lit/bare) -> Databinding(JAXB) -> Databinding(Axiom) -> binding.ws -> binding.ws -> interface.java -> Databindng(Axiom) -> Databinding(JAXB) -> Service -> implementation.java(@Remotable)
We should look at some binding.ws(portType), binding.ws(binding), binding.ws(port) scenarios also.
Support
Data Type | A | B | C | C ?wsdl | C/MTOM | D | D/MTOM | E | F | G | H | I | Notes | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PrimitiveTypes | ||||||||||||||||||||||||||||
Data Type | A | B | C doc/lit/wrapped | C doc/lit/bare | C ?wsdl | D | E | F | Notes | |||||||||||||||||||
PrimitiveTypes |
|
|
|
|
|
|
|
| ||||||||||||||||||||
boolean |
|
|
|
|
|
|
|
|
| |||||||||||||||||||
byte |
|
|
|
|
|
|
|
|
| |||||||||||||||||||
short |
|
|
|
|
|
|
|
|
| |||||||||||||||||||
int |
|
|
|
|
|
|
|
|
| |||||||||||||||||||
long |
|
|
|
|
|
|
|
|
| float |
|
|
|
|
|
|
|
|
| |||||||||
double boolean |
|
|
|
|
|
|
|
|
| Standard Types |
|
|
|
| ||||||||||||||
byte |
|
|
|
| java.lang.String |
|
|
|
|
|
|
|
|
| ||||||||||||||
short |
|
|
| java.math.BigInteger |
|
|
|
|
|
|
|
|
| |||||||||||||||
java.math.BigDecimal int |
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||||||||||
long |
|
|
| java.util.Calendar |
|
|
|
|
|
|
|
|
| |||||||||||||||
float |
|
|
| java.util.Date |
|
|
|
|
|
|
|
|
| |||||||||||||||
javax.xml.namespace.QName double |
|
|
|
|
|
|
|
|
| java.net.URI |
|
|
|
|
|
|
|
| ||||||||||
Standard Types |
|
|
| javax.xml.datatype.XMLGregorianCalendar |
|
|
|
|
|
|
|
|
|
|
|
| ||||||||||||
javax java.xml.datatype.Duration lang.String |
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||||||||||
java.lang.Object |
|
|
| math.BigInteger |
|
|
|
|
|
|
|
| |
|
|
|
| RuntimeException: no data binding for null | ||||||||||
java.awt.Image math.BigDecimal |
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||||||||||
javax java.activation.DataHandler util.Calendar |
|
|
|
|
| |
|
|
|
|
|
|
| |||||||||||||||
javax java.xml.transform.Source |
|
|
| util.Date |
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||||||
RuntimeException: no data binding for javax.xml.transformnamespace.Source javaQName | .util.UUID |
|
|
|
|
|
|
|
|
| Arrays |
|
|
|
|
|
|
|
| |||||||||
java.net.URI |
|
|
|
| boolean |
|
|
|
|
|
|
|
| byte | ||||||||||||||
javax.xml.datatype.XMLGregorianCalendar |
|
|
|
|
|
|
|
|
|
|
| short |
| |
| |
|
|
| int | ||||||||
javax.xml.datatype.Duration |
|
|
|
|
|
|
|
| long |
|
|
|
|
|
|
| float | |||||||||||
java.lang.Object |
|
|
|
|
|
|
|
| double |
|
|
|
|
|
|
|
|
| ||||||||||
java.lang.Stringawt.Image |
|
|
|
|
|
|
|
| |
|
|
|
| |||||||||||||||
java javax.mathactivation.BigIntegerDataHandler |
|
|
|
|
|
|
|
| java.math.BigDecimal |
|
|
|
|
|
|
|
| |||||||||||
java javax.xml.utiltransform.CalendarSource |
|
|
|
|
|
|
|
|
|
|
|
| TUSCANY-2387 | |||||||||||||||
java.util.DateUUID |
|
|
|
|
|
|
|
|
| javax.xml.namespace.QName |
|
|
|
|
|
|
| |||||||||||
Arrays |
|
|
| java.net.URI |
|
|
|
|
|
|
|
|
|
|
|
| ||||||||||||
boolean |
|
|
| javax.xml.datatype.XMLGregorianCalendar |
|
|
|
|
|
|
|
|
| |||||||||||||||
javax.xml.datatype.Duration byte |
|
|
|
|
|
|
|
|
|
|
|
| java.lang.Object |
|
| A byte[] must map to xs:base64Binary by default | ||||||||||||
short |
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||||||||||
int |
|
| RuntimeException: no data binding for null |
|
| java.awt.Image |
|
|
|
|
|
|
|
|
| |||||||||||||
long |
|
|
| javax.activation.DataHandler |
|
|
|
|
|
|
|
|
| javax.xml.transform.Source |
|
| ||||||||||||
float |
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||||||||||
double |
|
|
|
|
| RuntimeException: no data binding for javax.xml.transform.Source | java.util.UUID |
|
|
|
|
|
|
|
|
| ||||||||||||
java.lang.String |
|
|
|
|
|
|
| | Collections |
|
|
|
|
|
|
|
| |||||||||||
java.math.BigInteger |
|
|
| List<String>, ArrayList<String> |
|
|
|
|
|
|
|
|
| Map<String, String>, HashMap<String, String> | ||||||||||||||
java.math.BigDecimal |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Tests are commented out!! |
|
|
|
|
|
|
|
|
|
|
java.util.Calendar |
|
|
|
|
|
|
| |
| Polymorphic Types |
|
|
|
|
|
|
|
| ||||||||||
|
|
|
|
|
|
|
|
|
| |||||||||||||||||||
java.util.Date |
|
|
|
|
|
|
|
|
|
| Parameterized Types |
|
|
| ||||||||||||||
javax.xml.namespace.QName |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||||
java.net.URI |
|
|
|
|
|
|
|
| Exceptions |
|
|
|
| |||||||||||||||
javax.xml.datatype.XMLGregorianCalendar |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The following are notes to give more detail of the scenarios and data types.
WSDL
see http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/
JAXWS2.1 describes the supported mappings and the restrictions these place on the Java interfaces.
- Docuement Wrapped
- Document Bare (The java method basically one in and one out parameter)
- RPC
A Service
Code Block |
---|
public interface HelloWorldService {
public String getGreetings(String firstName, String lastName);
}
|
doc / lit / wrapped (The only one supported in Tuscany)
WSDL
javax.xml.datatype.Duration |
|
|
|
|
|
|
|
| |
|
|
|
|
java.lang.Object |
|
|
|
|
|
|
|
|
|
|
|
| |
java.awt.Image |
|
|
|
|
|
|
|
|
|
|
|
|
|
javax.activation.DataHandler |
|
|
|
|
|
|
|
|
|
|
|
|
|
javax.xml.transform.Source |
|
|
|
|
|
|
|
|
|
|
|
| TUSCANY-2386, TUSCANY-2387, TUSCANY-2452 |
java.util.UUID |
|
|
|
|
|
|
|
|
|
|
|
|
|
Collections |
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String>, ArrayList<String> |
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String>, HashMap<String, String> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Polymorphic Types |
|
|
|
|
|
|
|
|
|
|
|
|
|
Case1: Bean3 extends Bean2 |
|
|
|
|
|
|
|
|
|
|
|
| Unmarshalls to Bean2 always. |
Parameterized Types |
|
|
|
|
|
|
|
|
|
|
|
|
|
TypeExplicit |
|
|
|
|
|
|
|
|
|
|
|
|
|
TypeUnbound |
|
|
|
|
|
|
|
|
|
|
|
| Unmarshalls to Object[] always. |
TypeExtends |
|
|
|
|
|
|
|
|
|
|
|
| Unmarshalls to Bean2 always. |
RecursiveTypeBound |
|
|
|
|
|
|
|
|
|
|
|
| Unmarshalls to Bean1<String> always. |
WildcardUnbound |
|
|
|
|
|
|
|
|
|
|
|
|
|
WildcardSuper |
|
|
|
|
|
|
|
|
|
|
|
|
|
WildcardExtends |
|
|
|
|
|
|
|
|
|
|
|
| Unmarshalls to Bean2 always. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Variable Arguments |
|
|
|
|
|
|
|
|
|
|
|
|
|
String... |
|
|
|
|
|
|
|
|
|
|
|
|
|
Exceptions |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The following are note to give more detail of the scenarios and data types.
WSDL
see http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/
JAXWS2.1 describes the supported mappings and the restrictions these place on the Java interfaces.
- Docuement Wrapped
- Document Bare (The java method basically one in and one out parameter)
- RPC
doc / lit / wrapped (The only one supported in Tuscany)
Java
Code Block |
---|
public interface HelloWorldService {
public String getGreetings(String firstName, String lastName);
}
|
WSDL
Code Block |
---|
<wsdl:types> |
Code Block |
<wsdl:types> <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema"> <element name="getGreetings"> <complexType> <sequence> <element name="firstName" type="xsd:string"/> <element name="lastName" type="xsd:string"/> </sequence> </complexType> </element> <element name="getGreetingsResponse"> <complexType> <sequence> <element name="getGreetingsReturn" type="xsd:string"/> </sequence> </complexType> </element> </schema> </wsdl:types> <wsdl:message name="getGreetingsRequest"> <wsdl:part element="tns:getGreetings" name="parameters"/> </wsdl:message> <wsdl:message name="getGreetingsResponse"> <wsdl:part element="tns:getGreetingsResponse" name="parameters"/> </wsdl:message> <wsdl:portType name="HelloWorld"> <wsdl:operation name="getGreetings"> <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/> <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld"> <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="getGreetings"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="getGreetingsRequest"> <wsdlsoap:body use="literal"/> <schema elementFormDefault="qualified" </wsdl:input>targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema"> <wsdl:output<element name="getGreetingsResponsegetGreetings"> <wsdlsoap:body use="literal"/> <complexType> </wsdl:output> <sequence> </wsdl:operation> </wsdl:binding> |
SOAP
Code Block |
---|
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<ns1:getGreetingsxmlns:ns1="http://helloworld">
<ns1:firstName>fred</ns1:firstName>
<ns1:secondNameName>bloggs</ns1:secondName>
</ns1:getGreetings>
</Body>
</Envelope>
|
doc / lit / bare (unwrapped) wsdl
There is some support but we need to find the tests
rpc / literal
We don't support this in Tuscany
rpc / encoded
Not supported by base
Not WS-I compliant
in/out, out params & Holders
Excluded by SCA
Discussed in JAXWS
There is a JIRA http://issues.apache.org/jira/browse/TUSCANY-2332
Namespaces
What do we need to say about this?
XSD (JAXB)
Am assuming as JAXB 2.1 (6)
Java (JAXB)
Primitive Types
As JAXB 2.1 (8.5.1)
Code Block |
---|
boolean
byte
short
int
long
float
double
|
Standard Types
As JAXB 2.1 (8.5.2)
Code Block |
---|
java.lang.String
java.math.BigInteger
java.math.BigDecimal
java.util.Calendar
java.util.Date
javax.xml.namespace.QName
java.net.URI
javax.xml.datatype.XMLGregorianCalendar
javax.xml.datatype.Duration
java.lang.Object
java.awt.Image
javax.activation.DataHandler
javax.xml.transform.Source
java.util.UUID
|
Parameterized Types/Generics
As JAXB (8.5.3)
XSD generated using wsgen
Some beans
Code Block |
---|
class Bean1<T> {
T item;
}
<xs:complexType name="bean1">
<xs:sequence>
<xs:element name="item" type="xs:anyType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
|
Code Block |
---|
class Bean2 {
String name
}
<xs:complexType name="bean2">
<xs:sequence>
<xs:element name="name" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
|
Code Block |
---|
class Bean3 extends Bean2{
String address
}
|
Code Block |
---|
class Bean4<T extends Bean2> {
T aType;
}
|
Code Block |
---|
class Bean5 extends Bean1<String>{
}
|
Code Block |
---|
class Bean6<T extends Bean5<String>> {
T aType;
}
|
Method with explicit type -> type
Code Block |
---|
Bean1<String> someMethodTypeExplicit(Bean1<String>)
|
Code Block |
---|
<xs:complexType name="someMethodTypeExplicit">
<xs:sequence>
<xs:element name="arg0" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="someMethodTypeExplicitResponse">
<xs:sequence>
<xs:element name="return" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="someMethodTypeExplicit" type="tns:someMethodTypeExplicit"/>
<xs:element name="someMethodTypeExplicitResponse" type="tns:someMethodTypeExplicitResponse"/>
<message name="someMethodTypeExplicit">
<part name="parameters" element="tns:someMethodTypeExplicit"/>
</message>
<message name="someMethodTypeExplicitResponse">
<part name="parameters" element="tns:someMethodTypeExplicitResponse"/>
</message>
|
Method without type bound -> any
Code Block |
---|
<T> Bean1<T> someMethodTypeUnbound(T[] anArray)
|
Code Block |
---|
<xs:complexType name="someMethodTypeUnbound">
<xs:sequence>
<xs:element name="arg0" type="xs:anyType" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="someMethodTypeUnboundResponse">
<xs:sequence>
<xs:element name="return" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="someMethodTypeUnbound" type="tns:someMethodTypeUnbound"/>
<xs:element name="someMethodTypeUnboundResponse" type="tns:someMethodTypeUnboundResponse"/>
<message name="someMethodTypeUnbound">
<part name="parameters" element="tns:someMethodTypeUnbound"/>
</message>
<message name="someMethodTypeUnboundResponse">
<part name="parameters" element="tns:someMethodTypeUnboundResponse"/>
</message>
|
Method with type extends -> type
Code Block |
---|
<T extends Bean2> Bean1<T> someMethodTypeExtends(T[] anArray)
|
<element name="firstName" type="xsd:string"/>
<element name="lastName" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="getGreetingsResponse">
<complexType>
<sequence>
<element name="getGreetingsReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="getGreetingsRequest">
<wsdl:part element="tns:getGreetings" name="parameters"/>
</wsdl:message>
<wsdl:message name="getGreetingsResponse">
<wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="HelloWorld">
<wsdl:operation name="getGreetings">
<wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
<wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getGreetings">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getGreetingsRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getGreetingsResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
|
SOAP
Code Block |
---|
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<ns1:getGreetingsxmlns:ns1="http://helloworld">
<ns1:firstName>fred</ns1:firstName>
<ns1:secondNameName>bloggs</ns1:secondName>
</ns1:getGreetings>
</Body>
</Envelope>
|
doc / lit / bare (unwrapped) wsdl
There is some support but we need to find the tests
Java
Code Block |
---|
public interface HelloWorldService {
public String getGreetings(String firstName, String lastName);
}
|
WSDL
Code Block |
---|
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
<complexType name="NameType">
<sequence>
<element name="firstName" type="xsd:string"/>
<element name="lastName" type="xsd:string"/>
</sequence>
</complexType>
<element name="getGreetings" type="tns:NameType"/>
<element name="getGreetingsResponse" type="xsd:string"/>
</schema>
</wsdl:types>
<wsdl:message name="getGreetingsRequest">
<wsdl:part element="tns:getGreetings" name="parameters |
Code Block |
<xs:complexType name="someMethodTypeExtends"> <xs:sequence> <xs:element name="arg0" type="tns:bean2" nillable="true" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <xs:complexType name="someMethodTypeExtendsResponse"> <xs:sequence> <xs:element name="return" type="tns:bean1" minOccurs="0"/> </xswsdl:sequence>message> </xs:complexType> <xs<wsdl:elementmessage name="someMethodTypeExtends" typegetGreetingsResponse"> <wsdl:part element="tns:someMethodTypeExtends"getGreetingsResponse" name="parameters"/> <xs:element name="someMethodTypeExtendsResponse" type="tns:someMethodTypeExtendsResponse"/> </wsdl:message> <message <wsdl:portType name="someMethodTypeExtendsHelloWorld"> <part <wsdl:operation name="parameters" element="tns:someMethodTypeExtends"/getGreetings"> </message> <message name="someMethodTypeExtendsResponse"> <part<wsdl:input namemessage="parameterstns:getGreetingsRequest" elementname="tns:someMethodTypeExtendsResponsegetGreetingsRequest"/> </message> |
Method with type super -> type
Code Block |
---|
NOT SURE THIS IS VALID
<T super Bean3> Bean1<T> someMethodTypeSuper(T[] anArray)
|
Type variable with recursive type extends-> type
Code Block |
---|
<T extends Bean1<String>> Bean1<T> someMethodRecursiveTypeBound(T[] anArray)
|
Code Block |
---|
<xs:complexType name="someMethodRecursiveTypeBound" <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/> <xs:sequence> <xs:element</wsdl:operation> </wsdl:portType> <wsdl:binding name="arg0HelloWorldSoapBinding" type="tns:bean1" nillable="true" minOccurs="0" maxOccurs="unboundedHelloWorld"> <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> </xs:sequence> </xs:complexType> <xs<wsdl:complexTypeoperation name="someMethodRecursiveTypeBoundResponsegetGreetings"> <xs:sequence> <xs:element name="return" type="tns:bean1" minOccurs="0 <wsdlsoap:operation soapAction=""/> </xs:sequence> </xs:complexType> <xs:element <wsdl:input name="someMethodRecursiveTypeBound" type="tns:someMethodRecursiveTypeBound"/> <xs:element name="someMethodRecursiveTypeBoundResponse" type="tns:someMethodRecursiveTypeBoundResponse"/> <message name="someMethodRecursiveTypeBound"> getGreetingsRequest"> <part name="parameters" element="tns:someMethodRecursiveTypeBound <wsdlsoap:body use="literal"/> </message> <message name="someMethodRecursiveTypeBoundResponse"> <part name="parameters" element="tns:someMethodRecursiveTypeBoundResponse"/> </message> |
Wildcard without bounds -> any
Code Block |
---|
Bean1<?> someMethodWildcardUnbound(Bean1<?>)
|
Code Block |
---|
<xs:complexType </wsdl:input> <wsdl:output name="someMethodWildcardUnboundgetGreetingsResponse"> <xs:sequence> <xs:element name="arg0" type="tns:bean1" minOccurs="0 <wsdlsoap:body use="literal"/> </xs:sequence> </xs:complexType> <xs:complexType name="someMethodWildcardUnboundResponse"> <xs:sequence></wsdl:output> <xs:element name="return" type="tns:bean1" minOccurs="0"/> </wsdl:operation> </xswsdl:sequence> </xs:complexType> <xs:element name="someMethodWildcardUnbound" type="tns:someMethodWildcardUnbound"/> <xs:element name="someMethodWildcardUnboundResponse" type="tns:someMethodWildcardUnboundResponse"/> <message name="someMethodWildcardUnbound"> <part name="parameters" element="tns:someMethodWildcardUnbound"/> </message> <message name="someMethodWildcardUnboundResponse"> <part name="parameters" element="tns:someMethodWildcardUnboundResponse"/> </message> |
Wildcard with super type -> any
Code Block |
---|
Bean1<? super Bean3> someMethodWildcardSuper(Bean1<? super Bean3>)
|
Code Block |
---|
<xs:complexType name="someMethodWildcardSuper">
<xs:sequence>
<xs:element name="arg0" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="someMethodWildcardSuperResponse">
<xs:sequence>
<xs:element name="return" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="someMethodWildcardSuper" type="tns:someMethodWildcardSuper"/>
<xs:element name="someMethodWildcardSuperResponse" type="tns:someMethodWildcardSuperResponse"/>
<message name="someMethodWildcardSuper">
<part name="parameters" element="tns:someMethodWildcardSuper"/>
</message>
<message name="someMethodWildcardSuperResponse">
<part name="parameters" element="tns:someMethodWildcardSuperResponse"/>
</message>
|
Wildcard with extends type -> type
Code Block |
---|
Bean1<? extends Bean2> someMethodWildcardExtends(Bean1<? extends Bean2>)
|
Code Block |
---|
<xs:complexType name="someMethodWildcardExtends">
<xs:sequence>
<xs:element name="arg0" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="someMethodWildcardExtendsResponse">
<xs:sequence>
<xs:element name="return" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="someMethodWildcardExtends" type="tns:someMethodWildcardExtends"/>
<xs:element name="someMethodWildcardExtendsResponse" type="tns:someMethodWildcardExtendsResponse"/>
<message name="someMethodWildcardExtends">
<part name="parameters" element="tns:someMethodWildcardExtends"/>
</message>
<message name="someMethodWildcardExtendsResponse">
<part name="parameters" element="tns:someMethodWildcardExtendsResponse"/>
</message>
|
Collections
As JAXB 2.1 (8.5.4)
- java.util.Map and its subtypes
Code Block HashMap<String, Bean> someMethod(HashMap<String, Bean> aList)
- java.util.Collection and its subtypes
Code Block List<String> someMethod(List<String> aList)
- Arrays
Code Block String[] someMethod (String[], String[]) Bean1[1] someMethod(Bean1[], Bean1[])
- Java Bean Indexed properties (effectively arrays)
Polymorphic Types
xsi:type
Code Block |
---|
class Bean2 {
}
class Bean3 extends Bean2 {
}
Bean2 someMethod(Bean2)
ref.someMethod(Bean3)
|
Variable Arguments
binding>
|
SOAP
Needs checking.
Code Block |
---|
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<ns1:getGreetingsxmlns:ns1="http://helloworld">
<ns1:firstName>fred</ns1:firstName>
<ns1:secondNameName>bloggs</ns1:secondName>
</ns1:getGreetings>
</Body>
</Envelope>
|
rpc / literal
We don't support this in Tuscany
rpc / encoded
We don't support this in Tuscany
Not WS-I compliant
in/out, out params & Holders
Excluded by SCA
Discussed in JAXWS
There is a JIRA http://issues.apache.org/jira/browse/TUSCANY-2332
Namespaces
What do we need to say about this?
XSD (JAXB)
Am assuming as JAXB 2.1 (6)
Java (JAXB)
Primitive Types
As JAXB 2.1 (8.5.1)
Code Block |
---|
boolean
byte
short
int
long
float
double
|
Standard Types
As JAXB 2.1 (8.5.2)
Code Block |
---|
java.lang.String
java.math.BigInteger
java.math.BigDecimal
java.util.Calendar
java.util.Date
javax.xml.namespace.QName
java.net.URI
javax.xml.datatype.XMLGregorianCalendar
javax.xml.datatype.Duration
java.lang.Object
java.awt.Image
javax.activation.DataHandler
javax.xml.transform.Source
java.util.UUID
|
Parameterized Types/Generics
As JAXB (8.5.3)
XSD generated using wsgen
Some beans
Code Block |
---|
class Bean1<T> {
T item;
}
<xs:complexType name="bean1">
<xs:sequence>
<xs:element name="item" type="xs:anyType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
|
Code Block |
---|
class Bean2 {
String name
}
<xs:complexType name="bean2">
<xs:sequence>
<xs:element name="name" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
|
Code Block |
---|
class Bean3 extends Bean2{
String address
}
|
Code Block |
---|
class Bean4<T extends Bean2> {
T aType;
}
|
Code Block |
---|
class Bean5 extends Bean1<String>{
}
|
Code Block |
---|
class Bean6<T extends Bean5<String>> {
T aType;
}
|
Method with explicit type -> type
Code Block |
---|
Bean1<String> someMethodTypeExplicit(Bean1<String>)
|
Code Block |
---|
<xs:complexType name="someMethodTypeExplicit">
<xs:sequence>
<xs:element name="arg0" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="someMethodTypeExplicitResponse">
<xs:sequence>
<xs:element name="return" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="someMethodTypeExplicit" type="tns:someMethodTypeExplicit"/>
<xs:element name="someMethodTypeExplicitResponse" type="tns:someMethodTypeExplicitResponse"/>
<message name="someMethodTypeExplicit">
<part name="parameters" element="tns:someMethodTypeExplicit"/>
</message>
<message name="someMethodTypeExplicitResponse">
<part name="parameters" element="tns:someMethodTypeExplicitResponse"/>
</message>
|
Method without type bound -> any
Code Block |
---|
<T> Bean1<T> someMethodTypeUnbound(T[] anArray)
|
Code Block |
---|
<xs:complexType name="someMethodTypeUnbound">
<xs:sequence>
<xs:element name="arg0" type="xs:anyType" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="someMethodTypeUnboundResponse">
<xs:sequence>
<xs:element name="return" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="someMethodTypeUnbound" type="tns:someMethodTypeUnbound"/>
<xs:element name="someMethodTypeUnboundResponse" type="tns:someMethodTypeUnboundResponse"/>
<message name="someMethodTypeUnbound">
<part name="parameters" element="tns:someMethodTypeUnbound"/>
</message>
<message name="someMethodTypeUnboundResponse">
<part name="parameters" element="tns:someMethodTypeUnboundResponse"/>
</message>
|
Method with type extends -> type
Code Block |
---|
<T extends Bean2> Bean1<T> someMethodTypeExtends(T[] anArray)
|
Code Block |
---|
<xs:complexType name="someMethodTypeExtends">
<xs:sequence>
<xs:element name="arg0" type="tns:bean2" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="someMethodTypeExtendsResponse">
<xs:sequence>
<xs:element name="return" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="someMethodTypeExtends" type="tns:someMethodTypeExtends"/>
<xs:element name="someMethodTypeExtendsResponse" type="tns:someMethodTypeExtendsResponse"/>
<message name="someMethodTypeExtends">
<part name="parameters" element="tns:someMethodTypeExtends"/>
</message>
<message name="someMethodTypeExtendsResponse">
<part name="parameters" element="tns:someMethodTypeExtendsResponse"/>
</message>
|
Method with type super -> type
Code Block |
---|
NOT SURE THIS IS VALID
<T super Bean3> Bean1<T> someMethodTypeSuper(T[] anArray)
|
This is not a valid construct.
Type variable with recursive type extends-> type
Code Block |
---|
<T extends Bean1<String>> Bean1<T> someMethodRecursiveTypeBound(T[] anArray)
|
Code Block |
---|
<xs:complexType name="someMethodRecursiveTypeBound">
<xs:sequence>
<xs:element name="arg0" type="tns:bean1" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="someMethodRecursiveTypeBoundResponse">
<xs:sequence>
<xs:element name="return" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="someMethodRecursiveTypeBound" type="tns:someMethodRecursiveTypeBound"/>
<xs:element name="someMethodRecursiveTypeBoundResponse" type="tns:someMethodRecursiveTypeBoundResponse"/>
<message name="someMethodRecursiveTypeBound">
<part name="parameters" element="tns:someMethodRecursiveTypeBound"/>
</message>
<message name="someMethodRecursiveTypeBoundResponse">
<part name="parameters" element="tns:someMethodRecursiveTypeBoundResponse"/>
</message>
|
Wildcard without bounds -> any
Code Block |
---|
Bean1<?> someMethodWildcardUnbound(Bean1<?>)
|
Code Block |
---|
<xs:complexType name="someMethodWildcardUnbound">
<xs:sequence>
<xs:element name="arg0" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="someMethodWildcardUnboundResponse">
<xs:sequence>
<xs:element name="return" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="someMethodWildcardUnbound" type="tns:someMethodWildcardUnbound"/>
<xs:element name="someMethodWildcardUnboundResponse" type="tns:someMethodWildcardUnboundResponse"/>
<message name="someMethodWildcardUnbound">
<part name="parameters" element="tns:someMethodWildcardUnbound"/>
</message>
<message name="someMethodWildcardUnboundResponse">
<part name="parameters" element="tns:someMethodWildcardUnboundResponse"/>
</message>
|
Wildcard with super type -> any
Code Block |
---|
Bean1<? super Bean3> someMethodWildcardSuper(Bean1<? super Bean3>)
|
Code Block |
---|
<xs:complexType name="someMethodWildcardSuper">
<xs:sequence>
<xs:element name="arg0" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="someMethodWildcardSuperResponse">
<xs:sequence>
<xs:element name="return" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="someMethodWildcardSuper" type="tns:someMethodWildcardSuper"/>
<xs:element name="someMethodWildcardSuperResponse" type="tns:someMethodWildcardSuperResponse"/>
<message name="someMethodWildcardSuper">
<part name="parameters" element="tns:someMethodWildcardSuper"/>
</message>
<message name="someMethodWildcardSuperResponse">
<part name="parameters" element="tns:someMethodWildcardSuperResponse"/>
</message>
|
Wildcard with extends type -> type
Code Block |
---|
Bean1<? extends Bean2> someMethodWildcardExtends(Bean1<? extends Bean2>)
|
Code Block |
---|
<xs:complexType name="someMethodWildcardExtends">
<xs:sequence>
<xs:element name="arg0" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="someMethodWildcardExtendsResponse">
<xs:sequence>
<xs:element name="return" type="tns:bean1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="someMethodWildcardExtends" type="tns:someMethodWildcardExtends"/>
<xs:element name="someMethodWildcardExtendsResponse" type="tns:someMethodWildcardExtendsResponse"/>
<message name="someMethodWildcardExtends">
<part name="parameters" element="tns:someMethodWildcardExtends"/>
</message>
<message name="someMethodWildcardExtendsResponse">
<part name="parameters" element="tns:someMethodWildcardExtendsResponse"/>
</message>
|
Collections
As JAXB 2.1 (8.5.4)
- java.util.Map and its subtypes
Code Block HashMap<String, Bean> someMethod(HashMap<String, Bean> aList)
- java.util.Collection and its subtypes
Code Block List<String> someMethod(List<String> aList)
- Arrays
Code Block String[] someMethod (String[], String[]) Bean1[1] someMethod(Bean1[], Bean1[])
- Java Bean Indexed properties (effectively arrays)
Polymorphic Types
xsi:type
Case 1:
Code Block |
---|
class Bean2 {
}
class Bean3 extends Bean2 {
}
Bean2 someMethod(Bean2)
ref.someMethod(Bean3)
|
Variable Arguments
Code Block |
---|
String someMethod(String... params)
|
Business Exceptions/Faults
Anchor | ||||
---|---|---|---|---|
|
This section describes Tuscany's Java<-->WSDL mapping for business exceptions on remotable interfaces.
Top-Down (start with WSDL fault)
Start with a WSDL portType, with a fault message defined in terms of a fault elem and generate the Java from that. If you use a tool like wsimport which you'll get a generated Java exception wrappering a fault in the JAX-WS Sec. 2.5 pattern. That's it. The top-down case is a lot simpler.
Start From WSDL
Code Block |
---|
<wsdl:types>
...
<element name="errorCode" type="xsd:int"/>
...
</wsdl:types>
<wsdl:message name="BadInputMsg">
<wsdl:part element="tns:errorCode" name="parameters"/>
</wsdl:message>
<wsdl:portType name="GuessAndGreet">
<wsdl:operation name="sendGuessAndName">
<wsdl:input.../>
<wsdl:fault message="tns:BadInputMsg" name="BadInputMsg"/>
...
|
Now generate Java (e.g. with wsimport) according to the JAX-WS Section 2.5 pattern:
Interface
Code Block |
---|
public Person sendGuessAndName(...) throws BadInputMsg;
|
Anchor | ||||
---|---|---|---|---|
|
Code Block |
---|
import javax.xml.ws.WebFault;
@WebFault(name = "errorCode", targetNamespace = "....")
public class BadInputMsg extends Exception
{
private int faultInfo;
public BadInputMsg(String message, int faultInfo) {
super(message);
this.faultInfo = faultInfo;
}
public BadInputMsg(String message, int faultInfo, Throwable cause) {
super(message, cause);
this.faultInfo = faultInfo;
}
public int getFaultInfo() {
return faultInfo;
}
}
|
Bottom-Up (start with Java checked exception)
First, it might be best to avoid designing a remotable interface which throws a technology exception, e.g. java.sql.SQLException. This might be more appropriate for a local interface rather than a coarse-grained remotable interface.
If you have a genuine Java business exception then things get more complicated, at least if your exception wrappers fault data (i.e. it wrappers some data like an error code or object which it needs to pass back to the client catching the exception).
There are two options:
- Convert the exception to follow the JAX-WS Section 2.5 pattern.
- Rely on our Tuscany interpretation/implementation the JAX-WS Sec 3.7 pattern. This basically works the same whether you run a dev-time tool which supports this pattern (like wsgen) or if you leverage the runtime WSDL2Java.
Convert the exception to JAX-WS Section 2.5
If you are willing/able to modify your Java business exception in this fashion, this is probably the better choice. This exception will be more round-trip friendly as well. That is, if you modify the exception to follow the JAX-WS Sec. 2.5 pattern, run a Java->WSDL (e.g. with wsgen), and then do a later WSDL->Java (e.g. with wsimport), the exception should end up looking pretty similar to the one you just modified.
In practice this means you must do three things:
- add constructors which take the fault bean as input parameters
- implement a public getFaultInfo() method which returns the fault bean
- add the @javax.xml.ws.WebFault annotation
See above for an example
This assumes, though, that the user is actually reading the documentation in order to know to do this.
Rely on the JAX-WS Section 3.7 mapping
This second option will be used in the cases:
- when the user won't or can't change the exception class to follow the Sec. 2.5 pattern
- when the user leaves it entirely up to the runtime to map his Java into WSDL (e.g. user declares a <binding.ws> on a service with a wsdl-less deploy)
In either of those two cases, as long as the exception doesn't contain fault data, this will "just work" without any complexity seen by the user.
For exceptions with fault data, the data will be handled correctly (or not) field by field. For each exception data field with a public getter/setter we will handle the data correctly, and we will lose the data without a getter/setter pair. In other words, we will serialize/deserialize the exception by viewing it as a JavaBean.
Some issues with this second option:
- It won't be obvious to a user what the supported pattern is. One exception with fault data (and getter/setter) is handled correctly while another is not. Running wsgen at development time is no help either, since this generates the schema based on the exception's getters without assuring that the corresponding setters exist in order to populate the exception during unmarshalling.
- This seems an area for improvement, either by issuing warnings somewhere along the way or if we ever factor out the Tuscany J2W functionality into a dev-time tool.
- If you run W2J against the generated WSDL you will end up with a different exception class. So your client/service programming model are different which might confuse the Java-centered programmer. (One positive is the newly generated Java exc should now follow the Sec 2.5 pattern). You might even need to add a JAXB customization to get around some mapping quirks to generate the client, and you might see weird names like MyException_Exception.
- Another issue might be the fact that, although the pattern is outlined in JAX-WS Sec. 3.7, the spec does not go so far as to specify every detail, and maybe other software implementing JAX-WS does things differently. Not a showstopper since only WSDL has to treated interoperably across platforms.
Example - no fault, works OK
Actually the String message is the fault here and it is handled (serialized/deserialized successfully)
Code Block |
---|
public class RealSimpleException extends Exception {
public RealSimpleException(String message) {
super(message);
}
public RealSimpleException(String message, Throwable cause) {
super(message, cause);
}
}
|
Example - Exception as Java bean, works OK
This works because the String userdata fault has an associated public getter/setter (and the String message is handled as well).
Code Block |
---|
public class TestException extends Exception {
private String userdata;
public TestException(String message) {
super(message);
}
public TestException(String message, String userdata) {
super(message);
this.userdata = userdata;
}
public String getUserdata() {
return userdata;
}
public void setUserdata(String userdata) {
this.userdata = userdata;
}
}
|
Example - Exception doesn't follow pattern, DOES NOT WORK
This does not work because the errorCode fault data does not have a setter. Our runtime is then
not able to figure out how to populate the exception with this piece of fault data. The exception
will still be thrown but WITH DATA LOSS.
Code Block |
---|
package java.sql;
public class SQLException extends Exception ... {
...
public SQLException(String theReason, String theSQLState, int theErrorCode) ...
public int getErrorCode()
} |
Code Block |
String someMethod(String... params)
|
Tuscany
TODO - Add some details of which bits of tuscany do what w.r.t databindings, mappings and transformations in typical scenarios, e.g.
Code Block |
---|
<component name="HelloWorldClientComponent">
<implementation.java class="helloworld.HelloWorldClientImpl" />
<reference name="helloWorldService">
<interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
<binding.ws uri="http://localhost:8085/HelloWorldService"/>
</reference>
</component>
<component name="HelloWorldServiceComponent">
<implementation.java class="helloworld.HelloWorldImpl" />
<service name="HelloWorldService">
<interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
<binding.ws uri="http://localhost:8085/HelloWorldService"/>
</service>
</component>
|
...
- databinding mapping - Creates in memory models of the WSDL interfaces and the java introspected component types.
- interface contract mapper - Checks compatibility of
- interfaces with component types
- references with services
Code Block |
---|
<service name="HelloWorldService"> <interface.java ... |
...