@Test public void testNillable() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("VSOi.wsdl")); TypeDescriptor descriptor = parser.getOperationInputParameters("Query").get(0); XMLInputSplitter splitter = new XMLInputSplitter(descriptor,new String[]{"version","block"},new String[]{"text/plain","text/plain"},new String[]{"output"}); Map<String,Object> inputMap = new HashMap<String, Object>(); inputMap.put("version", "xsi:nil"); Map<String,String> outputMap = splitter.execute(inputMap); assertNotNull("there should be an output named 'output'",outputMap.containsKey("output")); String xml = outputMap.get("output"); System.out.println(xml); assertTrue(xml.contains("<block xmlns=\"\"></block>")); assertTrue(xml.contains("<version xmlns=\"\" " + "xmlns:xsi=\"http: "xsi:nil=\"true\" />")); }
public Map<String, String> execute(Map<String, Object> inputMap) throws JDOMException, IOException { Map<String, String> result = new HashMap<String, String>(); Element outputElement = (this.typeDescriptor.getName().length() > 0 ? new Element( this.typeDescriptor.getName()) : new Element(this.typeDescriptor.getType())); if (typeDescriptor instanceof ComplexTypeDescriptor) { executeForComplexType(inputMap, result, outputElement); } else { for (String key : inputMap.keySet()) { Object dataObject = inputMap.get(key); if (dataObject instanceof List) { Element dataElement = buildElementFromObject(key, ""); for (Object dataItem : ((List<?>) dataObject)) { Element itemElement = buildElementFromObject(key, dataItem); dataElement.addContent(itemElement); } XMLOutputter outputter = new XMLOutputter(); String xmlText = outputter.outputString(dataElement); result.put(outputNames[0], xmlText); } else { Element dataElement = buildElementFromObject(key, dataObject); outputElement.addContent(dataElement); XMLOutputter outputter = new XMLOutputter(); String xmlText = outputter.outputString(outputElement); result.put(outputNames[0], xmlText); } } } return result; }
XMLInputSplitter { public Map<String, String> execute(Map<String, Object> inputMap) throws JDOMException, IOException { Map<String, String> result = new HashMap<String, String>(); Element outputElement = (this.typeDescriptor.getName().length() > 0 ? new Element( this.typeDescriptor.getName()) : new Element(this.typeDescriptor.getType())); if (typeDescriptor instanceof ComplexTypeDescriptor) { executeForComplexType(inputMap, result, outputElement); } else { for (String key : inputMap.keySet()) { Object dataObject = inputMap.get(key); if (dataObject instanceof List) { Element dataElement = buildElementFromObject(key, ""); for (Object dataItem : ((List<?>) dataObject)) { Element itemElement = buildElementFromObject(key, dataItem); dataElement.addContent(itemElement); } XMLOutputter outputter = new XMLOutputter(); String xmlText = outputter.outputString(dataElement); result.put(outputNames[0], xmlText); } else { Element dataElement = buildElementFromObject(key, dataObject); outputElement.addContent(dataElement); XMLOutputter outputter = new XMLOutputter(); String xmlText = outputter.outputString(outputElement); result.put(outputNames[0], xmlText); } } } return result; } }
XMLInputSplitter { public Map<String, String> execute(Map<String, Object> inputMap) throws JDOMException, IOException { Map<String, String> result = new HashMap<String, String>(); Element outputElement = (this.typeDescriptor.getName().length() > 0 ? new Element( this.typeDescriptor.getName()) : new Element(this.typeDescriptor.getType())); if (typeDescriptor instanceof ComplexTypeDescriptor) { executeForComplexType(inputMap, result, outputElement); } else { for (String key : inputMap.keySet()) { Object dataObject = inputMap.get(key); if (dataObject instanceof List) { Element dataElement = buildElementFromObject(key, ""); for (Object dataItem : ((List<?>) dataObject)) { Element itemElement = buildElementFromObject(key, dataItem); dataElement.addContent(itemElement); } XMLOutputter outputter = new XMLOutputter(); String xmlText = outputter.outputString(dataElement); result.put(outputNames[0], xmlText); } else { Element dataElement = buildElementFromObject(key, dataObject); outputElement.addContent(dataElement); XMLOutputter outputter = new XMLOutputter(); String xmlText = outputter.outputString(outputElement); result.put(outputNames[0], xmlText); } } } return result; } XMLInputSplitter(TypeDescriptor typeDescriptor, String inputNames[],
			String inputTypes[], String[] outputNames); }
XMLInputSplitter { public Map<String, String> execute(Map<String, Object> inputMap) throws JDOMException, IOException { Map<String, String> result = new HashMap<String, String>(); Element outputElement = (this.typeDescriptor.getName().length() > 0 ? new Element( this.typeDescriptor.getName()) : new Element(this.typeDescriptor.getType())); if (typeDescriptor instanceof ComplexTypeDescriptor) { executeForComplexType(inputMap, result, outputElement); } else { for (String key : inputMap.keySet()) { Object dataObject = inputMap.get(key); if (dataObject instanceof List) { Element dataElement = buildElementFromObject(key, ""); for (Object dataItem : ((List<?>) dataObject)) { Element itemElement = buildElementFromObject(key, dataItem); dataElement.addContent(itemElement); } XMLOutputter outputter = new XMLOutputter(); String xmlText = outputter.outputString(dataElement); result.put(outputNames[0], xmlText); } else { Element dataElement = buildElementFromObject(key, dataObject); outputElement.addContent(dataElement); XMLOutputter outputter = new XMLOutputter(); String xmlText = outputter.outputString(outputElement); result.put(outputNames[0], xmlText); } } } return result; } XMLInputSplitter(TypeDescriptor typeDescriptor, String inputNames[],
			String inputTypes[], String[] outputNames); Map<String, String> execute(Map<String, Object> inputMap); }
XMLInputSplitter { public Map<String, String> execute(Map<String, Object> inputMap) throws JDOMException, IOException { Map<String, String> result = new HashMap<String, String>(); Element outputElement = (this.typeDescriptor.getName().length() > 0 ? new Element( this.typeDescriptor.getName()) : new Element(this.typeDescriptor.getType())); if (typeDescriptor instanceof ComplexTypeDescriptor) { executeForComplexType(inputMap, result, outputElement); } else { for (String key : inputMap.keySet()) { Object dataObject = inputMap.get(key); if (dataObject instanceof List) { Element dataElement = buildElementFromObject(key, ""); for (Object dataItem : ((List<?>) dataObject)) { Element itemElement = buildElementFromObject(key, dataItem); dataElement.addContent(itemElement); } XMLOutputter outputter = new XMLOutputter(); String xmlText = outputter.outputString(dataElement); result.put(outputNames[0], xmlText); } else { Element dataElement = buildElementFromObject(key, dataObject); outputElement.addContent(dataElement); XMLOutputter outputter = new XMLOutputter(); String xmlText = outputter.outputString(outputElement); result.put(outputNames[0], xmlText); } } } return result; } XMLInputSplitter(TypeDescriptor typeDescriptor, String inputNames[],
			String inputTypes[], String[] outputNames); Map<String, String> execute(Map<String, Object> inputMap);  }