@Test public void testSimpleCase() throws Exception { Map<String,Object> inputMap = new HashMap<String, Object>(); BodyBuilder builder = createBuilder(wsdlResourcePath("TestServices-rpcencoded.wsdl"), "countString"); assertTrue("Wrong type of builder created",builder instanceof EncodedBodyBuilder); inputMap.put("str", "Roger Ramjet"); SOAPElement body = builder.build(inputMap); Iterator<SOAPElement> children = body.getChildElements(); assertTrue("empty body content", children.hasNext()); SOAPElement child = children.next(); assertTrue("wrong body content (must be '{}str')", "str".equals(child.getLocalName()) && child.getNamespaceURI() == null); String type = child.getAttributeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "type"); assertNotNull("missing xsi:type", type); assertTrue("wrong xsi:type", "xsd:string".equals(type)); assertTrue("wrong text value", "Roger Ramjet".equals(child.getTextContent())); }
@Override public SOAPElement build(Map inputMap) throws WSDLException, ParserConfigurationException, SOAPException, IOException, SAXException, UnknownOperationException { SOAPElement result = super.build(inputMap); for (Iterator iterator = namespaceMappings.keySet().iterator(); iterator.hasNext();) { String namespaceURI = (String) iterator.next(); String ns = namespaceMappings.get(namespaceURI); result.addNamespaceDeclaration(ns, namespaceURI); } result.setAttributeNS(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, "soapenv:encodingStyle", SOAPConstants.URI_NS_SOAP_ENCODING); return result; }
EncodedBodyBuilder extends AbstractBodyBuilder { @Override public SOAPElement build(Map inputMap) throws WSDLException, ParserConfigurationException, SOAPException, IOException, SAXException, UnknownOperationException { SOAPElement result = super.build(inputMap); for (Iterator iterator = namespaceMappings.keySet().iterator(); iterator.hasNext();) { String namespaceURI = (String) iterator.next(); String ns = namespaceMappings.get(namespaceURI); result.addNamespaceDeclaration(ns, namespaceURI); } result.setAttributeNS(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, "soapenv:encodingStyle", SOAPConstants.URI_NS_SOAP_ENCODING); return result; } }
EncodedBodyBuilder extends AbstractBodyBuilder { @Override public SOAPElement build(Map inputMap) throws WSDLException, ParserConfigurationException, SOAPException, IOException, SAXException, UnknownOperationException { SOAPElement result = super.build(inputMap); for (Iterator iterator = namespaceMappings.keySet().iterator(); iterator.hasNext();) { String namespaceURI = (String) iterator.next(); String ns = namespaceMappings.get(namespaceURI); result.addNamespaceDeclaration(ns, namespaceURI); } result.setAttributeNS(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, "soapenv:encodingStyle", SOAPConstants.URI_NS_SOAP_ENCODING); return result; } EncodedBodyBuilder(String style, WSDLParser parser, String operationName, List<TypeDescriptor> inputDescriptors); }
EncodedBodyBuilder extends AbstractBodyBuilder { @Override public SOAPElement build(Map inputMap) throws WSDLException, ParserConfigurationException, SOAPException, IOException, SAXException, UnknownOperationException { SOAPElement result = super.build(inputMap); for (Iterator iterator = namespaceMappings.keySet().iterator(); iterator.hasNext();) { String namespaceURI = (String) iterator.next(); String ns = namespaceMappings.get(namespaceURI); result.addNamespaceDeclaration(ns, namespaceURI); } result.setAttributeNS(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, "soapenv:encodingStyle", SOAPConstants.URI_NS_SOAP_ENCODING); return result; } EncodedBodyBuilder(String style, WSDLParser parser, String operationName, List<TypeDescriptor> inputDescriptors); @Override SOAPElement build(Map inputMap); }
EncodedBodyBuilder extends AbstractBodyBuilder { @Override public SOAPElement build(Map inputMap) throws WSDLException, ParserConfigurationException, SOAPException, IOException, SAXException, UnknownOperationException { SOAPElement result = super.build(inputMap); for (Iterator iterator = namespaceMappings.keySet().iterator(); iterator.hasNext();) { String namespaceURI = (String) iterator.next(); String ns = namespaceMappings.get(namespaceURI); result.addNamespaceDeclaration(ns, namespaceURI); } result.setAttributeNS(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, "soapenv:encodingStyle", SOAPConstants.URI_NS_SOAP_ENCODING); return result; } EncodedBodyBuilder(String style, WSDLParser parser, String operationName, List<TypeDescriptor> inputDescriptors); @Override SOAPElement build(Map inputMap);  }