Presentation is loading. Please wait.

Presentation is loading. Please wait.

2005/08/25ACS WG - Data transport with SOAP message 1 SAAJ 1.2 Send and receive binary Web services content using SAAJ 1.2 –In his latest Web Services.

Similar presentations


Presentation on theme: "2005/08/25ACS WG - Data transport with SOAP message 1 SAAJ 1.2 Send and receive binary Web services content using SAAJ 1.2 –In his latest Web Services."— Presentation transcript:

1 2005/08/25ACS WG - Data transport with SOAP message 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.htmlhttp://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.htmlhttp://www.javaworld.com/javaworld/jw-09-2003/jw-0912-webservices-p2.html

2 2005/08/25ACS WG - Data transport with SOAP message 2 SAAJ References SOAP with Attachments API for Java (SAAJ) 1.2SOAP 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.SOAP 1.1 specificationSOAP with Attachments specification –http://java.sun.com/developer/technicalArticles/WebServices/soa2/JavaTechs.ht ml#saajdeschttp://java.sun.com/developer/technicalArticles/WebServices/soa2/JavaTechs.ht ml#saajdesc SAAJ Documentation http://java.sun.com/webservices/saaj/docs.htmlSAAJ Documentation http://java.sun.com/webservices/saaj/docs.html

3 2005/08/25ACS WG - Data transport with SOAP message 3 SOAP with Attachments API for Java (SAAJ) 1.2 http://java.sun.com/developer/technicalArticles/WebServices/soa2/JavaTechs.html#saajdesc 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" )).addTextNo de("author"); sbe.addChildElement( envelope.createName( "searchValue", "bp", "http://www.bookprovider.com" )).addTextNo de("Hemingway"); // Add attachment AttachmentPart ap = msg.createAttachmentPart(); byte[] jpegData = "..." ap.setContent(new ByteArrayInputStream(jpegData), "image/jpeg") msg.addAttachmentPart(ap); // Close the connection connection.close();

4 2005/08/25ACS 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 )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 )Adding Attachment ( http://java.sun.com/webservices/docs/1.1/tutorial/doc/JAXM5.html#wp64131 ) –Soap With Attachments Sample ApplicationSoap With Attachments Sample Application The SwA Interop Scenarios SwA Sample Configuration Files Running the SwA Sample Application


Download ppt "2005/08/25ACS WG - Data transport with SOAP message 1 SAAJ 1.2 Send and receive binary Web services content using SAAJ 1.2 –In his latest Web Services."

Similar presentations


Ads by Google