List of usage examples for javax.xml.soap SOAPEnvelope addNamespaceDeclaration
public SOAPElement addNamespaceDeclaration(String prefix, String uri) throws SOAPException;
From source file:eu.planets_project.tb.gui.backing.admin.wsclient.util.WSClient.java
/** * Invokes an operation using SAAJ//from w w w . j ava2 s .c o m * * @param operation The operation to invoke */ public static void main(String[] args) { try { /*OperationInfo operation = new OperationInfo(); operation.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/"); operation.setInputMessageName("HelloWorld_sayHello"); operation.setInputMessageText("<urn:sayHello xmlns:urn='urn:jbosstest'><arg0>Markus</arg0></urn:sayHello>"); operation.setNamespaceURI("urn:jbosstest"); operation.setOutputMessageName("HelloWorld_sayHelloResponse"); operation.setOutputMessageText("<sayHello><return>0</return></sayHello>"); operation.setSoapActionURI(""); operation.setStyle("document"); operation.setTargetMethodName("sayHello"); operation.setTargetObjectURI(null); operation.setTargetURL("http://localhost:8080/HelloWorld/HelloWorld");*/ OperationInfo operation = new OperationInfo(); operation.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/"); operation.setInputMessageName("ConversionRateSoapIn"); operation.setInputMessageText( "<ns5:ConversionRate xmlns:ns5='http://www.webserviceX.NET/'><ns5:FromCurrency>EUR</ns5:FromCurrency><ns5:ToCurrency>SKK</ns5:ToCurrency></ns5:ConversionRate>"); operation.setNamespaceURI("http://www.webserviceX.NET/"); operation.setOutputMessageName("ConversionRateSoapOut"); operation.setOutputMessageText( "<ConversionRate><ConversionRateResult>0</ConversionRateResult></ConversionRate>"); operation.setSoapActionURI("http://www.webserviceX.NET/ConversionRate"); operation.setStyle("document"); operation.setTargetMethodName("ConversionRate"); operation.setTargetObjectURI(null); operation.setTargetURL("http://www.webservicex.net/CurrencyConvertor.asmx"); // Determine if the operation style is RPC boolean isRPC = operation.getStyle().equalsIgnoreCase("rpc"); // All connections are created by using a connection factory SOAPConnectionFactory conFactory = SOAPConnectionFactory.newInstance(); // Now we can create a SOAPConnection object using the connection factory SOAPConnection connection = conFactory.createConnection(); // All SOAP messages are created by using a message factory MessageFactory msgFactory = MessageFactory.newInstance(); // Now we can create the SOAP message object SOAPMessage msg = msgFactory.createMessage(); // Get the SOAP part from the SOAP message object SOAPPart soapPart = msg.getSOAPPart(); // The SOAP part object will automatically contain the SOAP envelope SOAPEnvelope envelope = soapPart.getEnvelope(); //envelope.addNamespaceDeclaration("", operation.getNamespaceURI()); if (isRPC) { // Add namespace declarations to the envelope, usually only required for RPC/encoded envelope.addNamespaceDeclaration(XSI_NAMESPACE_PREFIX, XSI_NAMESPACE_URI); envelope.addNamespaceDeclaration(XSD_NAMESPACE_PREFIX, XSD_NAMESPACE_URI); } // Get the SOAP header from the envelope SOAPHeader header = envelope.getHeader(); // The client does not yet support SOAP headers header.detachNode(); // Get the SOAP body from the envelope and populate it SOAPBody body = envelope.getBody(); // Create the default namespace for the SOAP body //body.addNamespaceDeclaration("", operation.getNamespaceURI()); // Add the service information String targetObjectURI = operation.getTargetObjectURI(); if (targetObjectURI == null) { // The target object URI should not be null targetObjectURI = ""; } // Add the service information //Name svcInfo = envelope.createName(operation.getTargetMethodName(), "", targetObjectURI); Name svcInfo = envelope.createName(operation.getTargetMethodName(), "ns2", operation.getNamespaceURI()); SOAPElement svcElem = body.addChildElement(svcInfo); if (isRPC) { // Set the encoding style of the service element svcElem.setEncodingStyle(operation.getEncodingStyle()); } // Add the message contents to the SOAP body Document doc = XMLSupport.readXML(operation.getInputMessageText()); if (doc.hasRootElement()) { // Begin building content buildSoapElement(envelope, svcElem, doc.getRootElement(), isRPC); } //svcElem.addTextNode(operation.getInputMessageText()); //svcElem. // Check for a SOAPAction String soapActionURI = operation.getSoapActionURI(); if (soapActionURI != null && soapActionURI.length() > 0) { // Add the SOAPAction value as a MIME header MimeHeaders mimeHeaders = msg.getMimeHeaders(); mimeHeaders.setHeader("SOAPAction", "\"" + operation.getSoapActionURI() + "\""); } // Save changes to the message we just populated msg.saveChanges(); // Get ready for the invocation URLEndpoint endpoint = new URLEndpoint(operation.getTargetURL()); // Show the URL endpoint message in the log ByteArrayOutputStream msgStream = new ByteArrayOutputStream(); msg.writeTo(msgStream); log.debug("SOAP Message MeasurementTarget URL: " + endpoint.getURL()); log.debug("SOAP Request: " + msgStream.toString()); // Make the call SOAPMessage response = connection.call(msg, endpoint); // Close the connection, we are done with it connection.close(); // Get the content of the SOAP response Source responseContent = response.getSOAPPart().getContent(); // Convert the SOAP response into a JDOM TransformerFactory tFact = TransformerFactory.newInstance(); Transformer transformer = tFact.newTransformer(); JDOMResult jdomResult = new JDOMResult(); transformer.transform(responseContent, jdomResult); // Get the document created by the transform operation Document responseDoc = jdomResult.getDocument(); // Send the response to the Log String strResponse = XMLSupport.outputString(responseDoc); log.debug("SOAP Response from: " + operation.getTargetMethodName() + ": " + strResponse); // Set the response as the output message operation.setOutputMessageText(strResponse); // Return the response generated //return strResponse; } catch (Throwable ex) { log.error("Error invoking operation:"); log.error(ex.getMessage()); } //return ""; }
From source file:eu.planets_project.tb.gui.backing.admin.wsclient.util.WSClient.java
/** * Invokes an operation using SAAJ//w ww.j a va 2s.c om * * @param operation The operation to invoke */ public static String invokeOperation(OperationInfo operation) throws Exception { try { // Determine if the operation style is RPC boolean isRPC = false; if (operation.getStyle() != null) isRPC = operation.getStyle().equalsIgnoreCase("rpc"); else ; // All connections are created by using a connection factory SOAPConnectionFactory conFactory = SOAPConnectionFactory.newInstance(); // Now we can create a SOAPConnection object using the connection factory SOAPConnection connection = conFactory.createConnection(); // All SOAP messages are created by using a message factory MessageFactory msgFactory = MessageFactory.newInstance(); // Now we can create the SOAP message object SOAPMessage msg = msgFactory.createMessage(); // Get the SOAP part from the SOAP message object SOAPPart soapPart = msg.getSOAPPart(); // The SOAP part object will automatically contain the SOAP envelope SOAPEnvelope envelope = soapPart.getEnvelope(); //my extension - START //envelope.addNamespaceDeclaration("_ns1", operation.getNamespaceURI()); //my extension - END if (isRPC) { // Add namespace declarations to the envelope, usually only required for RPC/encoded envelope.addNamespaceDeclaration(XSI_NAMESPACE_PREFIX, XSI_NAMESPACE_URI); envelope.addNamespaceDeclaration(XSD_NAMESPACE_PREFIX, XSD_NAMESPACE_URI); } // Get the SOAP header from the envelope SOAPHeader header = envelope.getHeader(); // The client does not yet support SOAP headers header.detachNode(); // Get the SOAP body from the envelope and populate it SOAPBody body = envelope.getBody(); // Create the default namespace for the SOAP body //body.addNamespaceDeclaration("", operation.getNamespaceURI()); // Add the service information String targetObjectURI = operation.getTargetObjectURI(); if (targetObjectURI == null) { // The target object URI should not be null targetObjectURI = ""; } // Add the service information //Name svcInfo = envelope.createName(operation.getTargetMethodName(), "", targetObjectURI); Name svcInfo = envelope.createName(operation.getTargetMethodName(), "ns1", operation.getNamespaceURI()); SOAPElement svcElem = body.addChildElement(svcInfo); if (isRPC) { // Set the encoding style of the service element svcElem.setEncodingStyle(operation.getEncodingStyle()); } // Add the message contents to the SOAP body Document doc = XMLSupport.readXML(operation.getInputMessageText()); if (doc.hasRootElement()) { // Begin building content buildSoapElement(envelope, svcElem, doc.getRootElement(), isRPC); } //svcElem.addTextNode(operation.getInputMessageText()); //svcElem. // Check for a SOAPAction String soapActionURI = operation.getSoapActionURI(); if (soapActionURI != null && soapActionURI.length() > 0) { // Add the SOAPAction value as a MIME header MimeHeaders mimeHeaders = msg.getMimeHeaders(); mimeHeaders.setHeader("SOAPAction", "\"" + operation.getSoapActionURI() + "\""); } // Save changes to the message we just populated msg.saveChanges(); // Get ready for the invocation URLEndpoint endpoint = new URLEndpoint(operation.getTargetURL()); // Show the URL endpoint message in the log ByteArrayOutputStream msgStream = new ByteArrayOutputStream(); msg.writeTo(msgStream); log.debug("SOAP Message MeasurementTarget URL: " + endpoint.getURL()); log.debug("SOAP Request: " + msgStream.toString()); // Make the call SOAPMessage response = connection.call(msg, endpoint); // Close the connection, we are done with it connection.close(); // Get the content of the SOAP response Source responseContent = response.getSOAPPart().getContent(); // Convert the SOAP response into a JDOM TransformerFactory tFact = TransformerFactory.newInstance(); Transformer transformer = tFact.newTransformer(); JDOMResult jdomResult = new JDOMResult(); transformer.transform(responseContent, jdomResult); // Get the document created by the transform operation Document responseDoc = jdomResult.getDocument(); // Send the response to the Log String strResponse = XMLSupport.outputString(responseDoc); log.debug("SOAP Response from: " + operation.getTargetMethodName() + ": " + strResponse); // Set the response as the output message operation.setOutputMessageText(strResponse); // Return the response generated return strResponse; } catch (Throwable ex) { throw new Exception("Error invoking operation", ex); } }
From source file:au.com.ors.rest.controller.AutoCheckController.java
private SOAPMessage createSOAPRequest(String driverLicenseNumber, String fullName, String postCode) throws Exception { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); String serverURI = "http://soap.ors.com.au/pdv"; SOAPEnvelope envelope = soapPart.getEnvelope(); envelope.addNamespaceDeclaration("pdv", serverURI); SOAPBody soapBody = envelope.getBody(); SOAPElement soapElement = soapBody.addChildElement("PDVCheckRequestMsg", "pdv"); SOAPElement soapElementChild1 = soapElement.addChildElement("driverLicenseNumber", "pdv"); soapElementChild1.addTextNode(driverLicenseNumber); SOAPElement soapElementChild2 = soapElement.addChildElement("fullName", "pdv"); soapElementChild2.addTextNode(fullName); SOAPElement soapElementChild3 = soapElement.addChildElement("postCode", "pdv"); soapElementChild3.addTextNode(postCode); // MimeHeaders headers = soapMessage.getMimeHeaders(); // headers.addHeader(S, value); soapMessage.saveChanges();/* w w w . ja va 2s .co m*/ System.out.println("Request SOAP Message:"); soapMessage.writeTo(System.out); return soapMessage; }
From source file:com.polivoto.networking.SoapClient.java
private SOAPMessage createSOAPRequest() throws SOAPException, IOException { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); String serverURI = "http://votingservice.develops.capiz.org"; // SOAP Envelope SOAPEnvelope envelope = soapPart.getEnvelope(); envelope.addNamespaceDeclaration("example", serverURI); /* El siguiente es un ejemplo tomado de donde me bas para armar la solicitud. Constructed SOAP Request Message:/* w w w . jav a 2s . co m*/ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:example="http://ws.cdyne.com/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <example:VerifyEmail> <example:email>mutantninja@gmail.com</example:email> <example:LicenseKey>123</example:LicenseKey> </example:VerifyEmail> </SOAP-ENV:Body> </SOAP-ENV:Envelope> */ // SOAP Body SOAPBody soapBody = envelope.getBody(); SOAPElement soapBodyElem = soapBody.addChildElement("serviceChooser", "example"); SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("json", "example"); soapBodyElem1.addTextNode(json.toString()); MimeHeaders headers = soapMessage.getMimeHeaders(); headers.addHeader("SOAPAction", serverURI + "serviceChooser"); soapMessage.saveChanges(); return soapMessage; }
From source file:com.usps.UspsServlet.java
private SOAPMessage createSOAPRequest(String parameter) { SOAPMessage soapMessage = null; try {/* w w w.j a v a2 s . com*/ MessageFactory messageFactory = MessageFactory.newInstance(); soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); // SOAP Envelope SOAPEnvelope envelope = soapPart.getEnvelope(); envelope.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema"); envelope.addNamespaceDeclaration("upss", "http://www.ups.com/XMLSchema/XOLTWS/UPSS/v1.0"); envelope.addNamespaceDeclaration("wsf", "http://www.ups.com/schema/wsf"); envelope.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance"); envelope.addNamespaceDeclaration("common", "http://www.ups.com/XMLSchema/XOLTWS/Common/v1.0"); // SOAP Body Generated Here // all of the nodes below are mandatory // if any optional nodes are desired refer to the ECHO API or SOAPUI for // exact Node names SOAPBody soapBody = envelope.getBody(); MimeHeaders headers = soapMessage.getMimeHeaders(); headers.addHeader("Security", "wsse"); soapMessage.saveChanges(); /* Print the request message */ System.out.print("Request SOAP Message:"); soapMessage.writeTo(System.out); } catch (SOAPException | IOException ex) { Logger.getLogger(UspsServlet.class.getName()).log(Level.SEVERE, null, ex); } return soapMessage; }
From source file:ee.sk.hwcrypto.demo.controller.SigningController.java
private SOAPMessage SOAPQuery(String req) { try {// www .j a v a 2 s .c om SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance(); SOAPConnection soapConnection = soapConnectionFactory.createConnection(); String url = "http://www.sk.ee/DigiDocService/DigiDocService_2_3.wsdl"; MessageFactory messageFactory = MessageFactory.newInstance(); InputStream is = new ByteArrayInputStream(req.getBytes()); SOAPMessage soapMessage = messageFactory.createMessage(null, is); SOAPPart soapPart = soapMessage.getSOAPPart(); String serverURI = "https://www.openxades.org:8443/DigiDocService/"; // SOAP Envelope SOAPEnvelope envelope = soapPart.getEnvelope(); envelope.addNamespaceDeclaration("", url); MimeHeaders headers = soapMessage.getMimeHeaders(); headers.addHeader("SOAPAction", ""); soapMessage.saveChanges(); SOAPMessage soapResponse = soapConnection.call(soapMessage, serverURI); return soapResponse; } catch (Exception e) { log.error("SOAP Exception " + e); } return null; }
From source file:com.twinsoft.convertigo.engine.translators.WebServiceTranslator.java
public Object buildOutputData(Context context, Object convertigoResponse) throws Exception { Engine.logBeans.debug("[WebServiceTranslator] Encoding the SOAP response..."); SOAPMessage responseMessage = null; String sResponseMessage = ""; String encodingCharSet = "UTF-8"; if (context.requestedObject != null) encodingCharSet = context.requestedObject.getEncodingCharSet(); if (convertigoResponse instanceof Document) { Engine.logBeans.debug("[WebServiceTranslator] The Convertigo response is a XML document."); Document document = Engine.theApp.schemaManager.makeResponse((Document) convertigoResponse); //MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL); MessageFactory messageFactory = MessageFactory.newInstance(); responseMessage = messageFactory.createMessage(); responseMessage.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, encodingCharSet); SOAPPart sp = responseMessage.getSOAPPart(); SOAPEnvelope se = sp.getEnvelope(); SOAPBody sb = se.getBody(); sb.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/"); //se.addNamespaceDeclaration(prefix, targetNameSpace); se.addNamespaceDeclaration("soapenc", "http://schemas.xmlsoap.org/soap/encoding/"); se.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance"); se.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema"); // Remove header as it not used. Seems that empty headers causes the WS client of Flex 4 to fail se.getHeader().detachNode();/*w ww . j av a 2s. com*/ addSoapElement(context, se, sb, document.getDocumentElement()); sResponseMessage = SOAPUtils.toString(responseMessage, encodingCharSet); // Correct missing "xmlns" (Bug AXA POC client .NET) //sResponseMessage = sResponseMessage.replaceAll("<soapenv:Envelope", "<soapenv:Envelope xmlns=\""+targetNameSpace+"\""); } else { Engine.logBeans.debug("[WebServiceTranslator] The Convertigo response is not a XML document."); sResponseMessage = convertigoResponse.toString(); } if (Engine.logBeans.isDebugEnabled()) { Engine.logBeans.debug("[WebServiceTranslator] SOAP response:\n" + sResponseMessage); } return responseMessage == null ? sResponseMessage.getBytes(encodingCharSet) : responseMessage; }
From source file:be.agiv.security.handler.WSAddressingHandler.java
private void handleOutboundMessage(SOAPMessageContext context) throws SOAPException { LOG.debug("adding WS-Addressing headers"); SOAPEnvelope envelope = context.getMessage().getSOAPPart().getEnvelope(); SOAPHeader header = envelope.getHeader(); if (null == header) { header = envelope.addHeader();//w ww .j a v a 2s . c om } String wsuPrefix = null; String wsAddrPrefix = null; Iterator namespacePrefixesIter = envelope.getNamespacePrefixes(); while (namespacePrefixesIter.hasNext()) { String namespacePrefix = (String) namespacePrefixesIter.next(); String namespace = envelope.getNamespaceURI(namespacePrefix); if (WSConstants.WS_ADDR_NAMESPACE.equals(namespace)) { wsAddrPrefix = namespacePrefix; } else if (WSConstants.WS_SECURITY_UTILITY_NAMESPACE.equals(namespace)) { wsuPrefix = namespacePrefix; } } if (null == wsAddrPrefix) { wsAddrPrefix = getUniquePrefix("a", envelope); envelope.addNamespaceDeclaration(wsAddrPrefix, WSConstants.WS_ADDR_NAMESPACE); } if (null == wsuPrefix) { /* * Using "wsu" is very important for the IP-STS X509 credential. * Apparently the STS refuses when the namespace prefix of the * wsu:Id on the WS-Addressing To element is different from the * wsu:Id prefix on the WS-Security timestamp. */ wsuPrefix = "wsu"; envelope.addNamespaceDeclaration(wsuPrefix, WSConstants.WS_SECURITY_UTILITY_NAMESPACE); } SOAPFactory factory = SOAPFactory.newInstance(); SOAPHeaderElement actionHeaderElement = header .addHeaderElement(new QName(WSConstants.WS_ADDR_NAMESPACE, "Action", wsAddrPrefix)); actionHeaderElement.setMustUnderstand(true); actionHeaderElement.addTextNode(this.action); SOAPHeaderElement messageIdElement = header .addHeaderElement(new QName(WSConstants.WS_ADDR_NAMESPACE, "MessageID", wsAddrPrefix)); String messageId = "urn:uuid:" + UUID.randomUUID().toString(); context.put(MESSAGE_ID_CONTEXT_ATTRIBUTE, messageId); messageIdElement.addTextNode(messageId); SOAPHeaderElement replyToElement = header .addHeaderElement(new QName(WSConstants.WS_ADDR_NAMESPACE, "ReplyTo", wsAddrPrefix)); SOAPElement addressElement = factory.createElement("Address", wsAddrPrefix, WSConstants.WS_ADDR_NAMESPACE); addressElement.addTextNode("http://www.w3.org/2005/08/addressing/anonymous"); replyToElement.addChildElement(addressElement); SOAPHeaderElement toElement = header .addHeaderElement(new QName(WSConstants.WS_ADDR_NAMESPACE, "To", wsAddrPrefix)); toElement.setMustUnderstand(true); toElement.addTextNode(this.to); String toIdentifier = "to-id-" + UUID.randomUUID().toString(); toElement.addAttribute(new QName(WSConstants.WS_SECURITY_UTILITY_NAMESPACE, "Id", wsuPrefix), toIdentifier); try { toElement.setIdAttributeNS(WSConstants.WS_SECURITY_UTILITY_NAMESPACE, "Id", true); } catch (UnsupportedOperationException e) { // Axis2 has missing implementation of setIdAttributeNS LOG.error("error setting Id attribute: " + e.getMessage()); } context.put(TO_ID_CONTEXT_ATTRIBUTE, toIdentifier); }
From source file:com.twinsoft.convertigo.engine.translators.WebServiceTranslator.java
public Object __buildOutputData(Context context, Object convertigoResponse) throws Exception { Engine.logBeans.debug("[WebServiceTranslator] Encoding the SOAP response..."); SOAPMessage responseMessage = null; String sResponseMessage = ""; String encodingCharSet = "UTF-8"; if (context.requestedObject != null) encodingCharSet = context.requestedObject.getEncodingCharSet(); if (convertigoResponse instanceof Document) { Engine.logBeans.debug("[WebServiceTranslator] The Convertigo response is a XML document."); Document document = (Document) convertigoResponse; //MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL); MessageFactory messageFactory = MessageFactory.newInstance(); responseMessage = messageFactory.createMessage(); responseMessage.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, encodingCharSet); SOAPPart sp = responseMessage.getSOAPPart(); SOAPEnvelope se = sp.getEnvelope(); SOAPBody sb = se.getBody(); sb.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/"); String targetNamespace = context.project.getTargetNamespace(); String prefix = getPrefix(context.projectName, targetNamespace); //se.addNamespaceDeclaration(prefix, targetNameSpace); se.addNamespaceDeclaration("soapenc", "http://schemas.xmlsoap.org/soap/encoding/"); se.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance"); se.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema"); // Remove header as it not used. Seems that empty headers causes the WS client of Flex 4 to fail se.getHeader().detachNode();/* w w w . j a v a 2 s .c o m*/ // Add the method response element SOAPElement soapMethodResponseElement = null; String soapElementName = context.sequenceName != null ? context.sequenceName : context.connectorName + "__" + context.transactionName; soapElementName += "Response"; soapMethodResponseElement = sb.addChildElement(se.createName(soapElementName, prefix, targetNamespace)); if (XsdForm.qualified == context.project.getSchemaElementForm()) { soapMethodResponseElement.addAttribute(se.createName("xmlns"), targetNamespace); } // Add a 'response' root child element or not SOAPElement soapResponseElement; if (context.sequenceName != null) { Sequence sequence = (Sequence) context.requestedObject; if (sequence.isIncludeResponseElement()) { soapResponseElement = soapMethodResponseElement.addChildElement("response"); } else { soapResponseElement = soapMethodResponseElement; } } else { soapResponseElement = soapMethodResponseElement.addChildElement("response"); } if (soapResponseElement.getLocalName().equals("response")) { if (document.getDocumentElement().hasAttributes()) { addAttributes(responseMessage, se, context, document.getDocumentElement().getAttributes(), soapResponseElement); } } NodeList childNodes = document.getDocumentElement().getChildNodes(); int len = childNodes.getLength(); org.w3c.dom.Node node; for (int i = 0; i < len; i++) { node = childNodes.item(i); if (node instanceof Element) { addElement(responseMessage, se, context, (Element) node, soapResponseElement); } } sResponseMessage = SOAPUtils.toString(responseMessage, encodingCharSet); // Correct missing "xmlns" (Bug AXA POC client .NET) //sResponseMessage = sResponseMessage.replaceAll("<soapenv:Envelope", "<soapenv:Envelope xmlns=\""+targetNameSpace+"\""); } else { Engine.logBeans.debug("[WebServiceTranslator] The Convertigo response is not a XML document."); sResponseMessage = convertigoResponse.toString(); } if (Engine.logBeans.isDebugEnabled()) { Engine.logBeans.debug("[WebServiceTranslator] SOAP response:\n" + sResponseMessage); } return responseMessage == null ? sResponseMessage.getBytes(encodingCharSet) : responseMessage; }