1 / 4

SAAJ 1.2

SAAJ 1.2. Send and receive binary Web services content using SAAJ 1.2 In his latest Web Services column, Frank Sommers shows how the SOAP with Attachments API for Java (SAAJ) 1.2 supports creating, parsing, and sending SOAP messages with binary content .

luana
Télécharger la présentation

SAAJ 1.2

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. SAAJ 1.2 • Send and receive binary Web services content using SAAJ 1.2 • In his latest Web Services column, Frank Sommers shows how the SOAP with Attachments API for Java (SAAJ) 1.2 supports creating, parsing, and sending SOAP messages with binary content. • http://www.javaworld.com/javaworld/jw-09-2003/jw-0912-webservices.html • Create and send a SOAP message with attachments SAAJ lets you create and edit any part of a SOAP message, including attachments. Most of SAAJ is based on abstract classes and interfaces such that each provider can implement SAAJ in its own products. Sun Microsystems' reference implementation comes with the Java Web Services Developer Pack (JWSDP). • http://www.javaworld.com/javaworld/jw-09-2003/jw-0912-webservices-p2.html ACS WG - Data transport with SOAP message

  2. SAAJ References • SOAP with Attachments API for Java (SAAJ) 1.2 • The SAAJ API 1.2 conforms to the SOAP 1.1 specification and the SOAP with Attachments specification. This means that you can use SAAJ to create and send SOAP message with or without attachments. • http://java.sun.com/developer/technicalArticles/WebServices/soa2/JavaTechs.html#saajdesc • SAAJ Documentation http://java.sun.com/webservices/saaj/docs.html ACS WG - Data transport with SOAP message

  3. import javax.xml.soap.*; // Get a connection SOAPConnection conn; SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance(); conn = scf.createConnection(); // Create a message MessageFactory mf = MessageFactory.newInstance(); SOAPMessage msg = mf.createMessage(); // Add content to the message SOAPPart sp = msg.getSOAPPart() ; SOAPEnvelope envelope = sp.getEnvelope(); SOAPHeader hdr = envelope.getHeader(); SOAPBody bdy = envelope.getBody(); SOAPBodyElement sbe = bdy.addBodyElement (envelope.createName("GetBookDetails", "bp", "http://www.bookprovider.com")); sbe.addChildElement( envelope.createName( "searchCriteria", "bp", "http://www.bookprovider.com" )).addTextNode("author"); sbe.addChildElement( envelope.createName( "searchValue", "bp", "http://www.bookprovider.com" )).addTextNode("Hemingway"); // Add attachment AttachmentPart ap = msg.createAttachmentPart(); byte[] jpegData = "..." ap.setContent(new ByteArrayInputStream(jpegData), "image/jpeg") msg.addAttachmentPart(ap); // Close the connection connection.close(); SOAP with Attachments API for Java (SAAJ) 1.2 http://java.sun.com/developer/technicalArticles/WebServices/soa2/JavaTechs.html#saajdesc ACS WG - Data transport with SOAP message

  4. Java WSDP • Java Web Services Developer Pack 1.6 (Java WSDP 1.6) supports SwA API • Tutorial ( http://java.sun.com/webservices/docs/1.6/tutorial/doc/index.html ) • Adding Attachment ( http://java.sun.com/webservices/docs/1.1/tutorial/doc/JAXM5.html#wp64131 ) • Soap With Attachments Sample Application • The SwA Interop Scenarios • SwA Sample Configuration Files • Running the SwA Sample Application ACS WG - Data transport with SOAP message

More Related