Download presentation
Presentation is loading. Please wait.
1
CS526 George E. Turner Spring 2009
2
Current Implementation Four standard methods used to manipulate complex types in SOAP o Create o Read o Update o Delete
3
The Update method is extremely inefficient o Comparison to current data to determine “What’s changed?” o Bandwidth is abused when only updating a single field “Why send data that isn’t different?” o Requires a separate method for every field “Additional code to support each new method”
4
Proposal Create a single update method to update ANY field or child object
5
The QName classname 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[ …][ / attribute:key=value[ …]] Example: id=12345/Item:id=3
6
The any is the new value, ANY valid XML Example: Pork Full SOAP Example <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:UpdateService:Operations" xmlns:shop="urn:UpdateService:Shopping"> shop:ShoppingCart id=12345/Item:id=3 Pork
7
This solution uses a combination of o Java Persistence API (JPA) o Java Reflection o 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
New Code private static final Map QNAME_CLASS_MAP; static { Map tmp = new HashMap (2); tmp.put(_ShoppingCart_QNAME, ShoppingCartType.class); tmp.put(_OrderItem_QNAME, OrderItemType.class); QNAME_CLASS_MAP = Collections.unmodifiableMap(tmp); } public Class getClass(QName qname) { return QNAME_CLASS_MAP.get(qname); }
9
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
References: JAXB – Reference Implementation – http://jaxb.dev.java.net http://jaxb.dev.java.net JAXWS – Reference Implementation – http://jaxws.dev.java.net http://jaxws.dev.java.net METRO – Reference Implementation – http://metro.dev.java.net http://metro.dev.java.net JPA - Persistence API - http://java.sun.com/javaee/technologies/persistence.jsp http://java.sun.com/javaee/technologies/persistence.jsp
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.