Skip to content

Instantly share code, notes, and snippets.

<account>
<accountKey>
<location>Texas</location>
<number>6086510</number>
<code>06</code>
</accountKey>
</account>
<query xmlns="urn:Account-WSDL">
<serviceContext>
<externalUserName>USR</externalUserName>
</serviceContext>
<account>
<accountKey>
<location>Texas</location>
<number>6086510</number>
<code>06</code>
</accountKey>
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MethodInput", propOrder = {
"serviceContext",
"account"
})
public class MethodInput{
@XmlElement(required = true)
protected ServiceContext serviceContext;
@XmlElement(required = true)
@kartikshah
kartikshah / JaxbUnmarshallerWithDocBuilder.java
Created February 1, 2012 20:56
Pass child element'd Node to unmarshal
public class JaxbUnmarshallerWithDocBuilder {
public static void main(String args[]){
try{
JAXBContext jc = JAXBContext.newInstance("com.kartikshah.api.account.wsdl");
Unmarshaller u = jc.createUnmarshaller();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(JaxbUnmarshallerWithDocBuilder.class.getResource("account.xml"));
@kartikshah
kartikshah / Account.java
Created February 1, 2012 20:55
Add @XmlRootElement tag at top
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Account", propOrder = {
"accountKey", // .. other fields omitted for brevity
})
public class Account{
protected AccountKey accountKey;
// ...
@kartikshah
kartikshah / ObjectFactory.java
Created February 1, 2012 20:53
ObjectFactory class allows a specific tag to be the root tag
@XmlRegistry
public class ObjectFactory {
// ...
private final static QName Query1_QNAME = new QName("urn:Account-WSDL", "query");
// ...
}
@kartikshah
kartikshah / JaxbUnmarshallerMethodInput.java
Created February 1, 2012 20:33
Jaxb Unmarshal at WSDL input parameter level
public class JaxbUnmarshallerMethodInput{
public static void main(String args[]){
try{
JAXBContext jc = JAXBContext.newInstance("com.kartikshah.api.account.wsdl");
Unmarshaller u = jc.createUnmarshaller();
JAXBElement element = (JAXBElement)u.unmarshal(JaxbUnmarshallerMethodInput.class.getResource("query.xml"));
MethodInput methodInput = (MethodInput)element.getValue();
Account account = methodInput.getAccount();
ServiceContext context = methodInput.getServiceContext();
}
@kartikshah
kartikshah / wslt-taskdef-osb.xml
Created July 19, 2011 22:05
WLST Ant Taskdef for OSB
<path id="wlst.class.path">
<fileset dir="${bea.home}/Oracle_OSB1/lib">
<include name="sb-kernel-api.jar" />
<include name="alsb.jar" />
</fileset>
<fileset dir="${bea.home}/Oracle_OSB1/modules">
<include name="com.bea.common.configfwk_1.3.0.0.jar" />
</fileset>
<fileset dir="${wl.home}/server/lib">
<include name="weblogic.jar" />
@kartikshah
kartikshah / 4clojure59.clj
Created May 22, 2011 05:44
4Clojure - 59
(fn [& fns]
(fn [& args]
(map #(apply % args) fns)))
@kartikshah
kartikshah / 4clojure55.clj
Created May 17, 2011 03:00
4Clojure - 55
(fn [xs]
(let [m (group-by (fn [x] x) xs)]
(zipmap (keys m) (map count (vals m)))))