1 / 10

Single SOAP Update Operation

Single SOAP Update Operation. CS526 George E. Turner Spring 2009. George Turner CS526. Current Implementation Four standard methods used to manipulate complex types in SOAP Create Read Update Delete. George Turner CS526. The Update method is extremely inefficient

kiley
Download Presentation

Single SOAP Update Operation

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. Single SOAP Update Operation CS526 George E. Turner Spring 2009

  2. George Turner CS526 Current Implementation • Four standard methods used to manipulate complex types in SOAP • Create • Read • Update • Delete

  3. George Turner CS526 • The Update method is extremely inefficient • Comparison to current data to determine “What’s changed?” • Bandwidth is abused when only updating a single field “Why send data that isn’t different?” • Requires a separate method for every field “Additional code to support each new method”

  4. George Turner CS526 Proposal • Create a single update method to update ANY field or child object <xs:complexType> <xs:sequence> <xs:element name="className" type="xs:QName"/> <xs:element name="xpathValue" type="xs:string"/> <xs:any/> </xs:sequence> </xs:complexType>

  5. George Turner CS526 • The QNameclassname value defines what is being updated • Fully qualified description of the top level object • Example: shop:ShoppingCart (namespace:localPart) • The String xpathValue defines the keys to distinguish the part to update • key=value[<,key=value>…][ / attribute:key=value[<,attribute:key=value>…]] • Example: id=12345/Item:id=3

  6. George Turner CS526 • The any is the new value, ANY valid XML • Example: <shop:MeatItem>Pork</shop:MeatItem> • Full SOAP Example <soapenv:Envelopexmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:UpdateService:Operations" xmlns:shop="urn:UpdateService:Shopping"> <soapenv:Header/> <soapenv:Body> <urn:update> <urn:className>shop:ShoppingCart</urn:className> <urn:xpathValue>id=12345/Item:id=3</urn:xpathValue> <shop:MeatItem>Pork</shop:MeatItem> </urn:update> </soapenv:Body> </soapenv:Envelope>

  7. George Turner CS526 • This solution uses a combination of • Java Persistence API (JPA) • Java Reflection • Modifications to generated JAXB classes @XmlRegistry public class ObjectFactory { private final static QName _ShoppingCart_QNAME = new QName("urn:UpdateService:Shopping", "ShoppingCart"); private final static QName _OrderItem_QNAME = new QName("urn:UpdateService:Shopping", "OrderItem");

  8. George Turner CS526 New Code private static final Map<QName, Class> QNAME_CLASS_MAP; static { Map<QName, Class> tmp = new HashMap<QName, Class>(2); tmp.put(_ShoppingCart_QNAME, ShoppingCartType.class); tmp.put(_OrderItem_QNAME, OrderItemType.class); QNAME_CLASS_MAP = Collections.unmodifiableMap(tmp); } public Class getClass(QNameqname) { return QNAME_CLASS_MAP.get(qname); }

  9. George Turner CS526 Conclusion • This prototype is not the final solution • A Document Object Model solution may be easier • Changes to the generated JAXB classes are required • Submission to W3C for acceptance and inclusion into milestone releases and specification

  10. George Turner CS526 References: • JAXB – Reference Implementation – http://jaxb.dev.java.net • JAXWS – Reference Implementation – http://jaxws.dev.java.net • METRO – Reference Implementation – http://metro.dev.java.net • JPA - Persistence API - http://java.sun.com/javaee/technologies/persistence.jsp

More Related