SAAJ 1'2 - PowerPoint PPT Presentation

1 / 4
About This Presentation
Title:

SAAJ 1'2

Description:

... Web Services column, Frank Sommers shows how the SOAP with Attachments API ... ACS WG - Data transport with SOAP message. 3 ... – PowerPoint PPT presentation

Number of Views:118
Avg rating:3.0/5.0
Slides: 5
Provided by: kei114
Learn more at: https://www.ogf.org
Category:
Tags: saaj | provided | shows | sommers

less

Transcript and Presenter's Notes

Title: SAAJ 1'2


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-0
    912-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-0
    912-webservices-p2.html

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/We
    bServices/soa2/JavaTechs.htmlsaajdesc
  • SAAJ Documentation http//java.sun.com/webservice
    s/saaj/docs.html

3
SOAP with Attachments API for Java (SAAJ) 1.2
http//java.sun.com/developer/technicalArticles/We
bServices/soa2/JavaTechs.htmlsaajdesc
  • 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",
  • sbe.addChildElement( envelope.createName(
  • "searchCriteria", "bp", "http//www.bookprovider.
    com" )).addTextNode("author")
  • sbe.addChildElement( envelope.createName(
  • "searchValue", "bp", "http//www.bookprovi
    der.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()

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/webservice
    s/docs/1.1/tutorial/doc/JAXM5.htmlwp64131 )
  • Soap With Attachments Sample Application
  • The SwA Interop Scenarios
  • SwA Sample Configuration Files
  • Running the SwA Sample Application
Write a Comment
User Comments (0)
About PowerShow.com