1 / 21

XML, SOAP, Services Web et JAVA Me

XML, SOAP, Services Web et JAVA Me. Understanding the Web Services Subset API for Java ME. Plan. Services Web XML over http SOAP - RPC. Services Web. Un service web Un composant logiciel qui a été publié sur le World Wide Web

roxy
Download Presentation

XML, SOAP, Services Web et JAVA Me

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML, SOAP, Services Web et JAVA Me Understanding the Web Services Subset API for Java ME

  2. Plan • Services Web • XML over http • SOAP - RPC

  3. Services Web • Un service web • Un composant logiciel qui a été publié sur le World Wide Web • Par le biais de descripteurs de service et d’interfaces bien définies, • obtenir l’indépendance par rapport au • langage de programmation • système d’exploitation • matériel • Couplage lâche entre les fournisseurs de su service et ses utilisateurs • Séparation propre entre les interfaces exposées et leur implémentation

  4. Services Web et Java ME • Web Services APIs for Java ME • JSR 172, • packages optionnels • Le package pour le traitement XML repose sur • Java API for XMP Processing (JAXP) 1.1, JSR 63, • la version 2 de Simple API for XML (SAX2). • APIs pour l’invocation à distance de services web • JAX-RPC : APIs pour les services web sur Java ME • Un sous-ensemble de la version 1.1 de l’API Java pour la spécification XML pour RPC (JAX-RPC) 1.1.

  5. Application JAX-RPC

  6. Utilisation de JAX-RPC sur Java ME

  7. Différences entre JAX-RPC 1.1 et son sous-ensemble Java ME • Le profil de base WS-I • clarifications et recommendations pour aider à garantir l’interopérabilité entre les différentes implémentation de services web • AX-RPC for Java ME se conforme à ces clarifications et recommendations, redéfinissant JAX-RPC 1.1 lorsque c’est nécessaire • SOAP 1.1 • Protocole d’encodage SOAP • Les implémentaitons de JAX-RPC for Java ME • libres d’utiliser de l’encodage binaire pendant les échanges de messages • car XML est trop verbeux

  8. Différences entre JAX-RPC 1.1 et son sous-ensemble Java ME • génération et invocation de Stub • JAX-RPC 1.1 • static stub, • dynamic proxy, • dynamic Invocation Interface (DII) (sans stub). • Sous-ensemble Java ME • Seulement static • Génération des stubs avec un utilitaire de type WSDL-to-Java • Exemple: wscompile: • Le développeur doit générer lui-même a priori les stubs du services avec lequel il veut interagir

  9. La commande wscompile • Using the Stub Generator • http://java.sun.com/products/sjwtoolkit/wtk2.5.2/docs/UserGuide-html/commandline.html#50626620_pgfId-37687

  10. Une application utilisant des stubs

  11. Différences entre JAX-RPC 1.1 et son sous-ensemble Java ME • Mode d’interactions au niveau de l’application • JAX-RPC 1.1 specifie 3 modèles d’interactions Synchronous request-response two-way RPC • Asynchronous (non-blocking) request-response two-way RPC • One-way RPC • The Java ME JAX-RPC • seulement le mode RPC synchrone bi-directionnel

  12. Différences entre JAX-RPC 1.1 et son sous-ensemble Java ME • Enregistrement et découverte de services • Hors de la portée de JAX-RPC 1.1. • Universal Description Discovery and Integration (UDDI), • le standard de facot. • UDDI.org. • Pas de capacités standard pour enregistrement et découverte de services ou d’APIs UDDI en Java dans Java ME as yet. • Java ME: la décoouverte de services doit être faite manuellement a priori • De toute façons, il faudra générer les stubs manuellement • La découverte de services perd donc tout son sens

  13. Différences entre JAX-RPC 1.1 et son sous-ensemble Java ME • Mapping of data types: basic, array, complex, and other • J2ME moins de types disponibles • Extensible type mapping • Pas dans JAX-RPC for Java ME • WSDL-to-Java mapping • dans JAX-RPC for Java ME : pas d’overloading + ordre des parties défini l’ordre des paramètres • Message handlers • Pas dans JAX-RPC for Java ME • SOAP messages with attachments • Pas dans JAX-RPC for Java ME • SOAP faults • JAX-RPC for Java ME ne supporte pas SOAPFaultException

  14. Différences entre JAX-RPC 1.1 et son sous-ensemble Java ME • Mapping of data types: basic, array, complex, and other

  15. Références • Understanding the Web Services Subset API for Java ME • http://developers.sun.com/mobility/midp/articles/webservices/ • J2ME Web Services APIs (WSA), JSR 172 • http://java.sun.com/products/wsa/

  16. Différences entre JAX-RPC 1.1 et son sous-ensemble Java ME • Service endpoint model • JAX-RPC 1.1 • Supporte un modèle client pour le consommateur • Supporte un point de livraison de service pour le fournisseur • The JAX-RPC for Java ME subset doesn't support the service endpoint model, only the client service consumer model. • Because the current version of JAX-RPC for Java ME doesn't support exposing web services, only consuming them, you can't use the subset to create a service endpoint.

  17. Différences entre JAX-RPC 1.1 et son sous-ensemble Java ME • Mapping of data types: basic, array, complex, and other • You'll need to work around the lack of support for some commonly used data types, including dateTime, date, and time. • You may need to create special versions of WSDL files for Java ME clients. • Remember to specify CLDC 1.1 when you're building for that configuration, as it supports floating-point numeric types. • If you try to create a static stub from a WSDL description that specifies unsupported types, stub generation or compilation will fail. • Arrays • JAX-RPC 1.1 specifies support for arrays derived from soapenc:Array by restriction, and the wsdl:arrayType attribute. • JAX-RPC for Java ME doesn't support soapenc:Array or wsdl:arrayType. Instead, it derives arrays from any element whose maxOccurs attribute is greater than 1 or unbounded, as the WS-I Profile recommends. In addition, the JAX-RPC subset doesn't support simple types derived by restriction. • Complex Types • JAX-RPC 1.1 specifies support for XML struts or complex types derived from: • The xsd:complexType that contains a sequence (xsd:sequence) of elements of either simple or complex types • The xsd:complexType with xsd:all based on an unordered grouping of elements of either simple or complex type • The xsd:complexType with xsd:simpleContent used to declare a complex type by extension of an existing simple type • In all the above cases, xsd:attribute and xsd:attributeGroup are supported. • JAX-RPC for Java ME supports only one method of determining complex types: • xsd:complexType with a sequence (xsd:sequence) of elements of either simple or complex type. The JAX-RPC for Java ME subset doesn't support xsd:attribute, xsd:attributeGroup, or xsd:any. • Enumerations and Simple Derived Types • JAX-RPC 1.1 specifies support for enumerations, and for simple types derived by restriction or by using xsd:list. Deriving by restriction makes it possible to derive a simple type from an existing pre-defined simple type, referred to as a base type. Deriving by using xsd:list enables you to define arrays. • JAX-RPC for Java ME doesn't support enumerations, or simple types derived by restriction or using xsd:list. • The effect on you: Your Java ME application won't be able to consume services that are described using the unsupported methods I just described. If you try to create a static stub from a WSDL description that specifies unsupported types, stub generation or compilation will fail.

  18. Différences entre JAX-RPC 1.1 et son sous-ensemble Java ME • Extensible type mapping • JAX-RPC 1.1 • specifies support for extensible type mapping and serialization between Java types and XML data types. • Pluggable serializers and deserializers provided by you or by a third party allow custom serialization and deserialization of Java-based objects to and from XML types, thus enabling developers to create their own extended types. • JAX-RPC for Java ME • doesn't support extensible type mapping. • The lack of support for extensible mapping means that you won't be able to define your own custom Java-to-XML serialization. • Because extensible type mapping is defined loosely, and its implementation is very much vendor-specific, you should stay away from it anyway. Most web services stick to basic types.

  19. Différences entre JAX-RPC 1.1 et son sous-ensemble Java ME • WSDL-to-Java mapping • WSDL-to-Java Mapping - Overloading Operation Names • JAX-RPC 1.1 specifies that a wsdl:operation defined in a wsdl:portType maps to a Java method on the mapped Java service endpoint interface. JAX-RPC 1.1 supports the overloading of operation names within wsdl:portType. • Following the WS-I Basic Profile, JAX-RPC for Java ME does not. Names of wsdl:operations within a wsdl:portType must be unique. • The effect on you: Your Java ME application won't be able to consume services that overload operation names within a wsdl:portType. If you try to create a static stub from a WSDL description that specifies unsupported types, stub generation or compilation will fail. • WSDL-to-Java Mapping - Parameter Order • JAX-RPC 1.1 • specifies that the parameterOrder attribute must reflect the order of the parameters in the RPC method signature. • JAX-RPC for Java ME • follows the WS-I Basic Profile, • the order of the parts in a message, not the parameterOrder attribute, identifies the order of the parameters.

  20. Différences entre JAX-RPC 1.1 et son sous-ensemble Java ME • Message handlers • JAX-RPC 1.1 • defines support for SOAP message handlers, • which you can use to implement additional SOAP message processing, such as encryption or caching. • JAX-RPC for Java ME doesn't support SOAP message handlers • SOAP messages with attachments • JAX-RPC 1.1 • defines support for SOAP messages with attachments based on MIME multi-part message types. • to support MIME-encoded parameters or return values, such as images or XML documents. • JAX-RPC for Java ME doesn't support SOAP Messages With Attachments.

  21. Différences entre JAX-RPC 1.1 et son sous-ensemble Java ME • SOAP operation mode • JAX-RPC 1.1 • supports rpc- and document-oriented operation styles, and encoded and literal SOAP message encoding. • The Java ME subset • supports only the document/literal combination of operation style and encoding. • web services are moving away from these modes and towards document/literal. • SOAP faults • JAX-RPC 1.1, • a SOAP fault - a soap:fault element in the WSDL description - is mapped to javax.xml.rpc.soap.SOAPFaultException, to a service-specific exception class, or to RemoteException. • JAX-RPC for Java ME • doesn't support SOAPFaultException; • SOAP faults are mapped to a service-specific Java exception or RemoteException. • When invoking a web service, use RemoteExceptions in your catch blocks.

More Related