<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_by_API%2Fjavax.xml.soap%2FSOAPElement</id>
		<title>Java by API/javax.xml.soap/SOAPElement - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_by_API%2Fjavax.xml.soap%2FSOAPElement"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_by_API/javax.xml.soap/SOAPElement&amp;action=history"/>
		<updated>2026-04-25T13:02:45Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_by_API/javax.xml.soap/SOAPElement&amp;diff=1723&amp;oldid=prev</id>
		<title> в 17:43, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_by_API/javax.xml.soap/SOAPElement&amp;diff=1723&amp;oldid=prev"/>
				<updated>2010-05-31T17:43:48Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 17:43, 31 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_by_API/javax.xml.soap/SOAPElement&amp;diff=1724&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_by_API/javax.xml.soap/SOAPElement&amp;diff=1724&amp;oldid=prev"/>
				<updated>2010-05-31T14:35:27Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== SOAPElement: addAttribute(Name name, String value) ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import javax.xml.parsers.DocumentBuilder;&lt;br /&gt;
import javax.xml.parsers.DocumentBuilderFactory;&lt;br /&gt;
import javax.xml.soap.MessageFactory;&lt;br /&gt;
import javax.xml.soap.Name;&lt;br /&gt;
import javax.xml.soap.SOAPBody;&lt;br /&gt;
import javax.xml.soap.SOAPBodyElement;&lt;br /&gt;
import javax.xml.soap.SOAPEnvelope;&lt;br /&gt;
import javax.xml.soap.SOAPHeader;&lt;br /&gt;
import javax.xml.soap.SOAPHeaderElement;&lt;br /&gt;
import javax.xml.soap.SOAPMessage;&lt;br /&gt;
import javax.xml.soap.SOAPPart;&lt;br /&gt;
import javax.xml.transform.Source;&lt;br /&gt;
import javax.xml.transform.dom.DOMSource;&lt;br /&gt;
import javax.xml.transform.sax.SAXSource;&lt;br /&gt;
import org.w3c.dom.Document;&lt;br /&gt;
import org.w3c.dom.Node;&lt;br /&gt;
import org.xml.sax.InputSource;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();&lt;br /&gt;
    SOAPPart soapPart = soapMessage.getSOAPPart();&lt;br /&gt;
    SOAPEnvelope soapEnvelope = soapPart.getEnvelope();&lt;br /&gt;
    SOAPHeader soapHeader = soapEnvelope.getHeader();&lt;br /&gt;
    SOAPHeaderElement headerElement = soapHeader.addHeaderElement(soapEnvelope.createName(&lt;br /&gt;
        &amp;quot;Signature&amp;quot;, &amp;quot;SOAP-SEC&amp;quot;, &amp;quot;http://schemas.xmlsoap.org/soap/security/2000-12&amp;quot;));&lt;br /&gt;
    SOAPBody soapBody = soapEnvelope.getBody();&lt;br /&gt;
    soapBody.addAttribute(soapEnvelope.createName(&amp;quot;id&amp;quot;, &amp;quot;SOAP-SEC&amp;quot;,&lt;br /&gt;
        &amp;quot;http://schemas.xmlsoap.org/soap/security/2000-12&amp;quot;), &amp;quot;Body&amp;quot;);&lt;br /&gt;
    Name bodyName = soapEnvelope.createName(&amp;quot;FooBar&amp;quot;, &amp;quot;z&amp;quot;, &amp;quot;http://example.ru&amp;quot;);&lt;br /&gt;
    SOAPBodyElement gltp = soapBody.addBodyElement(bodyName);&lt;br /&gt;
    Source source = soapPart.getContent();&lt;br /&gt;
    Node root = null;&lt;br /&gt;
    if (source instanceof DOMSource) {&lt;br /&gt;
      root = ((DOMSource) source).getNode();&lt;br /&gt;
    } else if (source instanceof SAXSource) {&lt;br /&gt;
      InputSource inSource = ((SAXSource) source).getInputSource();&lt;br /&gt;
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();&lt;br /&gt;
      dbf.setNamespaceAware(true);&lt;br /&gt;
      DocumentBuilder db = null;&lt;br /&gt;
      db = dbf.newDocumentBuilder();&lt;br /&gt;
      Document doc = db.parse(inSource);&lt;br /&gt;
      root = (Node) doc.getDocumentElement();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SOAPElement: addChildElement(QName qname) ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
import java.net.URL;&lt;br /&gt;
import javax.xml.namespace.QName;&lt;br /&gt;
import javax.xml.soap.MessageFactory;&lt;br /&gt;
import javax.xml.soap.SOAPBody;&lt;br /&gt;
import javax.xml.soap.SOAPBodyElement;&lt;br /&gt;
import javax.xml.soap.SOAPConnection;&lt;br /&gt;
import javax.xml.soap.SOAPConnectionFactory;&lt;br /&gt;
import javax.xml.soap.SOAPElement;&lt;br /&gt;
import javax.xml.soap.SOAPHeader;&lt;br /&gt;
import javax.xml.soap.SOAPMessage;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    SOAPConnectionFactory sfc = SOAPConnectionFactory.newInstance();&lt;br /&gt;
    SOAPConnection connection = sfc.createConnection();&lt;br /&gt;
    MessageFactory mf = MessageFactory.newInstance();&lt;br /&gt;
    SOAPMessage sm = mf.createMessage();&lt;br /&gt;
    SOAPHeader sh = sm.getSOAPHeader();&lt;br /&gt;
    SOAPBody sb = sm.getSOAPBody();&lt;br /&gt;
    sh.detachNode();&lt;br /&gt;
    QName bodyName = new QName(&amp;quot;http://quoteCompany.ru&amp;quot;, &amp;quot;GetQuote&amp;quot;, &amp;quot;d&amp;quot;);&lt;br /&gt;
    SOAPBodyElement bodyElement = sb.addBodyElement(bodyName);&lt;br /&gt;
    QName qn = new QName(&amp;quot;aName&amp;quot;);&lt;br /&gt;
    SOAPElement quotation = bodyElement.addChildElement(qn);&lt;br /&gt;
    quotation.addTextNode(&amp;quot;TextMode&amp;quot;);&lt;br /&gt;
    System.out.println(&amp;quot;\n Soap Request:\n&amp;quot;);&lt;br /&gt;
    sm.writeTo(System.out);&lt;br /&gt;
    System.out.println();&lt;br /&gt;
    URL endpoint = new URL(&amp;quot;http://yourServer.ru&amp;quot;);&lt;br /&gt;
    SOAPMessage response = connection.call(sm, endpoint);&lt;br /&gt;
    System.out.println(response.getContentDescription());&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SOAPElement: addTextNode(String text) ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
/*&lt;br /&gt;
 * @(#)SendSOAPMessage.java 1.4 02/05/02&lt;br /&gt;
 *&lt;br /&gt;
 * Copyright (c) 2002 Sun Microsystems, Inc. All Rights Reserved.&lt;br /&gt;
 *&lt;br /&gt;
 * Sun grants you (&amp;quot;Licensee&amp;quot;) a non-exclusive, royalty free, license to use,&lt;br /&gt;
 * modify and redistribute this software in source and binary code form,&lt;br /&gt;
 * provided that i) this copyright notice and license appear on all copies of&lt;br /&gt;
 * the software; and ii) Licensee does not utilize the software in a manner&lt;br /&gt;
 * which is disparaging to Sun.&lt;br /&gt;
 *&lt;br /&gt;
 * This software is provided &amp;quot;AS IS,&amp;quot; without a warranty of any kind. ALL&lt;br /&gt;
 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY&lt;br /&gt;
 * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR&lt;br /&gt;
 * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE&lt;br /&gt;
 * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING&lt;br /&gt;
 * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS&lt;br /&gt;
 * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,&lt;br /&gt;
 * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER&lt;br /&gt;
 * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF&lt;br /&gt;
 * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE&lt;br /&gt;
 * POSSIBILITY OF SUCH DAMAGES.&lt;br /&gt;
 *&lt;br /&gt;
 * This software is not designed or intended for use in on-line control of&lt;br /&gt;
 * aircraft, air traffic, aircraft navigation or aircraft communications; or in&lt;br /&gt;
 * the design, construction, operation or maintenance of any nuclear&lt;br /&gt;
 * facility. Licensee represents and warrants that it will not use or&lt;br /&gt;
 * redistribute the Software for such purposes.&lt;br /&gt;
 */&lt;br /&gt;
import javax.xml.messaging.URLEndpoint;&lt;br /&gt;
import javax.xml.soap.MessageFactory;&lt;br /&gt;
import javax.xml.soap.SOAPMessage;&lt;br /&gt;
import javax.xml.soap.SOAPEnvelope;&lt;br /&gt;
import javax.xml.soap.SOAPBody;&lt;br /&gt;
import javax.xml.soap.SOAPPart;&lt;br /&gt;
import javax.xml.soap.SOAPElement;&lt;br /&gt;
import javax.xml.soap.SOAPException;&lt;br /&gt;
import javax.xml.soap.SOAPConnectionFactory;&lt;br /&gt;
import javax.xml.soap.SOAPConnection;&lt;br /&gt;
/**&lt;br /&gt;
 * This example demonstrates a hello world example for using JAXM API.&lt;br /&gt;
 */&lt;br /&gt;
public class SendSOAPMessage {&lt;br /&gt;
    /**&lt;br /&gt;
     * send a simple soap message with JAXM API.&lt;br /&gt;
     */&lt;br /&gt;
    public void sendMessage (String url) {&lt;br /&gt;
        try {&lt;br /&gt;
            /**&lt;br /&gt;
             * Construct a default SOAP message factory.&lt;br /&gt;
             */&lt;br /&gt;
            MessageFactory mf = MessageFactory.newInstance();&lt;br /&gt;
            /**&lt;br /&gt;
             * Create a SOAP message object.&lt;br /&gt;
             */&lt;br /&gt;
            SOAPMessage soapMessage = mf.createMessage();&lt;br /&gt;
            /**&lt;br /&gt;
             * Get SOAP part.&lt;br /&gt;
             */&lt;br /&gt;
            SOAPPart soapPart = soapMessage.getSOAPPart();&lt;br /&gt;
            /**&lt;br /&gt;
             * Get SOAP envelope.&lt;br /&gt;
             */&lt;br /&gt;
            SOAPEnvelope soapEnvelope = soapPart.getEnvelope();&lt;br /&gt;
            /**&lt;br /&gt;
             * Get SOAP body.&lt;br /&gt;
             */&lt;br /&gt;
            SOAPBody soapBody = soapEnvelope.getBody();&lt;br /&gt;
            /**&lt;br /&gt;
             * Add child element with the specified name.&lt;br /&gt;
             */&lt;br /&gt;
            SOAPElement element = soapBody.addChildElement(&amp;quot;HelloWorld&amp;quot;);&lt;br /&gt;
            /**&lt;br /&gt;
             * Add text message&lt;br /&gt;
             */&lt;br /&gt;
            element.addTextNode(&amp;quot;Welcome to SunOne Web Services!&amp;quot;);&lt;br /&gt;
            soapMessage.saveChanges();&lt;br /&gt;
            /**&lt;br /&gt;
             * Construct a default SOAP connection factory.&lt;br /&gt;
             */&lt;br /&gt;
            SOAPConnectionFactory connectionFactory = SOAPConnectionFactory.newInstance();&lt;br /&gt;
            /**&lt;br /&gt;
             * Get SOAP connection.&lt;br /&gt;
             */&lt;br /&gt;
            SOAPConnection soapConnection = connectionFactory.createConnection();&lt;br /&gt;
            /**&lt;br /&gt;
             * Construct endpoint object.&lt;br /&gt;
             */&lt;br /&gt;
            URLEndpoint endpoint = new URLEndpoint (url);&lt;br /&gt;
            /**&lt;br /&gt;
             * Send SOAP message.&lt;br /&gt;
             */&lt;br /&gt;
            SOAPMessage resp = soapConnection.call(soapMessage, endpoint);&lt;br /&gt;
            /**&lt;br /&gt;
             * Print response to the std output.&lt;br /&gt;
             */&lt;br /&gt;
            resp.writeTo( System.out );&lt;br /&gt;
            /**&lt;br /&gt;
             * close the connection&lt;br /&gt;
             */&lt;br /&gt;
            soapConnection.close();&lt;br /&gt;
        } catch (java.io.IOException ioe) {&lt;br /&gt;
            ioe.printStackTrace();&lt;br /&gt;
        } catch (SOAPException soape) {&lt;br /&gt;
            soape.printStackTrace();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public static void main (String args[]) {&lt;br /&gt;
        String url = &amp;quot;http://localhost:8080/imqSOAPexamples/SOAPEchoServlet&amp;quot;;&lt;br /&gt;
        if (args.length &amp;gt; 0) {&lt;br /&gt;
            url = args[0];&lt;br /&gt;
        } else {&lt;br /&gt;
            System.out.println(&amp;quot;Usage: &amp;quot; +&lt;br /&gt;
                &amp;quot;\tjava SendSOAPMessage &amp;lt;SOAP servlet url&amp;gt;\n&amp;quot; +&lt;br /&gt;
                &amp;quot;e.g.\n\tjava SendSOAPMessage http://localhost:8080/imqSOAPexamples/SOAPEchoServlet&amp;quot;&lt;br /&gt;
                );&lt;br /&gt;
            System.exit(1);&lt;br /&gt;
        }&lt;br /&gt;
        SendSOAPMessage ssm = new SendSOAPMessage();&lt;br /&gt;
        ssm.sendMessage(url);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SOAPElement: getChildElements(QName qname) ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
import java.net.URL;&lt;br /&gt;
import javax.xml.namespace.QName;&lt;br /&gt;
import javax.xml.soap.MessageFactory;&lt;br /&gt;
import javax.xml.soap.SOAPBody;&lt;br /&gt;
import javax.xml.soap.SOAPBodyElement;&lt;br /&gt;
import javax.xml.soap.SOAPConnection;&lt;br /&gt;
import javax.xml.soap.SOAPConnectionFactory;&lt;br /&gt;
import javax.xml.soap.SOAPMessage;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    SOAPConnectionFactory sfc = SOAPConnectionFactory.newInstance();&lt;br /&gt;
    SOAPConnection connection = sfc.createConnection();&lt;br /&gt;
    MessageFactory mf = MessageFactory.newInstance();&lt;br /&gt;
    SOAPMessage sm = mf.createMessage();&lt;br /&gt;
    QName bodyName = new QName(&amp;quot;http://YourSOAPServer.ru&amp;quot;, &amp;quot;GetQuote&amp;quot;, &amp;quot;d&amp;quot;);&lt;br /&gt;
    URL endpoint = new URL(&amp;quot;http://YourSOAPServer.ru&amp;quot;);&lt;br /&gt;
    SOAPMessage response = connection.call(sm, endpoint);&lt;br /&gt;
    SOAPBody sb = response.getSOAPBody();&lt;br /&gt;
    java.util.Iterator iterator = sb.getChildElements(bodyName);&lt;br /&gt;
    while (iterator.hasNext()) {&lt;br /&gt;
      SOAPBodyElement bodyElement = (SOAPBodyElement) iterator.next();&lt;br /&gt;
      String val = bodyElement.getValue();&lt;br /&gt;
      System.out.println(&amp;quot;The Value is:&amp;quot; + val);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>