<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.innovaphone.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Franciscopaletta</id>
	<title>innovaphone wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.innovaphone.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Franciscopaletta"/>
	<link rel="alternate" type="text/html" href="https://wiki.innovaphone.com/index.php?title=Special:Contributions/Franciscopaletta"/>
	<updated>2026-05-11T01:53:31Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://wiki.innovaphone.com/index.php?title=Howto:SOAP_API_Admin_Java_Sample_Code&amp;diff=49930</id>
		<title>Howto:SOAP API Admin Java Sample Code</title>
		<link rel="alternate" type="text/html" href="https://wiki.innovaphone.com/index.php?title=Howto:SOAP_API_Admin_Java_Sample_Code&amp;diff=49930"/>
		<updated>2018-06-11T18:05:01Z</updated>

		<summary type="html">&lt;p&gt;Franciscopaletta: /* The sample application */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{3rd_Party_Input}}&lt;br /&gt;
==Applies To==&lt;br /&gt;
This information applies to&lt;br /&gt;
&lt;br /&gt;
* any innovaphone PBX platform&lt;br /&gt;
* Java Runtime Environment&lt;br /&gt;
&lt;br /&gt;
innovaphone PBX web services can be used from Java Runtime Environment.  Here is how&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- web service, soap service, soapservice, webservice, basic, soap api, soapapi --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==More Information==&lt;br /&gt;
===Configuration===&lt;br /&gt;
Modify the global variables &#039;&#039;SOAPENDPOINTURL&#039;&#039;, &#039;&#039;ADMSOAPUSER&#039;&#039;, &#039;&#039;ADMSOAPUSERPWD&#039;&#039;, &#039;&#039;SOAPUSER&#039;&#039; and &#039;&#039;CNUSER&#039;&#039; according to your specific system.&lt;br /&gt;
&lt;br /&gt;
===Running Sample Code===&lt;br /&gt;
This code is a simple Java console application. It will run on your OS console terminal. As dependencies, you will need JDK to compile the code and JRE to execute it.&lt;br /&gt;
&lt;br /&gt;
To &#039;&#039;&#039;compile&#039;&#039;&#039;, save the code on file &#039;&#039;&#039;innoSOAPadm.java&#039;&#039;&#039; and provide that file as parameter to &#039;&#039;&#039;javac&#039;&#039;&#039; command.&lt;br /&gt;
*The below code was compiled on javac version 1.8.0 and run on java version 1.8.0 (It was not tested on other versions)&lt;br /&gt;
*You may get a warning regarding the function sun.misc.BASE64Encoder().encode() because it is deprecated. Nevertheless the code will run. You may remove that section of the code (used just for authentication on the PBX) but you will have to allow &amp;quot;public&amp;quot; access to /PBX0/user.soap on HTTP(security risk!!!).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====The sample application ====&lt;br /&gt;
This section will discuss the sample code.  It is not a decent description of the PBX SOAP API.  For this, see the related articles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code java&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import javax.xml.soap.*;&lt;br /&gt;
import javax.xml.parsers.DocumentBuilderFactory;&lt;br /&gt;
import javax.xml.parsers.DocumentBuilder;&lt;br /&gt;
&lt;br /&gt;
import org.w3c.dom.Document;&lt;br /&gt;
import org.w3c.dom.Element;&lt;br /&gt;
import org.w3c.dom.NodeList;&lt;br /&gt;
import org.w3c.dom.NamedNodeMap;&lt;br /&gt;
&lt;br /&gt;
import javax.xml.soap.MessageFactory;&lt;br /&gt;
import javax.xml.soap.SOAPException;&lt;br /&gt;
import javax.xml.soap.SOAPMessage;&lt;br /&gt;
import javax.xml.soap.SOAPElement;&lt;br /&gt;
import javax.xml.soap.SOAPBody;&lt;br /&gt;
&lt;br /&gt;
import javax.xml.parsers.ParserConfigurationException;&lt;br /&gt;
import org.xml.sax.InputSource;&lt;br /&gt;
import org.xml.sax.SAXException;&lt;br /&gt;
import java.io.StringReader;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
  &lt;br /&gt;
 &lt;br /&gt;
import javax.xml.soap.Node;&lt;br /&gt;
&lt;br /&gt;
public class innoSOAPadm {  &lt;br /&gt;
    &lt;br /&gt;
    //innovaphone general information&lt;br /&gt;
    private static final String MYNAMESPACE = &amp;quot;pbx&amp;quot;;&lt;br /&gt;
    private static final String MYNAMESPACEURI = &amp;quot;http://www.innovaphone.com/pbx&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
    //specific system information&lt;br /&gt;
    private static final String SOAPACTION = &amp;quot;&amp;quot;;&lt;br /&gt;
    private static final String SOAPENDPOINTURL = &amp;quot;http://192.168.0.1/PBX0/user.soap&amp;quot;;&lt;br /&gt;
    private static final String ADMSOAPUSER = &amp;quot;admin&amp;quot;; //PBX admin user&lt;br /&gt;
    private static final String ADMSOAPUSERPWD = &amp;quot;ip311&amp;quot;; //PBX admin password&lt;br /&gt;
    private static final String SOAPUSER = &amp;quot;SOAP&amp;quot;; //SOAP user object in PBX with group access to other objects&lt;br /&gt;
    private static final String CNUSER = &amp;quot;PBX User Four&amp;quot;; //CN of user to perform Poll on&lt;br /&gt;
&lt;br /&gt;
    // Main function&lt;br /&gt;
    public static void main(String args[]) {&lt;br /&gt;
        callSoapWebService(SOAPENDPOINTURL, SOAPACTION);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //Starts web connection and execute the SOAP calls&lt;br /&gt;
    private static void callSoapWebService(String soapEndpointUrl, String soapAction) {&lt;br /&gt;
        try {&lt;br /&gt;
            &lt;br /&gt;
            String session=&amp;quot;&amp;quot;;&lt;br /&gt;
            String user=&amp;quot;&amp;quot;;&lt;br /&gt;
            String response=&amp;quot;&amp;quot;;&lt;br /&gt;
            &lt;br /&gt;
            // Create SOAP Connection&lt;br /&gt;
            SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();&lt;br /&gt;
            SOAPConnection soapConnection = soapConnectionFactory.createConnection();   &lt;br /&gt;
&lt;br /&gt;
            SOAPMessage soapResponse = soapConnection.call(createSOAPRequest_Admin(soapAction, session), soapEndpointUrl);&lt;br /&gt;
&lt;br /&gt;
            // Print the SOAP Response&lt;br /&gt;
            System.out.println(&amp;quot;Response SOAP Message Trimmed to &amp;lt;return&amp;gt;:&amp;quot;);&lt;br /&gt;
            SOAPBody body = soapResponse.getSOAPBody();&lt;br /&gt;
            NodeList returnList = body.getElementsByTagName(&amp;quot;return&amp;quot;);&lt;br /&gt;
            response=returnList.item(0).getTextContent();&lt;br /&gt;
            System.out.println(response);&lt;br /&gt;
            System.out.println(&amp;quot;&amp;quot;);&lt;br /&gt;
            &lt;br /&gt;
            System.out.println(&amp;quot;Response parsed to Nodes and Attributes:&amp;quot;);&lt;br /&gt;
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();&lt;br /&gt;
            DocumentBuilder builder = factory.newDocumentBuilder();&lt;br /&gt;
            InputSource is = new InputSource(new StringReader(response));&lt;br /&gt;
            Document doc = builder.parse(is);&lt;br /&gt;
            nodeListPrint(doc.getElementsByTagName(&amp;quot;show&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
            soapConnection.close();&lt;br /&gt;
            &lt;br /&gt;
        } catch (Exception e) {&lt;br /&gt;
            System.err.println(&amp;quot;\nError occurred while sending SOAP Request to Server!\nMake sure you have the correct endpoint URL and SOAPAction!\n&amp;quot;);&lt;br /&gt;
            e.printStackTrace();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //Creates a SOAPmessage with the &amp;quot;Admin&amp;quot; instruction&lt;br /&gt;
    private static SOAPMessage createSOAPRequest_Admin(String soapAction, String session) throws Exception {&lt;br /&gt;
        MessageFactory messageFactory = MessageFactory.newInstance();&lt;br /&gt;
        SOAPMessage soapMessage = messageFactory.createMessage();&lt;br /&gt;
        SOAPPart soapPart = soapMessage.getSOAPPart();&lt;br /&gt;
        &lt;br /&gt;
        // SOAP Envelope&lt;br /&gt;
        SOAPEnvelope envelope = soapPart.getEnvelope();&lt;br /&gt;
        envelope.addNamespaceDeclaration(MYNAMESPACE, MYNAMESPACEURI);&lt;br /&gt;
        &lt;br /&gt;
        // SOAP Body&lt;br /&gt;
        SOAPBody soapBody = envelope.getBody();&lt;br /&gt;
        SOAPElement soapBodyElem = soapBody.addChildElement(&amp;quot;Admin&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem2 = soapBodyElem.addChildElement(&amp;quot;xml&amp;quot;);&lt;br /&gt;
        Name sdcPDUPduName = envelope.createName(&amp;quot;type&amp;quot;, &amp;quot;xsi&amp;quot;, &amp;quot;http://www.innovaphone.com/pbx&amp;quot;);&lt;br /&gt;
        soapBodyElem2.addAttribute(sdcPDUPduName, &amp;quot;xsd:string&amp;quot;);&lt;br /&gt;
        soapBodyElem2.setTextContent(&amp;quot;&amp;lt;show&amp;gt;&amp;lt;user cn=\&amp;quot;&amp;quot; + CNUSER + &amp;quot;\&amp;quot; /&amp;gt;&amp;lt;/show&amp;gt;&amp;quot;);&lt;br /&gt;
                &lt;br /&gt;
        MimeHeaders headers = soapMessage.getMimeHeaders();&lt;br /&gt;
        headers.addHeader(&amp;quot;SOAPAction&amp;quot;, soapAction);&lt;br /&gt;
&lt;br /&gt;
        String authorization = new sun.misc.BASE64Encoder().encode((ADMSOAPUSER+&amp;quot;:&amp;quot;+ADMSOAPUSERPWD).getBytes());&lt;br /&gt;
        headers.addHeader(&amp;quot;Authorization&amp;quot;, &amp;quot;Basic &amp;quot; + authorization);&lt;br /&gt;
&lt;br /&gt;
        soapMessage.saveChanges();&lt;br /&gt;
&lt;br /&gt;
        /* Print the request message, just for debugging purposes */&lt;br /&gt;
        System.out.println(&amp;quot;Request SOAP Message:&amp;quot;);&lt;br /&gt;
        soapMessage.writeTo(System.out);&lt;br /&gt;
        System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        return soapMessage;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //Prints all nodes on the nodelist&lt;br /&gt;
    private static void nodeListPrint(NodeList list){&lt;br /&gt;
        NodeList childList;     &lt;br /&gt;
        for (int i = 0; i &amp;lt; list.getLength(); i++) {&lt;br /&gt;
            System.out.println(&amp;quot;&amp;lt;&amp;quot;+String.valueOf(list.item(i).getNodeName())+&amp;quot;&amp;gt;&amp;quot;);&lt;br /&gt;
            try {&lt;br /&gt;
                if(list.item(i).hasAttributes()) {&lt;br /&gt;
                    nodeListAttribPrint(list.item(i).getAttributes());&lt;br /&gt;
                }&lt;br /&gt;
                if(list.item(i).hasChildNodes()) {&lt;br /&gt;
                    System.out.println(&amp;quot;&amp;quot;);&lt;br /&gt;
                    childList = list.item(i).getChildNodes();&lt;br /&gt;
                    nodeListPrint(childList);&lt;br /&gt;
                } else {&lt;br /&gt;
                    System.out.println(&amp;quot;&amp;quot;);&lt;br /&gt;
                }&lt;br /&gt;
            } catch(Exception x) {&lt;br /&gt;
                System.out.println(&amp;quot;\nError getting attributes or child nodes....&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        } &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    private static void nodeListAttribPrint(NamedNodeMap node) {&lt;br /&gt;
        for (int i = 0; i &amp;lt; node.getLength(); i++) {&lt;br /&gt;
            System.out.println(node.item(i).getNodeName() + &amp;quot; = \&amp;quot;&amp;quot; + node.item(i).getNodeValue() + &amp;quot;\&amp;quot;&amp;quot;);&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;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Known Problems ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related Articles==&lt;br /&gt;
[[Reference:SOAP API]]&lt;br /&gt;
&lt;br /&gt;
[[Howto:PBX SOAP Api C-sharp sample code ]]&lt;br /&gt;
&lt;br /&gt;
[[Howto:SOAP with PHP5]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--*[[Main_Page|wiki-innovaphone]]--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Sample|{{PAGENAME}}]]&lt;/div&gt;</summary>
		<author><name>Franciscopaletta</name></author>
	</entry>
	<entry>
		<id>https://wiki.innovaphone.com/index.php?title=Howto:SOAP_API_Admin_Java_Sample_Code&amp;diff=49907</id>
		<title>Howto:SOAP API Admin Java Sample Code</title>
		<link rel="alternate" type="text/html" href="https://wiki.innovaphone.com/index.php?title=Howto:SOAP_API_Admin_Java_Sample_Code&amp;diff=49907"/>
		<updated>2018-06-08T19:26:06Z</updated>

		<summary type="html">&lt;p&gt;Franciscopaletta: New page: {{3rd_Party_Input}} ==Applies To== This information applies to  * any innovaphone PBX platform * Java Runtime Environment  innovaphone PBX web services can be used from Java Runtime Enviro...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{3rd_Party_Input}}&lt;br /&gt;
==Applies To==&lt;br /&gt;
This information applies to&lt;br /&gt;
&lt;br /&gt;
* any innovaphone PBX platform&lt;br /&gt;
* Java Runtime Environment&lt;br /&gt;
&lt;br /&gt;
innovaphone PBX web services can be used from Java Runtime Environment.  Here is how&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- web service, soap service, soapservice, webservice, basic, soap api, soapapi --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==More Information==&lt;br /&gt;
===Configuration===&lt;br /&gt;
Modify the global variables &#039;&#039;SOAPENDPOINTURL&#039;&#039;, &#039;&#039;ADMSOAPUSER&#039;&#039;, &#039;&#039;ADMSOAPUSERPWD&#039;&#039;, &#039;&#039;SOAPUSER&#039;&#039; and &#039;&#039;CNUSER&#039;&#039; according to your specific system.&lt;br /&gt;
&lt;br /&gt;
===Running Sample Code===&lt;br /&gt;
This code is a simple Java console application. It will run on your OS console terminal. As dependencies, you will need JDK to compile the code and JRE to execute it.&lt;br /&gt;
&lt;br /&gt;
To &#039;&#039;&#039;compile&#039;&#039;&#039;, save the code on file &#039;&#039;&#039;innoSOAPadm.java&#039;&#039;&#039; and provide that file as parameter to &#039;&#039;&#039;javac&#039;&#039;&#039; command.&lt;br /&gt;
*The below code was compiled on javac version 1.8.0 and run on java version 1.8.0 (It was not tested on other versions)&lt;br /&gt;
*You may get a warning regarding the function sun.misc.BASE64Encoder().encode() because it is deprecated. Nevertheless the code will run. You may remove that section of the code (used just for authentication on the PBX) but you will have to allow &amp;quot;public&amp;quot; access to /PBX0/user.soap on HTTP(security risk!!!).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====The sample application ====&lt;br /&gt;
This section will discuss the sample code.  It is not a decent description of the PBX SOAP API.  For this, see the related articles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code java&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import javax.xml.soap.*;&lt;br /&gt;
import javax.xml.parsers.DocumentBuilderFactory;&lt;br /&gt;
import javax.xml.parsers.DocumentBuilder;&lt;br /&gt;
&lt;br /&gt;
import org.w3c.dom.Document;&lt;br /&gt;
import org.w3c.dom.Element;&lt;br /&gt;
import org.w3c.dom.NodeList;&lt;br /&gt;
&lt;br /&gt;
import javax.xml.soap.MessageFactory;&lt;br /&gt;
import javax.xml.soap.SOAPException;&lt;br /&gt;
import javax.xml.soap.SOAPMessage;&lt;br /&gt;
import javax.xml.soap.SOAPElement;&lt;br /&gt;
import javax.xml.soap.SOAPBody;&lt;br /&gt;
&lt;br /&gt;
import javax.xml.parsers.ParserConfigurationException;&lt;br /&gt;
import org.xml.sax.InputSource;&lt;br /&gt;
import org.xml.sax.SAXException;&lt;br /&gt;
import java.io.StringReader;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
  &lt;br /&gt;
 &lt;br /&gt;
import javax.xml.soap.Node;&lt;br /&gt;
&lt;br /&gt;
public class innoSOAPadm {  &lt;br /&gt;
    &lt;br /&gt;
    //innovaphone general information&lt;br /&gt;
    private static final String MYNAMESPACE = &amp;quot;pbx&amp;quot;;&lt;br /&gt;
    private static final String MYNAMESPACEURI = &amp;quot;http://www.innovaphone.com/pbx&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
    //specific system information&lt;br /&gt;
    private static final String SOAPACTION = &amp;quot;&amp;quot;;&lt;br /&gt;
    private static final String SOAPENDPOINTURL = &amp;quot;http://192.168.0.1/PBX0/user.soap&amp;quot;;&lt;br /&gt;
    private static final String ADMSOAPUSER = &amp;quot;admin&amp;quot;; //PBX admin user&lt;br /&gt;
    private static final String ADMSOAPUSERPWD = &amp;quot;ip311&amp;quot;; //PBX admin password&lt;br /&gt;
    private static final String SOAPUSER = &amp;quot;SOAP&amp;quot;; //SOAP user object in PBX with group access to other objects&lt;br /&gt;
    private static final String CNUSER = &amp;quot;PBX User Four&amp;quot;; //CN of user to perform Poll on&lt;br /&gt;
&lt;br /&gt;
    // Main function&lt;br /&gt;
    public static void main(String args[]) {&lt;br /&gt;
        callSoapWebService(SOAPENDPOINTURL, SOAPACTION);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //Starts web connection and execute the SOAP calls&lt;br /&gt;
    private static void callSoapWebService(String soapEndpointUrl, String soapAction) {&lt;br /&gt;
        try {&lt;br /&gt;
            &lt;br /&gt;
            String session=&amp;quot;&amp;quot;;&lt;br /&gt;
            String user=&amp;quot;&amp;quot;;&lt;br /&gt;
            String response=&amp;quot;&amp;quot;;&lt;br /&gt;
            &lt;br /&gt;
            // Create SOAP Connection&lt;br /&gt;
            SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();&lt;br /&gt;
            SOAPConnection soapConnection = soapConnectionFactory.createConnection();   &lt;br /&gt;
&lt;br /&gt;
            SOAPMessage soapResponse = soapConnection.call(createSOAPRequest_Admin(soapAction, session), soapEndpointUrl);&lt;br /&gt;
&lt;br /&gt;
            // Print the SOAP Response&lt;br /&gt;
            System.out.println(&amp;quot;Response SOAP Message:&amp;quot;);&lt;br /&gt;
            &lt;br /&gt;
            SOAPBody body = soapResponse.getSOAPBody();&lt;br /&gt;
            NodeList returnList = body.getElementsByTagName(&amp;quot;return&amp;quot;);&lt;br /&gt;
            System.out.println(&amp;quot;Response Parsed:&amp;quot;);&lt;br /&gt;
            response=returnList.item(0).getTextContent();&lt;br /&gt;
            System.out.println(response);&lt;br /&gt;
            System.out.println(&amp;quot;&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
            soapConnection.close();&lt;br /&gt;
            &lt;br /&gt;
        } catch (Exception e) {&lt;br /&gt;
            System.err.println(&amp;quot;\nError occurred while sending SOAP Request to Server!\nMake sure you have the correct endpoint URL and SOAPAction!\n&amp;quot;);&lt;br /&gt;
            e.printStackTrace();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //Creates a SOAPmessage with the &amp;quot;Admin&amp;quot; instruction&lt;br /&gt;
    private static SOAPMessage createSOAPRequest_Admin(String soapAction, String session) throws Exception {&lt;br /&gt;
        MessageFactory messageFactory = MessageFactory.newInstance();&lt;br /&gt;
        SOAPMessage soapMessage = messageFactory.createMessage();&lt;br /&gt;
        SOAPPart soapPart = soapMessage.getSOAPPart();&lt;br /&gt;
        &lt;br /&gt;
        // SOAP Envelope&lt;br /&gt;
        SOAPEnvelope envelope = soapPart.getEnvelope();&lt;br /&gt;
        envelope.addNamespaceDeclaration(MYNAMESPACE, MYNAMESPACEURI);&lt;br /&gt;
        &lt;br /&gt;
        // SOAP Body&lt;br /&gt;
        SOAPBody soapBody = envelope.getBody();&lt;br /&gt;
        SOAPElement soapBodyElem = soapBody.addChildElement(&amp;quot;Admin&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem2 = soapBodyElem.addChildElement(&amp;quot;xml&amp;quot;);&lt;br /&gt;
        Name sdcPDUPduName = envelope.createName(&amp;quot;type&amp;quot;, &amp;quot;xsi&amp;quot;, &amp;quot;http://www.innovaphone.com/pbx&amp;quot;);&lt;br /&gt;
        soapBodyElem2.addAttribute(sdcPDUPduName, &amp;quot;xsd:string&amp;quot;);&lt;br /&gt;
        soapBodyElem2.setTextContent(&amp;quot;&amp;lt;show&amp;gt;&amp;lt;user cn=\&amp;quot;&amp;quot; + CNUSER + &amp;quot;\&amp;quot; /&amp;gt;&amp;lt;/show&amp;gt;&amp;quot;);&lt;br /&gt;
                &lt;br /&gt;
        MimeHeaders headers = soapMessage.getMimeHeaders();&lt;br /&gt;
        headers.addHeader(&amp;quot;SOAPAction&amp;quot;, soapAction);&lt;br /&gt;
&lt;br /&gt;
        String authorization = new sun.misc.BASE64Encoder().encode((ADMSOAPUSER+&amp;quot;:&amp;quot;+ADMSOAPUSERPWD).getBytes());&lt;br /&gt;
        headers.addHeader(&amp;quot;Authorization&amp;quot;, &amp;quot;Basic &amp;quot; + authorization);&lt;br /&gt;
&lt;br /&gt;
        soapMessage.saveChanges();&lt;br /&gt;
&lt;br /&gt;
        /* Print the request message, just for debugging purposes */&lt;br /&gt;
        System.out.println(&amp;quot;Request SOAP Message:&amp;quot;);&lt;br /&gt;
        soapMessage.writeTo(System.out);&lt;br /&gt;
        System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        return soapMessage;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Known Problems ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related Articles==&lt;br /&gt;
[[Reference:SOAP API]]&lt;br /&gt;
&lt;br /&gt;
[[Howto:PBX SOAP Api C-sharp sample code ]]&lt;br /&gt;
&lt;br /&gt;
[[Howto:SOAP with PHP5]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--*[[Main_Page|wiki-innovaphone]]--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Sample|{{PAGENAME}}]]&lt;/div&gt;</summary>
		<author><name>Franciscopaletta</name></author>
	</entry>
	<entry>
		<id>https://wiki.innovaphone.com/index.php?title=Howto:Using_the_SOAP_Admin_Function&amp;diff=49906</id>
		<title>Howto:Using the SOAP Admin Function</title>
		<link rel="alternate" type="text/html" href="https://wiki.innovaphone.com/index.php?title=Howto:Using_the_SOAP_Admin_Function&amp;diff=49906"/>
		<updated>2018-06-08T19:18:15Z</updated>

		<summary type="html">&lt;p&gt;Franciscopaletta: /* Related Articles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The [[Reference:SOAP API|PBX SOAP interface]] allows you to query and manipulate the entire PBX object configuration (i.e. users).  Here is the syntax of the commands.&lt;br /&gt;
==Applies To==&lt;br /&gt;
This information applies to&lt;br /&gt;
&lt;br /&gt;
* all innovaphone PBX platforms&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- SOAP, Admin, programmatic access, api, configuration, --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==More Information==&lt;br /&gt;
&lt;br /&gt;
===Problem Details===&lt;br /&gt;
Sometimes, there is a need to access the PBX object configuration (that is, the defined users, trunk lines, nodes, etc.) programmatically.  This could be done for examination or for manipulation.&lt;br /&gt;
&lt;br /&gt;
There are various ways to accomplish this, one of it is using the [[Reference:SOAP_API#string_Admin.28string_xml.29|Admin function]] available in the [[Reference:SOAP_API|SOAP API]].&lt;br /&gt;
&lt;br /&gt;
This function takes a single argument &#039;&#039;&#039;xml&#039;&#039;&#039;, which is executed as a command and the resulting output is returned to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===System Requirements===&lt;br /&gt;
The SOAP interface and thus the SOAP API&#039;s &#039;&#039;&#039;Admin&#039;&#039;&#039; is available when a working PBX is present in a Box.  Please note that the usual restrictions apply for updating entries, namely, entries shall not be modified when LDAP replication is active on the box.  Instead, connect to the LDAP masters SOAP interface and do the modifications.&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
The Admin() function may be used to retrieve information from and write information to the PBX.  Information written to the PBX is effective immediately.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xml&#039;&#039;&#039; argument to &#039;&#039;&#039;Admin()&#039;&#039;&#039; is an xml string, that has a single top-level element, which is interpreted as command.&lt;br /&gt;
&lt;br /&gt;
Depending on the way the SOAP request is sent the provided &#039;&#039;&#039;xml&#039;&#039;&#039; argument must be manually XML escaped:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code mxml&amp;gt;&lt;br /&gt;
&amp;quot;   &amp;amp;quot;&lt;br /&gt;
&#039;   &amp;amp;apos;&lt;br /&gt;
&amp;lt;   &amp;amp;lt;&lt;br /&gt;
&amp;gt;   &amp;amp;gt;&lt;br /&gt;
&amp;amp;   &amp;amp;amp;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;code mxml&amp;gt;&lt;br /&gt;
 &amp;amp;lt;show&amp;amp;gt;&amp;amp;lt;user cn=&amp;amp;quot;PBX User Four&amp;amp;quot; config=&amp;amp;quot;true&amp;amp;quot;/&amp;amp;gt;&amp;amp;lt;/show&amp;amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are various commands implemented.&lt;br /&gt;
====show====&lt;br /&gt;
The &#039;&#039;&#039;show&#039;&#039;&#039; command will show details about an object, selected by its &#039;&#039;&#039;cn&#039;&#039;&#039; (which is the long name in the PBX user config), e.g.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;show&amp;gt;&amp;lt;user cn=&amp;quot;PBX User Four&amp;quot; config=&amp;quot;true&amp;quot;/&amp;gt;&amp;lt;/show&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code xml&amp;gt;&lt;br /&gt;
&amp;lt;SOAP-ENV:Envelope xmlns:SOAP-ENV=&amp;quot;http://schemas.xmlsoap.org/soap/envelope/&amp;quot; xmlns:pbx=&amp;quot;http://www.innovaphone.com/pbx&amp;quot;&amp;gt;&amp;lt;SOAP-ENV:Header/&amp;gt;&amp;lt;SOAP-ENV:Body&amp;gt;&lt;br /&gt;
&amp;lt;Admin&amp;gt;&amp;lt;xml xsi:type=&amp;quot;xsd:string&amp;quot;&amp;gt;&amp;amp;lt;show&amp;amp;gt;&amp;amp;lt;user cn=&amp;quot;PBX User Four&amp;quot; config=&amp;quot;true&amp;quot;/&amp;amp;gt;&amp;amp;lt;/show&amp;amp;gt;&amp;lt;/xml&amp;gt;&lt;br /&gt;
&amp;lt;/Admin&amp;gt;&amp;lt;/SOAP-ENV:Body&amp;gt;&amp;lt;/SOAP-ENV:Envelope&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The attribute config=&amp;quot;true&amp;quot; (available starting with version 9) is optional. If used only the pure config stored at a user is provided, without application of templates.&lt;br /&gt;
&lt;br /&gt;
The command will return the data for &#039;&#039;&#039;PBX User Four&#039;&#039;&#039; (provided there is one):&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;show time=&amp;quot;2994&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;user &lt;br /&gt;
        cn=&amp;quot;PBX User Four&amp;quot; &lt;br /&gt;
        guid=&amp;quot;4126ec4ee909d3119db10090330600e8&amp;quot; &lt;br /&gt;
        e164=&amp;quot;140&amp;quot; &lt;br /&gt;
        h323=&amp;quot;user-4&amp;quot; &lt;br /&gt;
        pwd=&amp;quot;********&amp;quot; &lt;br /&gt;
        fake=&amp;quot;123&amp;quot; &lt;br /&gt;
        cfnr=&amp;quot;99&amp;quot; &lt;br /&gt;
        busy-out=&amp;quot;4711&amp;quot; &lt;br /&gt;
        loc=&amp;quot;Sindelfingen&amp;quot; &lt;br /&gt;
        node=&amp;quot;root&amp;quot; &lt;br /&gt;
        filter=&amp;quot;normal&amp;quot; &lt;br /&gt;
        cd-filter=&amp;quot;normal&amp;quot; &lt;br /&gt;
        type=&amp;quot;ep&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;cd &lt;br /&gt;
        type=&amp;quot;cfb&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;ep &lt;br /&gt;
            e164=&amp;quot;0900123&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/cd&amp;gt;&lt;br /&gt;
    &amp;lt;cd &lt;br /&gt;
        type=&amp;quot;cfnr&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;ep &lt;br /&gt;
            e164=&amp;quot;0900321&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/cd&amp;gt;&amp;lt;&lt;br /&gt;
    &amp;lt;grp &lt;br /&gt;
        name=&amp;quot;test&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;grp &lt;br /&gt;
        name=&amp;quot;soap&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ep &lt;br /&gt;
        type=&amp;quot;EP&amp;quot; &lt;br /&gt;
        addr=&amp;quot;172.16.10.38&amp;quot; &lt;br /&gt;
        port=&amp;quot;2069&amp;quot; &lt;br /&gt;
        product=&amp;quot;innovaphone IP230 [-/08-6090020/20080116-01]&amp;quot; &lt;br /&gt;
        version=&amp;quot;6.00 dvl-sr2 [08-60900.20/222/104]&amp;quot; &lt;br /&gt;
        h323=&amp;quot;user-4&amp;quot; &lt;br /&gt;
        time=&amp;quot;336&amp;quot; &lt;br /&gt;
        lic=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/user&amp;gt;&lt;br /&gt;
&amp;lt;/show&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As a special case, you can use the cn &#039;&#039;&#039;*&#039;&#039;&#039; which will yield a list of all known objects. But be aware that the result of a SOAP request is limited to a fixed amount of bytes (version dependant, currently 300kB).  Larger results will cause the request to fail.  It is thus not recommended to use this feature as a general purpose mechanism. Also be aware in V9 the &#039;&#039;show&#039;&#039; request with wildcard as &#039;&#039;cn&#039;&#039; will deliver not complete object configuration (some fields are omitted to reduce the amount of data). &lt;br /&gt;
It is thus recommended to use calls to [[Reference9:Concept_SOAP_API#UserInfo.5B.5D_FindUser.28string_v501.2C_string_v700.2C_string_v800.2C_string_v900.2C_string_cn.2C_string_h323.2C_string_e164.2C_integer_count.2C_integer_next.29|FindUser]] to retrieve the list of all objects and to use &#039;&#039;&#039;Admin()&#039;&#039;&#039; with the specific &#039;&#039;cn&#039;&#039; for each object of interest. An example how to retrieve configuration of all objects can be found here [[Howto:Retrieve configuration of all PBX Objects using SOAP API]].&lt;br /&gt;
&lt;br /&gt;
Subtags underneath &#039;&#039;&#039;&amp;lt;user&amp;gt;&#039;&#039;&#039; include &#039;&#039;&#039;cd&#039;&#039;&#039;, &#039;&#039;&#039;grp&#039;&#039;&#039;, &#039;&#039;&#039;pseudo&#039;&#039;&#039;, &#039;&#039;&#039;gw&#039;&#039;&#039;.  However, this list may change over time and you must not rely on this.  &lt;br /&gt;
&lt;br /&gt;
The list of currently known attributes to &#039;&#039;&#039;&amp;lt;user&amp;gt;&#039;&#039;&#039; is &#039;&#039;&#039;guid&#039;&#039;&#039;, &#039;&#039;&#039;cn&#039;&#039;&#039;, &#039;&#039;&#039;h323&#039;&#039;&#039;, &#039;&#039;&#039;e164&#039;&#039;&#039;, &#039;&#039;&#039;hw-id&#039;&#039;&#039;, &#039;&#039;&#039;pbx&#039;&#039;&#039;, &#039;&#039;&#039;loc&#039;&#039;&#039;, &#039;&#039;&#039;node&#039;&#039;&#039;, &#039;&#039;&#039;rep&#039;&#039;&#039;, &#039;&#039;&#039;phys&#039;&#039;&#039;, &#039;&#039;&#039;pwd&#039;&#039;&#039;, &#039;&#039;&#039;cfnr&#039;&#039;&#039;, &#039;&#039;&#039;busy-in&#039;&#039;&#039;, &#039;&#039;&#039;busy-out&#039;&#039;&#039;, &#039;&#039;&#039;type&#039;&#039;&#039;, &#039;&#039;&#039;filter&#039;&#039;&#039;, &#039;&#039;&#039;cd-filter&#039;&#039;&#039;, &#039;&#039;&#039;gi&#039;&#039;&#039;, &#039;&#039;&#039;local&#039;&#039;&#039;.  Again, this list may change and you must not rely on it.&lt;br /&gt;
&lt;br /&gt;
Please note the appearance of the &#039;&#039;&#039;pwd&#039;&#039;&#039; attribute (&#039;&#039;&#039;pwd=&amp;quot;********&amp;quot;&#039;&#039;&#039;).  It is - of course - not possible to retrieve the password using this interface (in fact, it is not possible to retrieve the password at all). &lt;br /&gt;
&lt;br /&gt;
Some of the information is in fact runtime data, not configuration data.  For example, the &#039;&#039;&#039;&amp;lt;ep&amp;gt;&#039;&#039;&#039; tag shows current registration information for the object.&lt;br /&gt;
&lt;br /&gt;
====add====&lt;br /&gt;
The &#039;&#039;&#039;add&#039;&#039;&#039; command will create a new PBX object, e.g.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;add&amp;gt;&lt;br /&gt;
    &amp;lt;user &lt;br /&gt;
        cn=&amp;quot;new PBX User Four&amp;quot; &lt;br /&gt;
        e164=&amp;quot;140&amp;quot; &lt;br /&gt;
        h323=&amp;quot;user-4&amp;quot; &lt;br /&gt;
        cfnr=&amp;quot;99&amp;quot; &lt;br /&gt;
        busy-out=&amp;quot;4711&amp;quot; &lt;br /&gt;
        loc=&amp;quot;Sindelfingen&amp;quot; &lt;br /&gt;
        node=&amp;quot;root&amp;quot; &lt;br /&gt;
        filter=&amp;quot;normal&amp;quot; &lt;br /&gt;
        cd-filter=&amp;quot;normal&amp;quot; &lt;br /&gt;
        type=&amp;quot;ep&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;cd type=&amp;quot;cfb&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;ep e164=&amp;quot;0900123&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/cd&amp;gt;&lt;br /&gt;
        &amp;lt;cd type=&amp;quot;cfnr&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;ep e164=&amp;quot;0900321&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/cd&amp;gt;&lt;br /&gt;
        &amp;lt;grp name=&amp;quot;soap&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;grp name=&amp;quot;test&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/user&amp;gt;&lt;br /&gt;
&amp;lt;/add&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the addition is ok&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;ok/&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
will be returned.&lt;br /&gt;
&lt;br /&gt;
There is no need to define all attributes, nor is it required to include all the subtags.  For example, you can add the call diversions later using the &#039;&#039;&#039;&amp;lt;add-attrib&amp;gt;&#039;&#039;&#039; command.  However, keep in mind that &#039;&#039;incomplete&#039;&#039; objects may cause harm (e.g. objects that have no setting for the &#039;&#039;&#039;node&#039;&#039;&#039; attribute).  &lt;br /&gt;
&lt;br /&gt;
To determine the available attributes and subtags, create an object manually using the web interface and retrieve the xml representation using the &#039;&#039;&#039;show&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
Any &#039;&#039;&#039;guid&#039;&#039;&#039; attribute will be ignored and the new object receives a new guid.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====modify====&lt;br /&gt;
To modify an existing entry, use the &#039;&#039;&#039;modify&#039;&#039;&#039; command.  It has one subtag &#039;&#039;&#039;&amp;lt;user&amp;gt;&#039;&#039;&#039; which carries the complete data for the object after modification (not just the data that shall be modified).  The object to be modified is determined by the &#039;&#039;&#039;guid&#039;&#039;&#039; attribute within the &#039;&#039;&#039;&amp;lt;user&amp;gt;&#039;&#039;&#039; tag.  In the absence of this, it is determined by the &#039;&#039;&#039;cn&#039;&#039;&#039; (aka &#039;&#039;Long Name&#039;&#039;) attribute.  Thus, to change the long name of an object, you need to specify its guid, otherwise the cn is sufficient.&lt;br /&gt;
&lt;br /&gt;
In fact, the &#039;&#039;&#039;modify&#039;&#039;&#039; command is functional identical to a &#039;&#039;&#039;del&#039;&#039;&#039; / &#039;&#039;&#039;add&#039;&#039;&#039; cycle.  The only difference is that the object is not really removed in between, so that the guid stays the same and any action related to the removal of an object (such as the deregistration of endpoints registered on the object) does not happen.&lt;br /&gt;
&lt;br /&gt;
The only &#039;&#039;fool-proof&#039;&#039; method of changing an objects attribute thus is to do a &#039;&#039;&#039;show&#039;&#039;&#039; / &#039;&#039;&#039;modify&#039;&#039;&#039; cycle.  When the &#039;&#039;&#039;pwd&#039;&#039;&#039; attribute is given as 8 stars (&#039;&#039;&#039;pwd=&amp;quot;********&amp;quot;&#039;&#039;&#039;), then it is not modified/set.  Any other value is interpreted as clear text password.  From firmware version 10 upwards, the &#039;&#039;&#039;show&#039;&#039; command will additionally report the password in encrypted form.  If &#039;&#039;&#039;pwdx&#039;&#039;&#039; is sent back to the PBX during a &#039;&#039;&#039;modify&#039;&#039;&#039; command and the &#039;&#039;&#039;pwd&#039;&#039;&#039; attribute has the value &#039;&#039;&#039;********&#039;&#039;&#039;, then the decrypted value of &#039;&#039;&#039;pwdx&#039;&#039;&#039; is set as the new password.  If &#039;&#039;&#039;pwd&#039;&#039;&#039; is not &#039;&#039;&#039;********&#039;&#039;&#039;, its value is used as the new password (clear text). &lt;br /&gt;
&lt;br /&gt;
Please note that for a &#039;&#039;&#039;modify&#039;&#039;&#039; to succeed, the object does not need to exist.  In fact, &#039;&#039;&#039;modify&#039;&#039;&#039; on a non-existing object will create it.&lt;br /&gt;
&lt;br /&gt;
====del====&lt;br /&gt;
An object can be deleted using the &#039;&#039;&#039;del&#039;&#039;&#039; command.&lt;br /&gt;
You must specify the &#039;&#039;&#039;cn&#039;&#039;&#039; attribute to delete an object, the &#039;&#039;&#039;guid&#039;&#039;&#039; will not do.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;del&amp;gt;&amp;lt;user cn=&amp;quot;supernew PBX User Four&amp;quot;/&amp;gt;&amp;lt;/del&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
will delete the user with long name &amp;quot;supernew PBX User Four&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====add-attrib / del-attrib====&lt;br /&gt;
Some of the PBX object attributes can be accessed separately.  This is true for all (usually multi-valued) attributes that live in a separate &#039;&#039;&#039;pbx=&#039;&#039;&#039; value on the FLASHDIR level.  To understand this, have a look at an object and its representations on the XML and FLASHDIR level.  Let us assume we have an object with cn &#039;&#039;&#039;PBX User Four&#039;&#039;&#039;.  The &#039;&#039;&#039;show&#039;&#039;&#039; command yields&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;show time=&amp;quot;18613&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;user &lt;br /&gt;
        cn=&amp;quot;PBX User Four&amp;quot; &lt;br /&gt;
        guid=&amp;quot;4126ec4ee909d3119db10090330600e8&amp;quot; &lt;br /&gt;
        e164=&amp;quot;140&amp;quot; &lt;br /&gt;
        h323=&amp;quot;user-4&amp;quot; &lt;br /&gt;
        pwd=&amp;quot;********&amp;quot; &lt;br /&gt;
        fake=&amp;quot;123&amp;quot; &lt;br /&gt;
        cfnr=&amp;quot;99&amp;quot; &lt;br /&gt;
        busy-out=&amp;quot;4711&amp;quot; &lt;br /&gt;
        loc=&amp;quot;Sindelfingen&amp;quot; &lt;br /&gt;
        node=&amp;quot;root&amp;quot; &lt;br /&gt;
        filter=&amp;quot;normal&amp;quot; &lt;br /&gt;
        cd-filter=&amp;quot;normal&amp;quot; &lt;br /&gt;
        type=&amp;quot;ep&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;cd &lt;br /&gt;
        type=&amp;quot;cfb&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;ep &lt;br /&gt;
            e164=&amp;quot;0900123&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/cd&amp;gt;&lt;br /&gt;
        &amp;lt;cd &lt;br /&gt;
            type=&amp;quot;cfnr&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;ep e164=&amp;quot;0900321&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/cd&amp;gt;&lt;br /&gt;
        &amp;lt;grp &lt;br /&gt;
            name=&amp;quot;soap&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;grp &lt;br /&gt;
            name=&amp;quot;test&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/user&amp;gt;&lt;br /&gt;
&amp;lt;/show&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
On the FLASHDIR level (as seen in &#039;&#039;Config show&#039;&#039;), the object looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mod cmd FLASHDIR0 add-item 101 &lt;br /&gt;
    (cn=PBX User Four)&lt;br /&gt;
    (guid;bin=4126EC4EE909D3119DB10090330600E8)&lt;br /&gt;
    (h323=user-4)&lt;br /&gt;
    (e164=140)&lt;br /&gt;
    (loc=Sindelfingen)&lt;br /&gt;
    (node=root)&lt;br /&gt;
    (pbx=&amp;lt;user filter=&amp;quot;normal&amp;quot; cd-filter=&amp;quot;normal&amp;quot; fake=&amp;quot;123&amp;quot; cfnr=&amp;quot;99&amp;quot; busy-in=&amp;quot;65535&amp;quot; busy-out=&amp;quot;4711&amp;quot; pwd=&amp;quot;ff8523566a0b5b820f785a6ed1eb24e5&amp;quot;/&amp;gt;)&lt;br /&gt;
    (pbx=&amp;lt;grp name=&amp;quot;soap&amp;quot;/&amp;gt;)&lt;br /&gt;
    (pbx=&amp;lt;grp name=&amp;quot;test&amp;quot;/&amp;gt;)&lt;br /&gt;
    (pbx=&amp;lt;cd type=&amp;quot;cfb&amp;quot;&amp;gt;&amp;lt;ep e164=&amp;quot;0900123&amp;quot;/&amp;gt;&amp;lt;/cd&amp;gt;)&lt;br /&gt;
    (pbx=&amp;lt;cd type=&amp;quot;cfnr&amp;quot;&amp;gt;&amp;lt;ep e164=&amp;quot;0900321&amp;quot;/&amp;gt;&amp;lt;/cd&amp;gt;)&lt;br /&gt;
    (usn=35)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any information that is stored in a single &#039;&#039;&#039;(pbx=&amp;lt;...&#039;&#039;&#039; value can be deleted using &#039;&#039;&#039;del-attrib&#039;&#039;&#039; or added using &#039;&#039;&#039;add-attrib&#039;&#039;&#039;.  To delete e.g. the CFB to 09000123, you can use&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;del-attrib&amp;gt;&lt;br /&gt;
    &amp;lt;user &lt;br /&gt;
        cn=&amp;quot;new PBX User Four&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;cd type=&amp;quot;cfb&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;ep e164=&amp;quot;0900123&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/cd&amp;gt;&lt;br /&gt;
    &amp;lt;/user&amp;gt;&lt;br /&gt;
&amp;lt;/del-attrib&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To delete such an attribute, it is important that you specify the complete attribute xml syntax as subtag to the &#039;&#039;&#039;&amp;lt;user&amp;gt;&#039;&#039;&#039; tag.  In the previous example, this is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;cd type=&amp;quot;cfb&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;ep e164=&amp;quot;0900123&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/cd&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Removing all Devices from User Object ===&lt;br /&gt;
to be able to delete all Devices/HW-IDs from an Object, an additional attribute &#039;&#039;no-dev&#039;&#039; must be supplied. Otherwise the PBX will add a device with Hardware-ID set to the Name of the Object.&lt;br /&gt;
&lt;br /&gt;
Example modify request:&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;modify&amp;gt;&lt;br /&gt;
   &amp;lt;user cn=&amp;quot;User 6&amp;quot;&lt;br /&gt;
         guid=&amp;quot;819a174e73365901b90b009033400215&amp;quot;&lt;br /&gt;
         e164=&amp;quot;16&amp;quot;&lt;br /&gt;
         h323=&amp;quot;user6&amp;quot;&lt;br /&gt;
         pwd=&amp;quot;********&amp;quot;&lt;br /&gt;
         pwdx=&amp;quot;529c49b24c3e40c67d3f24f214b843cdd77fe777d7dab77f&amp;quot;&lt;br /&gt;
         loc=&amp;quot;hq&amp;quot;&lt;br /&gt;
         node=&amp;quot;root&amp;quot;&lt;br /&gt;
         no-dev=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/modify&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Determination of the cn ===&lt;br /&gt;
When the &#039;&#039;&#039;cn&#039;&#039;&#039; of an object is not known, it can be determined by virtue of the [[Reference:SOAP_API#UserInfo.5B.5D_FindUser.28string_v501.2C_string_cn.2C_string_h323.2C_string_e164.2C_integer_count.2C_integer_next.29|SOAP FindUser]] function.&lt;br /&gt;
&lt;br /&gt;
=== Setting and Retrieving Passwords ===&lt;br /&gt;
Passwords cannot be retrieved in clear.  They can be set and retrieved in encrypted format though, see [[Howto:Using_the_SOAP_Admin_Function#modify|modify]] above.  See &#039;&#039;Related articles&#039;&#039; below for a discussion of password encryption in the PBX.&lt;br /&gt;
&lt;br /&gt;
===Uncovering xml commands with V5 PBXs===&lt;br /&gt;
On more recent V5 (and later) PBX platforms, you can uncover valid syntax by turning on the configuration changes logging (&#039;&#039;Administration&#039;&#039;) in the log interface and then performing the action you want to mimic with your SOAP program in the user interface.  The xml commands will show up as syslog entries.&lt;br /&gt;
&lt;br /&gt;
== Related Articles ==&lt;br /&gt;
&lt;br /&gt;
* [[Howto:Encrypt_or_Decrypt_PBX_user_passwords]] - how PBX passwords are encrypted&lt;br /&gt;
* [[Howto:SOAP API PHP5 Sample Code]] - PHP5 sample code.  Also show sample usage of the SOAP Admin() function, so it is good reading even if you do not implement in PHP!&lt;br /&gt;
* [[Howto:SOAP API Admin Java Sample Code]] - Java &amp;lt;Admin&amp;gt; sample code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Howto|{{PAGENAME}}]]&lt;/div&gt;</summary>
		<author><name>Franciscopaletta</name></author>
	</entry>
	<entry>
		<id>https://wiki.innovaphone.com/index.php?title=Reference:SOAP_API&amp;diff=49905</id>
		<title>Reference:SOAP API</title>
		<link rel="alternate" type="text/html" href="https://wiki.innovaphone.com/index.php?title=Reference:SOAP_API&amp;diff=49905"/>
		<updated>2018-06-08T19:16:09Z</updated>

		<summary type="html">&lt;p&gt;Franciscopaletta: /* Related Articles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;innovaphone®’s PBX software component introduced with firmware V4 features a new call control API, known as “PBX API” (formerly called “XML API”).  This API is released with the V5 firmware. This documents gives a short overview.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
This documents describes innovaphone’s PBX API, a call control API exposed by the PBX software component running on the IP 21, IP202, IP 400, IP800 and IP 3000.  &lt;br /&gt;
&lt;br /&gt;
The PBX API’s goal is to enable 3rd parties to write software targeting the innovaphone® PBX platform. The API is based upon standardized technologies such as XML and SOAP, so that it can be exposed in a platform neutral manner.  Developers are thus not restricted to specific platforms when designing their PBX API based applications.&lt;br /&gt;
&lt;br /&gt;
The PBX API is a call control API.  That is, by use of the API calls can be monitored, placed, controlled and terminated.  However, the PBX API is not the endpoint of a call. Particularly, the PBX API does not provide access to the media stream associated with a call.  The PBX API controls calls between endpoints known to the PBX. &lt;br /&gt;
&lt;br /&gt;
Applications, which need to function as the endpoint of a call, must use a different API, which is described in a separate document.  However, both APIs can be used simultaneously if required.&lt;br /&gt;
&lt;br /&gt;
[[Image:soap-api-01.png]]&lt;br /&gt;
&lt;br /&gt;
As can be seen in Figure 1, calls live independently of the PBX API and it is transparent to the application what kind of endpoints are actually involved on the call. Thus, calls are seen in a uniform way by the application.&lt;br /&gt;
&lt;br /&gt;
The call control functions provided by the PBX API are actually exposed as a set of SOAP methods by the PBX, which together make a SOAP service.&lt;br /&gt;
&lt;br /&gt;
Strictly speaking, the PBX API is not an API, but a protocol with a well-defined mapping to a transport mechanism.  This transport mechanism is HTTP and the mapping is defined by SOAP. The set of methods exposed can be described using a standard SOAP mechanism, the WSDL file (WSDL is for [[http://www.w3.org/TR/wsdl Web Services Description Language]]). This way, users of the PBX API can access these methods from any platform they happen to utilize, provided this platform provides access to SOAP services.&lt;br /&gt;
&lt;br /&gt;
[[Image:soap-api-02.png]]&lt;br /&gt;
&lt;br /&gt;
Only the PBX part shown in Figure 2 is provided by innovaphone®, the left part is left to individual platform software provided by 3rd parties.  In particular, the actual API used be the application developer is specific to the development environment or tool she is using.&lt;br /&gt;
&lt;br /&gt;
Many development environments do support SOAP and thus enable access to the SOAP methods exposed by the PBX. We have worked so far with Microsoft’s Visual Studio.NET environment (C# and Visual Basic), as well as plain traditional C++ and PHP5.  Customers have reported successful implementations in perl and Delphi.&lt;br /&gt;
&lt;br /&gt;
Looking specifically at the Microsoft.NET environment, there is a language agnostic runtime environment, which implements the IP, HTTP and SOAP layer.  On top of this, there are various language implementations sharing this same runtime environment, namely Visual C#, Visual C++ and Visual Basic. While all these languages provide access to the PBX’s SOAP methods, the API used to accomplish this is obviously syntactically different depending on the language used.&lt;br /&gt;
&lt;br /&gt;
Also, other development environments, such as Perl or Python, may provide access to SOAP methods and thus provide yet another PBX API.&lt;br /&gt;
&lt;br /&gt;
Figure 3 shows how various development environments expose syntactically different PBX API’s .&lt;br /&gt;
&lt;br /&gt;
[[Image:soap-api-03.png]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Concept|{{PAGENAME}}]]&lt;br /&gt;
&lt;br /&gt;
== Definition of PBX object (WSDL) == &lt;br /&gt;
Within the SOAP framework there is a mechanism to formally decribe the definition of remote objects. This is done by so called WSDL (Web Service Description Language) files. &lt;br /&gt;
According to the used firmware you may use a [[#References|specific wsdl file]] which defines the PBX web services  described in this document.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;There is also an [[http://www.innovaphone.com/wsdl/pbx.wsdl old version of the wsdl]] available which has less interface functions.  This interface can still be accessed by legacy applications and is activated on the PBX by calling the &#039;&#039;&#039;Initialize&#039;&#039;&#039; Function with fewer arguments (&#039;&#039;&#039;Integer Initialize(string user, string appl, out key)&#039;&#039;&#039;).  It should not be used for new develoments though.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==PBX Objects and Methods==&lt;br /&gt;
&lt;br /&gt;
This section contains a language agnostic description of the PBX API’s object model.  Despite of the fact that we are discussing an object model, the PBX API is in fact not an object oriented API.  This is because SOAP itself is not really object oriented.  In particular, there is no object creation, activation or lifetime concept.  This is left up to the service designer.  SOAP is more a message exchange mechanism than an object method invocation mechanism.  This is reflected in the API structure.&lt;br /&gt;
&lt;br /&gt;
Specifically, objects are represented through handles, which are integers.  Objects are created and destroyed using dedicated methods and it’s the users responsibility to manage the lifetime of all objects.&lt;br /&gt;
&lt;br /&gt;
The syntax shown here actually is no valid syntax in any existing language.  Please refer to the various sample codes for working syntax.&lt;br /&gt;
&lt;br /&gt;
===Session===&lt;br /&gt;
&lt;br /&gt;
All PBX API methods are executed in the context of a session.  A session is created using the &#039;&#039;&#039;initialize&#039;&#039;&#039; method and is identified by a handle.  This handle must be provided to all subsequent method calls.&lt;br /&gt;
&lt;br /&gt;
A session is owned by the PBX API user, i.e. there is no way to have access to a session of another application.  Each session has a scope, which defines the view of the PBX the session user has.  The scope determines the set of PBX registrations seen by the session.&lt;br /&gt;
&lt;br /&gt;
Scopes are defined and configured in the PBX and are bound to particular PBX users. Thus, a session has a user attribute, which defines the scope.   It includes all users which are members of groups &#039;&#039;&#039;user&#039;&#039;&#039; is active member of.  If &#039;&#039;&#039;user&#039;&#039;&#039; is not an active member of any group, the scope is the user itself.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Integer Initialize(string user, string appl, bool v, bool v501, out int key)====&lt;br /&gt;
&lt;br /&gt;
To access the current web services implementation, both &#039;&#039;&#039;v&#039;&#039;&#039; and &#039;&#039;&#039;v501&#039;&#039;&#039; must be present and set to &#039;&#039;&#039;true&#039;&#039;&#039;. &lt;br /&gt;
These 2 parameters actually convey the wsdl version used by the client.  Different versions of the interface use different parameter sets for the Initialize call.  Applications should always use the wsdl version current at the time of writing the application.&lt;br /&gt;
&lt;br /&gt;
The method creates a session.  The session will have the user &#039;&#039;&#039;user&#039;&#039;&#039;’s scope.  The session handle is returned and is 0 for failure and positive for a valid session handle.  &#039;&#039;&#039;appl&#039;&#039;&#039; specifies the name of the calling application and is used for administrative purposes.  The output parameter &#039;&#039;&#039;key&#039;&#039;&#039; is a random number associated to the session.   It may be used in subsequent &#039;&#039;&#039;Echo&#039;&#039;&#039; operations.&lt;br /&gt;
&lt;br /&gt;
When a session is created, &#039;&#039;&#039;UserInfo&#039;&#039;&#039; events for all PBX registrations in the scope can be received by the &#039;&#039;&#039;Poll&#039;&#039;&#039; function.  Initially, one &#039;&#039;&#039;UserInfo&#039;&#039;&#039; per registration within the session’s scope is received (the list is terminated by a &#039;&#039;&#039;UserInfo&#039;&#039;&#039; with empty &#039;&#039;&#039;cn&#039;&#039;&#039; and may require multiple &#039;&#039;&#039;Poll&#039;&#039;&#039; calls to retrieve).  Subsequently, &#039;&#039;&#039;UserInfo&#039;&#039;&#039; events are received when a registrations state changes.&lt;br /&gt;
&lt;br /&gt;
The underlying transport session (HTTP) must authenticate itself  either as &#039;&#039;&#039;user&#039;&#039;&#039;  (using the users long name and PBX password) or as the admin user (using the gateway administrator account name and password) to perform an &#039;&#039;&#039;Initialize&#039;&#039;&#039; and any session related function. &lt;br /&gt;
&lt;br /&gt;
Note that the method to force the SOAP system you are using to authenticate to the PBX is entirely up to the system itself.  Some systems even do not support authentication at all.  If your SOAP implementation does not support digest authentication, make sure the gateway accepts basic authentication by setting the “&#039;&#039;allow HTTP basic authentication&#039;&#039;” in the “&#039;&#039;General settings&#039;&#039;”.&lt;br /&gt;
&lt;br /&gt;
Note that although many HTTP connections may be used in a single session, at least one HTTP connection must remain open during the lifetime of the session.  When the last connection disappears, the logical session is terminated after a short timeout. Some SOAP libraries may per default always close the HTTP connection and reconnect on subsequent SOAP calls, which will not work. The SOAP library should either be configured to keep at least one HTTP connection alive or, if this is not an option, the application should take care to always have a an active request pending (such as &#039;&#039;&#039;Poll&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
====Echo(integer session, integer key)====&lt;br /&gt;
&lt;br /&gt;
Verifies a session.  You need to supply the &#039;&#039;session&#039;&#039; identifier and &#039;&#039;key&#039;&#039; returned by a previous call to &#039;&#039;&#039;Initialize&#039;&#039;&#039;.  Returns nonzero if successful.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====End(integer session)====&lt;br /&gt;
&lt;br /&gt;
Terminates the session referenced by &#039;&#039;session&#039;&#039;.  No further events will be received.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Integer Version(out string gkId, out string location, out string firmware, out string serial)====&lt;br /&gt;
&lt;br /&gt;
Returns the version number of the WSDL file the PBX supports.  The first released WSDL file had version number 500.  The version described by this document has version number 501. Also delivers information about the connected PBX (in &#039;&#039;gkId&#039;&#039;, &#039;&#039;location&#039;&#039;, &#039;&#039;firmware&#039;&#039; and &#039;&#039;serial&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====AnyInfo Poll(integer session)====&lt;br /&gt;
&lt;br /&gt;
Returns pending events for the session referenced by &#039;&#039;session&#039;&#039;.  &#039;&#039;AnyInfo&#039;&#039; is a struct with four arrays as members: &#039;&#039;user&#039;&#039;, &#039;&#039;call&#039;&#039;, &#039;&#039;reg&#039;&#039; and &#039;&#039;info&#039;&#039;. &#039;&#039;user&#039;&#039; is an array of type &#039;&#039;UserInfo&#039;&#039; and call is an array of type CallInfo.  The other two arrays &#039;&#039;reg&#039;&#039; and &#039;&#039;info&#039;&#039; are currently not used.&lt;br /&gt;
&lt;br /&gt;
After a successful &#039;&#039;&#039;Initialize()&#039;&#039; there will be a &#039;&#039;UserInfo&#039;&#039; event for each defined user in the system.  This allows the application to synchronize on the state of all visible users.  The list will be terminated by an &#039;&#039;UserInfo&#039;&#039; event for a user with an empty &#039;&#039;cn&#039;&#039; which normally cannot happen since a user entry must have a cn.&lt;br /&gt;
&lt;br /&gt;
===User===&lt;br /&gt;
&lt;br /&gt;
A user represents a configured object within the PBX (a “PBX user”). The PBX API provides the &#039;&#039;&#039;UserInitialize&#039;&#039;&#039; method to obtain a handle to the user.&lt;br /&gt;
&lt;br /&gt;
====UserInfo====&lt;br /&gt;
The user’s properties are stored in a &#039;&#039;UserInfo&#039;&#039; structure, which has the following elements:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;boolean active&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
true if the user exists.  The only case where active can be false is when a user is deleted. A single UserInfo event will be posted with active set to false then.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;integer state&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1 if the user is registered, 0 otherwise.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;integer channel&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
number of current calls.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;integer  alert&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
number of alerting calls&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;string type&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
the type of the users device.  Currently defined are “&#039;&#039;&#039;ep&#039;&#039;&#039;” (it is an endpoint), “&#039;&#039;&#039;gw&#039;&#039;&#039;” (it is a gateway, for example a trunk line), “&#039;&#039;&#039;waiting&#039;&#039;&#039;” (a call queue) or “&#039;&#039;&#039;broadcast&#039;&#039;&#039;” (a group).  Others may be defined over time.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;string guid&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
the users GUID.  This is a globally unique identifier for the user.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;string cn&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
the common name of the user. This is what the PBX’s LDAP server recognizes as the CN of this user.  The user’s name in the PBX configuration applet.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;string e164&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
the extension number the user is registered with.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;string h323&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
the alias the user is registered with.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;string dn&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
the users display name.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Group groups&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
An array of &#039;&#039;&#039;Group&#039;&#039;&#039; records (see below).&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Info info	&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;Info&#039;&#039;&#039; record describing various aspects of the user.  The type of the information described in an individual &#039;&#039;&#039;Info&#039;&#039;&#039; record is determined by the value of its &#039;&#039;type&#039;&#039; member.  Currently defined values for &#039;&#039;type&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
**loc&lt;br /&gt;
&lt;br /&gt;
If the object described is not local to the PBX the &#039;&#039;&#039;UserInfo&#039;&#039;&#039; is sent from, the name of the location the object is homed in is given in this element.  See &#039;&#039;&#039;LocationUrl&#039;&#039;&#039; to find out how to proceed further. &lt;br /&gt;
&lt;br /&gt;
The users group memberships are stored in a &#039;&#039;&#039;Group&#039;&#039;&#039; record which has the following elements:&lt;br /&gt;
&lt;br /&gt;
**&#039;&#039;&#039;string group&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
the name of the group the user is a member of&lt;br /&gt;
&lt;br /&gt;
**&#039;&#039;&#039;integer state&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;true&#039;&#039;&#039; if the user is an active member of the group&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====integer UserInitialize(integer session, string user, bool follow)====&lt;br /&gt;
&lt;br /&gt;
Returns a handle to the named &#039;&#039;user&#039;&#039; (0 on failure). String &amp;lt;code&amp;gt;user&amp;lt;/code&amp;gt; must be a Long Name(cn). Phone number(e164) is not supported. Use FindUser instead, to retrieve cn to specified e164 number.&lt;br /&gt;
&lt;br /&gt;
Once a user handle is obtained with &#039;&#039;&#039;UserInitialize&#039;&#039;&#039;, &#039;&#039;&#039;CallInfo&#039;&#039;&#039; events will be posted and retrieved via &#039;&#039;&#039;Poll&#039;&#039;&#039; for all calls related to the user.  If &#039;&#039;follow&#039;&#039; is set to &#039;&#039;&#039;true&#039;&#039;&#039;, &#039;&#039;&#039;CallInfo&#039;&#039;&#039; events will also be posted for calls which are transferred away from &#039;&#039;user&#039;&#039;.  Otherwise, such events will be posted only for the user handle which the call has been transferred to. Thus, without setting follow to true, an application will generally not be able to track calls after a transfer unless it has called &#039;&#039;&#039;UserInitialize&#039;&#039;&#039; for any PBX object a call may be transferred to and matches the new call on the transferred-to user via the &#039;&#039;&#039;conf&#039;&#039;&#039; information in the &#039;&#039;&#039;Info&#039;&#039;&#039; record of the new call (which will be identical to the &#039;&#039;&#039;conf&#039;&#039;&#039; information for the transferred call).&lt;br /&gt;
&lt;br /&gt;
When &#039;&#039;follow&#039;&#039; ist set to &#039;&#039;&#039;true&#039;&#039;&#039;, transferred calls will show up in the &#039;&#039;&#039;CallInfo&#039;&#039;&#039; records with a &#039;&#039;&#039;No&#039;&#039;&#039; element of type &#039;&#039;&#039;xfer&#039;&#039;&#039; that indicates the number the call has been transferred to.&lt;br /&gt;
&lt;br /&gt;
Also, the user handle can be used to create and control calls on behalf of the user.&lt;br /&gt;
&lt;br /&gt;
====void UserEnd(integer user)====&lt;br /&gt;
&lt;br /&gt;
Frees the handle &#039;&#039;user&#039;&#039; obtained with &#039;&#039;&#039;UserInitialize&#039;&#039;&#039;. No events will be posted for this user anymore.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Call===&lt;br /&gt;
A call represents one leg of an existing call in the PBX.  &lt;br /&gt;
&lt;br /&gt;
====CallInfo====&lt;br /&gt;
The calls attributes are stored in a &#039;&#039;&#039;CallInfo&#039;&#039;&#039; structure, which has the following elements:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;int user&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
the user handle the call belongs to&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;int call&#039;&#039;&#039;&lt;br /&gt;
the call handle&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;int reg&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
currently unused&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;bool active&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;true&#039;&#039;&#039; if the call exists, &#039;&#039;&#039;false&#039;&#039;&#039; if not.  The only case where &#039;&#039;active&#039;&#039; can be &#039;&#039;&#039;false&#039;&#039;&#039; is when a call is terminated. A single &#039;&#039;&#039;CallInfo&#039;&#039;&#039; event will be posted with &#039;&#039;active&#039;&#039; set to &#039;&#039;&#039;false&#039;&#039;&#039; then&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;integer state&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A calls state. A bit field made up as follows:&lt;br /&gt;
{|&lt;br /&gt;
|+&lt;br /&gt;
| Value &lt;br /&gt;
| Mask &lt;br /&gt;
| Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 1 &lt;br /&gt;
| 0xF &lt;br /&gt;
| setup&lt;br /&gt;
|-&lt;br /&gt;
| 2 ||		|| setup-ack&lt;br /&gt;
|-&lt;br /&gt;
| 3 ||		|| call-proc&lt;br /&gt;
|-&lt;br /&gt;
| 4 ||		|| Alert&lt;br /&gt;
|-&lt;br /&gt;
| 5 ||		|| Connect&lt;br /&gt;
|-&lt;br /&gt;
| 6 ||		|| disconnect sent&lt;br /&gt;
|-&lt;br /&gt;
| 7 ||		|| disconnect received&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||	0x80    || inbound  call&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||	0x80    || outbound call&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||	0x100   || active call&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||	0x100   || call on hold&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that the PBX API is PBX-centric, not terminal centric.  As such, it considers a call &#039;&#039;from&#039;&#039; the PBX &#039;&#039;to&#039;&#039; the terminal as &#039;&#039;outbound&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;string msg&#039;&#039;&#039;&lt;br /&gt;
A textual representation of the signalling message causing this event. E.g. “&#039;&#039;&#039;x-setup&#039;&#039;&#039;”.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;No No&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
An array of &#039;&#039;&#039;No&#039;&#039;&#039; records (see below).  This can include information about various peers related to the call itself.  The type of the peer described in an individual &#039;&#039;&#039;No&#039;&#039;&#039; record is determined by the value of its &#039;&#039;&#039;type&#039;&#039;&#039; member.  Currently defined values for &#039;&#039;&#039;type&#039;&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
**&#039;&#039;&#039;peer&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The current remote end of the call (the local end is determined by the UserInfo identified through the user handle above)&lt;br /&gt;
&lt;br /&gt;
**&#039;&#039;&#039;leg2&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The last diverting user (if any)&lt;br /&gt;
&lt;br /&gt;
**&#039;&#039;&#039;ct&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The last user having transferred the call (if any)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Info info&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;Info&#039;&#039;&#039; record describing various aspects of the call.  The type of the information described in an individual &#039;&#039;&#039;Info&#039;&#039;&#039; record is determined by the value of its &#039;&#039;type&#039;&#039; member.  Currently defined values for &#039;&#039;type&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
**&#039;&#039;&#039;conf&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A string holding the conference id (a GUID) of the conference the call is a leg of&lt;br /&gt;
&lt;br /&gt;
====No Record====&lt;br /&gt;
&lt;br /&gt;
Peer information is stored in a &#039;&#039;&#039;No&#039;&#039;&#039; record with the following elements:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;string type&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
the type of the peer described by the record&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;string cn&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
the peer’s PBX’s objects common name (if any)&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;string e164&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
the peer’s phone number&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;string h323&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
the peer’s h323 alias&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;string dn&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
the peer’s display name&lt;br /&gt;
&lt;br /&gt;
====Info record====&lt;br /&gt;
Various information is stored in &#039;&#039;&#039;Info&#039;&#039;&#039; records with the following elements:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;string type&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
the type of the information described by the record&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;string vals&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
a string value associated with this information (if any, the &#039;&#039;type&#039;&#039; of the element determines if an &#039;&#039;&#039;Info&#039;&#039;&#039; element has a string or an integer value) &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;integer vali&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
an integer value associated with this information (if any)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that the call related functions do not return a meaningful value.  This is because the operations success is reflected in the subsequent CallInfo events.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====integer UserCall(integer user, string cn, string e164, string h323, int reg, InfoArray info)====&lt;br /&gt;
&lt;br /&gt;
Creates an outgoing call from the &#039;&#039;&#039;user&#039;&#039;&#039; (which is a handle obtained by a call to &#039;&#039;&#039;UserInitialize&#039;&#039;&#039;)  to the destination described by &#039;&#039;cn&#039;&#039;, &#039;&#039;e164&#039;&#039; and &#039;&#039;h323&#039;&#039;.  Arguments &#039;&#039;reg&#039;&#039; and &#039;&#039;info&#039;&#039; are currently ignored. Returns a handle to the call (0 on failure).&lt;br /&gt;
&lt;br /&gt;
Depending on the nature of the device the user is registered with, the device may actually place the call or the PBX may place a call and once it is accepted, it places another call to the destination.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====UserConnect(integer call)====&lt;br /&gt;
Connects an existing &#039;&#039;call&#039;&#039;.  This forces the device the user is registered with to accept the call.  It may then go into hands-free mode.  Incapable (i.e. non-innovaphone) devices may simply ignore this call.&lt;br /&gt;
&lt;br /&gt;
====UserTransfer (int acall, integer bcall)====&lt;br /&gt;
&#039;&#039;acall&#039;&#039; and &#039;&#039;bcall&#039;&#039; are both calls a single user currently has active.  This method will connect &#039;&#039;acall&#039;&#039; with &#039;&#039;bcall&#039;&#039;, leaving the user without both calls.&lt;br /&gt;
&lt;br /&gt;
====bool UserRedirect(integer call, string cn, string e164, string h323, InfoArray info)====&lt;br /&gt;
Places a call to the destination described by &#039;&#039;cn&#039;&#039;, &#039;&#039;e164&#039;&#039; and &#039;&#039;h323&#039;&#039; and connects &#039;&#039;call&#039;&#039; to this destination.  Argument &#039;&#039;info&#039;&#039; is currently ignored.&lt;br /&gt;
&lt;br /&gt;
====integer UserPickup(int user, string cn, integer call, string group, int reg, InfoArray info)====&lt;br /&gt;
Redirects a call such that it appears as a new call at &#039;&#039;user&#039;&#039;. The call to be redirected can be specified by its &#039;&#039;call&#039;&#039; handle.  Alternatively, calls can be picked up by a users &#039;&#039;cn&#039;&#039; or by a &#039;&#039;group&#039;&#039; name.  If all parameters are null, an implicit pickup is done.  The new call handle is returned. Arguments &#039;&#039;reg&#039;&#039; and &#039;&#039;info&#039;&#039; are currently ignored.&lt;br /&gt;
&lt;br /&gt;
====UserClear(integer call, integer cause, InfoArray info)====&lt;br /&gt;
Disconnects the &#039;&#039;call&#039;&#039; providing &#039;&#039;cause&#039;&#039; as disconnect reason.  &lt;br /&gt;
&lt;br /&gt;
Cause is coded as a 7bit integer according to the table found in [[Reference:ISDN Cause Codes]].&lt;br /&gt;
Argument &#039;&#039;info&#039;&#039; is currently ignored.&lt;br /&gt;
&lt;br /&gt;
====UserCtComplete(integer call, string e164, string h323)====&lt;br /&gt;
&lt;br /&gt;
Sends a notification to the device &#039;&#039;call&#039;&#039; is active on that the remote peer has changed to &#039;&#039;e164&#039;&#039; and &#039;&#039;h323&#039;&#039;.   This resembles the notification a device may receive if its remote peer transfers the call to the new destination.  The device may update its display and/or call data accordingly.  This call is often used to force the devices (i.e. telephones) display to show application specific data.&lt;br /&gt;
&lt;br /&gt;
====UserHold(integer call)====&lt;br /&gt;
Sets the call on hold.  The device may or may not display the hold status.  In any case, the media channel is disconnected until a UserRetrieve is called.&lt;br /&gt;
&lt;br /&gt;
====UserRetrieve(integer call)====&lt;br /&gt;
Retrieves the &#039;&#039;call&#039;&#039; on hold.  The device may or may not display the new status.  In any case, the media channel is reconnected.&lt;br /&gt;
&lt;br /&gt;
===Status Retrieval===&lt;br /&gt;
&lt;br /&gt;
Instead of monitoring calls using the &#039;&#039;Poll&#039;&#039; mechanics, there are some functions to retrieve the current at a certain point in time.&lt;br /&gt;
&lt;br /&gt;
====CallInfo[] Calls(integer session, string user)====&lt;br /&gt;
Returns an array of &#039;&#039;&#039;CallInfo&#039;&#039;&#039; records for the calls currently active at the registration defined by &#039;&#039;user&#039;&#039;.  Please note that this function may be called without having called &#039;&#039;&#039;UserInitialize ()&#039;&#039;&#039; before.  Thus, the call handle information in the &#039;&#039;&#039;CallInfo&#039;&#039;&#039; records returned is meaningless.&lt;br /&gt;
&lt;br /&gt;
====UserInfo[] FindUser(string v501, string cn, string h323, string e164, integer count, integer next)====&lt;br /&gt;
Returns an array of at most &#039;&#039;count&#039;&#039; &#039;&#039;&#039;UserInfo&#039;&#039;&#039; records for the users matching &#039;&#039;cn&#039;&#039;, &#039;&#039;h323&#039;&#039; or &#039;&#039;e164&#039;&#039;.  Only one of &#039;&#039;cn&#039;&#039;, &#039;&#039;h323&#039;&#039; and &#039;&#039;e164&#039;&#039; may be specified.  The search string will be used as a starting point into the alphabetically sorted list of objects, that is, a search for “&#039;&#039;&#039;A&#039;&#039;&#039;” will yield entries starting with “&#039;&#039;&#039;A&#039;&#039;&#039;” but also – depending on &#039;&#039;count&#039;&#039; – the following entries.  Neither search string may be empty.  v501 must be set to a non-empty value.&lt;br /&gt;
&lt;br /&gt;
To call &#039;&#039;&#039;FindUser&#039;&#039;&#039;, no session is required, however, you need a valid HTTP authentication.&lt;br /&gt;
&lt;br /&gt;
Be aware that large values for &#039;&#039;count&#039;&#039; may fail and even crash the PBX.  If you need to retrieve the whole user list, you should be using 50 as  &#039;&#039;count&#039;&#039;, provide the last &#039;&#039;cn&#039;&#039; retrieved as new start cn and loop until &#039;&#039;&#039;&#039;FindUser&#039;&#039;&#039; returns no more results, passing &#039;&#039;&#039;true&#039;&#039;&#039; as  value for &#039;&#039;next&#039;&#039; for all but the first calls.&lt;br /&gt;
&lt;br /&gt;
====string License(integer session, string name)====&lt;br /&gt;
This function is for internal use only.&lt;br /&gt;
&lt;br /&gt;
====string LocationUrl(string user v501, string location)====&lt;br /&gt;
Returns a string with the HTTP URL for the PBX named location to which a SOAP session can be created. Typically, location  is retrieved from the &#039;&#039;vals&#039;&#039; element of an &#039;&#039;&#039;Info&#039;&#039;&#039; record with &#039;&#039;type&#039;&#039; &#039;&#039;&#039;loc&#039;&#039;&#039; in an &#039;&#039;&#039;UserInfo&#039;&#039;&#039; record.&lt;br /&gt;
&lt;br /&gt;
===Administration===&lt;br /&gt;
The SOAP interface can be used for administrational purposes also.  This is done via the Admin call.&lt;br /&gt;
&lt;br /&gt;
====string Admin(string xml)====&lt;br /&gt;
&lt;br /&gt;
Sends the administrational command &#039;&#039;xml&#039;&#039; to the PBX.  The command is executed and any result is returned.  &lt;br /&gt;
&lt;br /&gt;
This command allows you to query and modify the PBX object configuration (e.g. to query and set a users call forwarding).  The scope and format of the commands valid for &#039;&#039;xml&#039;&#039; is beyond the scope of this document, however, there is a separate article on that (see the [[Reference:SOAP_API#Related_Articles|Related Articles]] below).&lt;br /&gt;
&lt;br /&gt;
To call &#039;&#039;&#039;Admin&#039;&#039;&#039;, no session is required.  However, you must be authenticated as an admin user on the underlying HTTP layer.&lt;br /&gt;
&lt;br /&gt;
==Typical design of a PBX SOAP Application==&lt;br /&gt;
A typical SOAP application has a thread that collects all PBX events using an infinite loop which calls &#039;&#039;&#039;Poll()&#039;&#039;&#039;, scans the returned &#039;&#039;&#039;AnyInfo&#039;&#039;&#039; arrays and reacts accordingly.  Depending on the type of application, there are 2 typical schemes&lt;br /&gt;
&lt;br /&gt;
*the thread is either initialized with a sequence of calling Initialize() and then UserInitialize() on behalf of a (typically pre-configured) user (1st party scenario) or&lt;br /&gt;
*the thread is initialized via Initialize() and then, when Poll() returns UserInfo records later on, UserInitialize() is called once on behalf of any user made known by the UserInfo (3rd party scenario)&lt;br /&gt;
&lt;br /&gt;
In any case, once initialized, the infinite loop of calls to &#039;&#039;&#039;Poll()&#039;&#039;&#039; will retrieve all relevant events from the PBX, i.e. there is no need to perform distinct calls to &#039;&#039;&#039;Poll()&#039;&#039;&#039; for different users.  &lt;br /&gt;
&lt;br /&gt;
Please note that &#039;&#039;&#039;Poll()&#039;&#039;&#039; is rather a misnomer, since it does not really poll the PBX but will hang as long as no events are to be delivered.  It will not consume extensive CPU cycles thus.  In fact, &#039;&#039;&#039;Poll()&#039;&#039;&#039; will return with an empty &#039;&#039;&#039;AnyInfo&#039;&#039;&#039; Array if no events are present after a while.  This is because many SOAP client implementations consider a call to fail if it takes “long”, where “long” is defined by the client implementation.&lt;br /&gt;
&lt;br /&gt;
When a call to the PBX fails, the PBX link is broken and any associated data structures should be destroyed and the initialization process should start over again.  Most importantly, local user and call ids are no longer valid after a restart of a PBX.  Please note that some SOAP development environments will transparently reconnect a broken link.  To make sure a restart of the PBX is discovered by the application, use the &#039;&#039;&#039;Echo()&#039;&#039;&#039; call since it will change if the key is invalidated by a restart. Some server type applications will find it convenient to use a separate thread that simply loops with an &#039;&#039;&#039;Echo&#039;&#039;&#039;/&#039;&#039;&#039;Pause&#039;&#039;&#039; sequence.&lt;br /&gt;
&lt;br /&gt;
Many applications both react on events returned by &#039;&#039;&#039;Poll()&#039;&#039;&#039; and on events created by a client or by a user interface.  In such cases, make sure that a single SOAP link (depending on the development environment used) is not used for 2 concurrent SOAP calls, as most development systems do not support this.  Rather create 2 or more links. We have seen this problem with C#, for example.&lt;br /&gt;
&lt;br /&gt;
SOAP is based on http and thus uses http authentication.  Many SOAP development environments will thus send any request unauthorized first and resend it with authorization only when the server has returned the “Unauthorized“ http error code.  This obviously causes delays on the client and extensive CPU usage on the PBX.  If possible, make sure to configure your SOAP client such that it will send each request authenticated in the first place (a mode sometimes known as “pre-authenticated”).&lt;br /&gt;
&lt;br /&gt;
===Programming languages with no support for &#039;&#039;threads&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Some programming languages do not have the concept of a &amp;quot;parallel thread&amp;quot;.   However, some of them nevertheless feature a concept of &#039;&#039;asynchronous operation&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Visual Basic for example defines so-called &#039;&#039;events&#039;&#039;, which are raised asynchronously, yet synchronized with main execution (see [[Howto:SOAP with VisualBasic.Net]] for an example).  These can be handled then by user-defined functions.&lt;br /&gt;
&lt;br /&gt;
C# introduces the conecpt of &#039;&#039;delegates&#039;&#039;, that will be called asynchronously (see [[Howto:PBX SOAP Api C-sharp sample code]] for more details on using SOAP from C#).&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
Latest wsdl file refers to our firmware 10:&lt;br /&gt;
* [http://www.innovaphone.com/wsdl/pbx10_00.wsdl Version10-wsdl].&lt;br /&gt;
Please check out the [http://wiki.innovaphone.com/index.php?title=Reference10:Concept_SOAP_API corresponding wiki-article] herefore.&lt;br /&gt;
&lt;br /&gt;
Applications based on this wsdl will work with V10 PBX firmware only. &lt;br /&gt;
&lt;br /&gt;
Applications written to the previous pbx501.wsdl, pbx700.wsdl and pbx900.wsdl will continue to work with V10 firmware. &lt;br /&gt;
&lt;br /&gt;
For your reference the old version files are still available:&lt;br /&gt;
* [http://www.innovaphone.com/wsdl/pbx501.wsdl Version5-wsdl]&lt;br /&gt;
* [http://www.innovaphone.com/wsdl/pbx700.wsdl Version7-wsdl]&lt;br /&gt;
* [http://www.innovaphone.com/wsdl/pbx900.wsdl Version9-wsdl]&lt;br /&gt;
&lt;br /&gt;
==Known Problems==&lt;br /&gt;
Please read [[Howto:Authentication_in_the_SOAP_interface]] in case you have problems to authenticate SOAP access.&lt;br /&gt;
&lt;br /&gt;
==System Requirements==&lt;br /&gt;
The PBX SOAP API requires a working PBX.&lt;br /&gt;
&lt;br /&gt;
To work with the PBX API in this version, you must run at least version 5.01 software on your PBX.  Also, you must run at least version 5 software on the phones.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
There is no specific installation required, as the PBX API is integral part of the PBX (although licenses are required to operate the PBX).&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
To prepare an PBX for PBX API testing&lt;br /&gt;
*setup a separate PBX&lt;br /&gt;
*install current firmware (at least 5.01)&lt;br /&gt;
*configure the PBX as usually&lt;br /&gt;
*add an user object called &#039;&#039;&#039;API&#039;&#039;&#039; , define a &#039;&#039;password&#039;&#039; for this object&lt;br /&gt;
*create a new group (e.g. called &#039;&#039;&#039;all users&#039;&#039;&#039;), by adding a group tag to &#039;&#039;&#039;API&#039;&#039;&#039;, make it &#039;&#039;active&#039;&#039;&lt;br /&gt;
*add a similar group tag to all other test users&lt;br /&gt;
*call &#039;&#039;&#039;Initialize()&#039;&#039;&#039; and use &#039;&#039;&#039;API&#039;&#039;&#039; as user and &#039;&#039;&#039;API&#039;&#039;&#039; and its &#039;&#039;password&#039;&#039; as http credentials&lt;br /&gt;
&lt;br /&gt;
==Related Articles==&lt;br /&gt;
:[[Howto:Authentication in the SOAP interface]]&lt;br /&gt;
:[[Howto:Clear a call completely with SOAP using UserClear]]&lt;br /&gt;
:[[Howto:PBX SOAP Api C sample code]]&lt;br /&gt;
:[[Howto:SOAP Api VisualBasic.Net Sample Code]]&lt;br /&gt;
:[[Support:TAPI or other SOAP Application fails to function properly if PBX users have special characters in their long or short user name]]&lt;br /&gt;
:[[Howto:How to monitor configuration changes in the SOAP interface ]]&lt;br /&gt;
:[[Howto:SOAP with PHP5 ]]&lt;br /&gt;
:[[Howto:SOAP API Java Sample Code ]]&lt;br /&gt;
:[[Howto:Using the SOAP Admin Function]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.innovaphone.com/index.php?search=soap Search for more articles about SOAP]&lt;/div&gt;</summary>
		<author><name>Franciscopaletta</name></author>
	</entry>
	<entry>
		<id>https://wiki.innovaphone.com/index.php?title=Howto:Using_the_SOAP_Admin_Function&amp;diff=49904</id>
		<title>Howto:Using the SOAP Admin Function</title>
		<link rel="alternate" type="text/html" href="https://wiki.innovaphone.com/index.php?title=Howto:Using_the_SOAP_Admin_Function&amp;diff=49904"/>
		<updated>2018-06-08T18:55:40Z</updated>

		<summary type="html">&lt;p&gt;Franciscopaletta: /* show */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The [[Reference:SOAP API|PBX SOAP interface]] allows you to query and manipulate the entire PBX object configuration (i.e. users).  Here is the syntax of the commands.&lt;br /&gt;
==Applies To==&lt;br /&gt;
This information applies to&lt;br /&gt;
&lt;br /&gt;
* all innovaphone PBX platforms&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- SOAP, Admin, programmatic access, api, configuration, --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==More Information==&lt;br /&gt;
&lt;br /&gt;
===Problem Details===&lt;br /&gt;
Sometimes, there is a need to access the PBX object configuration (that is, the defined users, trunk lines, nodes, etc.) programmatically.  This could be done for examination or for manipulation.&lt;br /&gt;
&lt;br /&gt;
There are various ways to accomplish this, one of it is using the [[Reference:SOAP_API#string_Admin.28string_xml.29|Admin function]] available in the [[Reference:SOAP_API|SOAP API]].&lt;br /&gt;
&lt;br /&gt;
This function takes a single argument &#039;&#039;&#039;xml&#039;&#039;&#039;, which is executed as a command and the resulting output is returned to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===System Requirements===&lt;br /&gt;
The SOAP interface and thus the SOAP API&#039;s &#039;&#039;&#039;Admin&#039;&#039;&#039; is available when a working PBX is present in a Box.  Please note that the usual restrictions apply for updating entries, namely, entries shall not be modified when LDAP replication is active on the box.  Instead, connect to the LDAP masters SOAP interface and do the modifications.&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
The Admin() function may be used to retrieve information from and write information to the PBX.  Information written to the PBX is effective immediately.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;xml&#039;&#039;&#039; argument to &#039;&#039;&#039;Admin()&#039;&#039;&#039; is an xml string, that has a single top-level element, which is interpreted as command.&lt;br /&gt;
&lt;br /&gt;
Depending on the way the SOAP request is sent the provided &#039;&#039;&#039;xml&#039;&#039;&#039; argument must be manually XML escaped:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code mxml&amp;gt;&lt;br /&gt;
&amp;quot;   &amp;amp;quot;&lt;br /&gt;
&#039;   &amp;amp;apos;&lt;br /&gt;
&amp;lt;   &amp;amp;lt;&lt;br /&gt;
&amp;gt;   &amp;amp;gt;&lt;br /&gt;
&amp;amp;   &amp;amp;amp;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;code mxml&amp;gt;&lt;br /&gt;
 &amp;amp;lt;show&amp;amp;gt;&amp;amp;lt;user cn=&amp;amp;quot;PBX User Four&amp;amp;quot; config=&amp;amp;quot;true&amp;amp;quot;/&amp;amp;gt;&amp;amp;lt;/show&amp;amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are various commands implemented.&lt;br /&gt;
====show====&lt;br /&gt;
The &#039;&#039;&#039;show&#039;&#039;&#039; command will show details about an object, selected by its &#039;&#039;&#039;cn&#039;&#039;&#039; (which is the long name in the PBX user config), e.g.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;show&amp;gt;&amp;lt;user cn=&amp;quot;PBX User Four&amp;quot; config=&amp;quot;true&amp;quot;/&amp;gt;&amp;lt;/show&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code xml&amp;gt;&lt;br /&gt;
&amp;lt;SOAP-ENV:Envelope xmlns:SOAP-ENV=&amp;quot;http://schemas.xmlsoap.org/soap/envelope/&amp;quot; xmlns:pbx=&amp;quot;http://www.innovaphone.com/pbx&amp;quot;&amp;gt;&amp;lt;SOAP-ENV:Header/&amp;gt;&amp;lt;SOAP-ENV:Body&amp;gt;&lt;br /&gt;
&amp;lt;Admin&amp;gt;&amp;lt;xml xsi:type=&amp;quot;xsd:string&amp;quot;&amp;gt;&amp;amp;lt;show&amp;amp;gt;&amp;amp;lt;user cn=&amp;quot;PBX User Four&amp;quot; config=&amp;quot;true&amp;quot;/&amp;amp;gt;&amp;amp;lt;/show&amp;amp;gt;&amp;lt;/xml&amp;gt;&lt;br /&gt;
&amp;lt;/Admin&amp;gt;&amp;lt;/SOAP-ENV:Body&amp;gt;&amp;lt;/SOAP-ENV:Envelope&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The attribute config=&amp;quot;true&amp;quot; (available starting with version 9) is optional. If used only the pure config stored at a user is provided, without application of templates.&lt;br /&gt;
&lt;br /&gt;
The command will return the data for &#039;&#039;&#039;PBX User Four&#039;&#039;&#039; (provided there is one):&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;show time=&amp;quot;2994&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;user &lt;br /&gt;
        cn=&amp;quot;PBX User Four&amp;quot; &lt;br /&gt;
        guid=&amp;quot;4126ec4ee909d3119db10090330600e8&amp;quot; &lt;br /&gt;
        e164=&amp;quot;140&amp;quot; &lt;br /&gt;
        h323=&amp;quot;user-4&amp;quot; &lt;br /&gt;
        pwd=&amp;quot;********&amp;quot; &lt;br /&gt;
        fake=&amp;quot;123&amp;quot; &lt;br /&gt;
        cfnr=&amp;quot;99&amp;quot; &lt;br /&gt;
        busy-out=&amp;quot;4711&amp;quot; &lt;br /&gt;
        loc=&amp;quot;Sindelfingen&amp;quot; &lt;br /&gt;
        node=&amp;quot;root&amp;quot; &lt;br /&gt;
        filter=&amp;quot;normal&amp;quot; &lt;br /&gt;
        cd-filter=&amp;quot;normal&amp;quot; &lt;br /&gt;
        type=&amp;quot;ep&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;cd &lt;br /&gt;
        type=&amp;quot;cfb&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;ep &lt;br /&gt;
            e164=&amp;quot;0900123&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/cd&amp;gt;&lt;br /&gt;
    &amp;lt;cd &lt;br /&gt;
        type=&amp;quot;cfnr&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;ep &lt;br /&gt;
            e164=&amp;quot;0900321&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/cd&amp;gt;&amp;lt;&lt;br /&gt;
    &amp;lt;grp &lt;br /&gt;
        name=&amp;quot;test&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;grp &lt;br /&gt;
        name=&amp;quot;soap&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;ep &lt;br /&gt;
        type=&amp;quot;EP&amp;quot; &lt;br /&gt;
        addr=&amp;quot;172.16.10.38&amp;quot; &lt;br /&gt;
        port=&amp;quot;2069&amp;quot; &lt;br /&gt;
        product=&amp;quot;innovaphone IP230 [-/08-6090020/20080116-01]&amp;quot; &lt;br /&gt;
        version=&amp;quot;6.00 dvl-sr2 [08-60900.20/222/104]&amp;quot; &lt;br /&gt;
        h323=&amp;quot;user-4&amp;quot; &lt;br /&gt;
        time=&amp;quot;336&amp;quot; &lt;br /&gt;
        lic=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/user&amp;gt;&lt;br /&gt;
&amp;lt;/show&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As a special case, you can use the cn &#039;&#039;&#039;*&#039;&#039;&#039; which will yield a list of all known objects. But be aware that the result of a SOAP request is limited to a fixed amount of bytes (version dependant, currently 300kB).  Larger results will cause the request to fail.  It is thus not recommended to use this feature as a general purpose mechanism. Also be aware in V9 the &#039;&#039;show&#039;&#039; request with wildcard as &#039;&#039;cn&#039;&#039; will deliver not complete object configuration (some fields are omitted to reduce the amount of data). &lt;br /&gt;
It is thus recommended to use calls to [[Reference9:Concept_SOAP_API#UserInfo.5B.5D_FindUser.28string_v501.2C_string_v700.2C_string_v800.2C_string_v900.2C_string_cn.2C_string_h323.2C_string_e164.2C_integer_count.2C_integer_next.29|FindUser]] to retrieve the list of all objects and to use &#039;&#039;&#039;Admin()&#039;&#039;&#039; with the specific &#039;&#039;cn&#039;&#039; for each object of interest. An example how to retrieve configuration of all objects can be found here [[Howto:Retrieve configuration of all PBX Objects using SOAP API]].&lt;br /&gt;
&lt;br /&gt;
Subtags underneath &#039;&#039;&#039;&amp;lt;user&amp;gt;&#039;&#039;&#039; include &#039;&#039;&#039;cd&#039;&#039;&#039;, &#039;&#039;&#039;grp&#039;&#039;&#039;, &#039;&#039;&#039;pseudo&#039;&#039;&#039;, &#039;&#039;&#039;gw&#039;&#039;&#039;.  However, this list may change over time and you must not rely on this.  &lt;br /&gt;
&lt;br /&gt;
The list of currently known attributes to &#039;&#039;&#039;&amp;lt;user&amp;gt;&#039;&#039;&#039; is &#039;&#039;&#039;guid&#039;&#039;&#039;, &#039;&#039;&#039;cn&#039;&#039;&#039;, &#039;&#039;&#039;h323&#039;&#039;&#039;, &#039;&#039;&#039;e164&#039;&#039;&#039;, &#039;&#039;&#039;hw-id&#039;&#039;&#039;, &#039;&#039;&#039;pbx&#039;&#039;&#039;, &#039;&#039;&#039;loc&#039;&#039;&#039;, &#039;&#039;&#039;node&#039;&#039;&#039;, &#039;&#039;&#039;rep&#039;&#039;&#039;, &#039;&#039;&#039;phys&#039;&#039;&#039;, &#039;&#039;&#039;pwd&#039;&#039;&#039;, &#039;&#039;&#039;cfnr&#039;&#039;&#039;, &#039;&#039;&#039;busy-in&#039;&#039;&#039;, &#039;&#039;&#039;busy-out&#039;&#039;&#039;, &#039;&#039;&#039;type&#039;&#039;&#039;, &#039;&#039;&#039;filter&#039;&#039;&#039;, &#039;&#039;&#039;cd-filter&#039;&#039;&#039;, &#039;&#039;&#039;gi&#039;&#039;&#039;, &#039;&#039;&#039;local&#039;&#039;&#039;.  Again, this list may change and you must not rely on it.&lt;br /&gt;
&lt;br /&gt;
Please note the appearance of the &#039;&#039;&#039;pwd&#039;&#039;&#039; attribute (&#039;&#039;&#039;pwd=&amp;quot;********&amp;quot;&#039;&#039;&#039;).  It is - of course - not possible to retrieve the password using this interface (in fact, it is not possible to retrieve the password at all). &lt;br /&gt;
&lt;br /&gt;
Some of the information is in fact runtime data, not configuration data.  For example, the &#039;&#039;&#039;&amp;lt;ep&amp;gt;&#039;&#039;&#039; tag shows current registration information for the object.&lt;br /&gt;
&lt;br /&gt;
====add====&lt;br /&gt;
The &#039;&#039;&#039;add&#039;&#039;&#039; command will create a new PBX object, e.g.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;add&amp;gt;&lt;br /&gt;
    &amp;lt;user &lt;br /&gt;
        cn=&amp;quot;new PBX User Four&amp;quot; &lt;br /&gt;
        e164=&amp;quot;140&amp;quot; &lt;br /&gt;
        h323=&amp;quot;user-4&amp;quot; &lt;br /&gt;
        cfnr=&amp;quot;99&amp;quot; &lt;br /&gt;
        busy-out=&amp;quot;4711&amp;quot; &lt;br /&gt;
        loc=&amp;quot;Sindelfingen&amp;quot; &lt;br /&gt;
        node=&amp;quot;root&amp;quot; &lt;br /&gt;
        filter=&amp;quot;normal&amp;quot; &lt;br /&gt;
        cd-filter=&amp;quot;normal&amp;quot; &lt;br /&gt;
        type=&amp;quot;ep&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;cd type=&amp;quot;cfb&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;ep e164=&amp;quot;0900123&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/cd&amp;gt;&lt;br /&gt;
        &amp;lt;cd type=&amp;quot;cfnr&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;ep e164=&amp;quot;0900321&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/cd&amp;gt;&lt;br /&gt;
        &amp;lt;grp name=&amp;quot;soap&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;grp name=&amp;quot;test&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/user&amp;gt;&lt;br /&gt;
&amp;lt;/add&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the addition is ok&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;ok/&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
will be returned.&lt;br /&gt;
&lt;br /&gt;
There is no need to define all attributes, nor is it required to include all the subtags.  For example, you can add the call diversions later using the &#039;&#039;&#039;&amp;lt;add-attrib&amp;gt;&#039;&#039;&#039; command.  However, keep in mind that &#039;&#039;incomplete&#039;&#039; objects may cause harm (e.g. objects that have no setting for the &#039;&#039;&#039;node&#039;&#039;&#039; attribute).  &lt;br /&gt;
&lt;br /&gt;
To determine the available attributes and subtags, create an object manually using the web interface and retrieve the xml representation using the &#039;&#039;&#039;show&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
Any &#039;&#039;&#039;guid&#039;&#039;&#039; attribute will be ignored and the new object receives a new guid.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====modify====&lt;br /&gt;
To modify an existing entry, use the &#039;&#039;&#039;modify&#039;&#039;&#039; command.  It has one subtag &#039;&#039;&#039;&amp;lt;user&amp;gt;&#039;&#039;&#039; which carries the complete data for the object after modification (not just the data that shall be modified).  The object to be modified is determined by the &#039;&#039;&#039;guid&#039;&#039;&#039; attribute within the &#039;&#039;&#039;&amp;lt;user&amp;gt;&#039;&#039;&#039; tag.  In the absence of this, it is determined by the &#039;&#039;&#039;cn&#039;&#039;&#039; (aka &#039;&#039;Long Name&#039;&#039;) attribute.  Thus, to change the long name of an object, you need to specify its guid, otherwise the cn is sufficient.&lt;br /&gt;
&lt;br /&gt;
In fact, the &#039;&#039;&#039;modify&#039;&#039;&#039; command is functional identical to a &#039;&#039;&#039;del&#039;&#039;&#039; / &#039;&#039;&#039;add&#039;&#039;&#039; cycle.  The only difference is that the object is not really removed in between, so that the guid stays the same and any action related to the removal of an object (such as the deregistration of endpoints registered on the object) does not happen.&lt;br /&gt;
&lt;br /&gt;
The only &#039;&#039;fool-proof&#039;&#039; method of changing an objects attribute thus is to do a &#039;&#039;&#039;show&#039;&#039;&#039; / &#039;&#039;&#039;modify&#039;&#039;&#039; cycle.  When the &#039;&#039;&#039;pwd&#039;&#039;&#039; attribute is given as 8 stars (&#039;&#039;&#039;pwd=&amp;quot;********&amp;quot;&#039;&#039;&#039;), then it is not modified/set.  Any other value is interpreted as clear text password.  From firmware version 10 upwards, the &#039;&#039;&#039;show&#039;&#039; command will additionally report the password in encrypted form.  If &#039;&#039;&#039;pwdx&#039;&#039;&#039; is sent back to the PBX during a &#039;&#039;&#039;modify&#039;&#039;&#039; command and the &#039;&#039;&#039;pwd&#039;&#039;&#039; attribute has the value &#039;&#039;&#039;********&#039;&#039;&#039;, then the decrypted value of &#039;&#039;&#039;pwdx&#039;&#039;&#039; is set as the new password.  If &#039;&#039;&#039;pwd&#039;&#039;&#039; is not &#039;&#039;&#039;********&#039;&#039;&#039;, its value is used as the new password (clear text). &lt;br /&gt;
&lt;br /&gt;
Please note that for a &#039;&#039;&#039;modify&#039;&#039;&#039; to succeed, the object does not need to exist.  In fact, &#039;&#039;&#039;modify&#039;&#039;&#039; on a non-existing object will create it.&lt;br /&gt;
&lt;br /&gt;
====del====&lt;br /&gt;
An object can be deleted using the &#039;&#039;&#039;del&#039;&#039;&#039; command.&lt;br /&gt;
You must specify the &#039;&#039;&#039;cn&#039;&#039;&#039; attribute to delete an object, the &#039;&#039;&#039;guid&#039;&#039;&#039; will not do.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;del&amp;gt;&amp;lt;user cn=&amp;quot;supernew PBX User Four&amp;quot;/&amp;gt;&amp;lt;/del&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
will delete the user with long name &amp;quot;supernew PBX User Four&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====add-attrib / del-attrib====&lt;br /&gt;
Some of the PBX object attributes can be accessed separately.  This is true for all (usually multi-valued) attributes that live in a separate &#039;&#039;&#039;pbx=&#039;&#039;&#039; value on the FLASHDIR level.  To understand this, have a look at an object and its representations on the XML and FLASHDIR level.  Let us assume we have an object with cn &#039;&#039;&#039;PBX User Four&#039;&#039;&#039;.  The &#039;&#039;&#039;show&#039;&#039;&#039; command yields&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;show time=&amp;quot;18613&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;user &lt;br /&gt;
        cn=&amp;quot;PBX User Four&amp;quot; &lt;br /&gt;
        guid=&amp;quot;4126ec4ee909d3119db10090330600e8&amp;quot; &lt;br /&gt;
        e164=&amp;quot;140&amp;quot; &lt;br /&gt;
        h323=&amp;quot;user-4&amp;quot; &lt;br /&gt;
        pwd=&amp;quot;********&amp;quot; &lt;br /&gt;
        fake=&amp;quot;123&amp;quot; &lt;br /&gt;
        cfnr=&amp;quot;99&amp;quot; &lt;br /&gt;
        busy-out=&amp;quot;4711&amp;quot; &lt;br /&gt;
        loc=&amp;quot;Sindelfingen&amp;quot; &lt;br /&gt;
        node=&amp;quot;root&amp;quot; &lt;br /&gt;
        filter=&amp;quot;normal&amp;quot; &lt;br /&gt;
        cd-filter=&amp;quot;normal&amp;quot; &lt;br /&gt;
        type=&amp;quot;ep&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;cd &lt;br /&gt;
        type=&amp;quot;cfb&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;ep &lt;br /&gt;
            e164=&amp;quot;0900123&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/cd&amp;gt;&lt;br /&gt;
        &amp;lt;cd &lt;br /&gt;
            type=&amp;quot;cfnr&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;ep e164=&amp;quot;0900321&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/cd&amp;gt;&lt;br /&gt;
        &amp;lt;grp &lt;br /&gt;
            name=&amp;quot;soap&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;grp &lt;br /&gt;
            name=&amp;quot;test&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/user&amp;gt;&lt;br /&gt;
&amp;lt;/show&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
On the FLASHDIR level (as seen in &#039;&#039;Config show&#039;&#039;), the object looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mod cmd FLASHDIR0 add-item 101 &lt;br /&gt;
    (cn=PBX User Four)&lt;br /&gt;
    (guid;bin=4126EC4EE909D3119DB10090330600E8)&lt;br /&gt;
    (h323=user-4)&lt;br /&gt;
    (e164=140)&lt;br /&gt;
    (loc=Sindelfingen)&lt;br /&gt;
    (node=root)&lt;br /&gt;
    (pbx=&amp;lt;user filter=&amp;quot;normal&amp;quot; cd-filter=&amp;quot;normal&amp;quot; fake=&amp;quot;123&amp;quot; cfnr=&amp;quot;99&amp;quot; busy-in=&amp;quot;65535&amp;quot; busy-out=&amp;quot;4711&amp;quot; pwd=&amp;quot;ff8523566a0b5b820f785a6ed1eb24e5&amp;quot;/&amp;gt;)&lt;br /&gt;
    (pbx=&amp;lt;grp name=&amp;quot;soap&amp;quot;/&amp;gt;)&lt;br /&gt;
    (pbx=&amp;lt;grp name=&amp;quot;test&amp;quot;/&amp;gt;)&lt;br /&gt;
    (pbx=&amp;lt;cd type=&amp;quot;cfb&amp;quot;&amp;gt;&amp;lt;ep e164=&amp;quot;0900123&amp;quot;/&amp;gt;&amp;lt;/cd&amp;gt;)&lt;br /&gt;
    (pbx=&amp;lt;cd type=&amp;quot;cfnr&amp;quot;&amp;gt;&amp;lt;ep e164=&amp;quot;0900321&amp;quot;/&amp;gt;&amp;lt;/cd&amp;gt;)&lt;br /&gt;
    (usn=35)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any information that is stored in a single &#039;&#039;&#039;(pbx=&amp;lt;...&#039;&#039;&#039; value can be deleted using &#039;&#039;&#039;del-attrib&#039;&#039;&#039; or added using &#039;&#039;&#039;add-attrib&#039;&#039;&#039;.  To delete e.g. the CFB to 09000123, you can use&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;del-attrib&amp;gt;&lt;br /&gt;
    &amp;lt;user &lt;br /&gt;
        cn=&amp;quot;new PBX User Four&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;cd type=&amp;quot;cfb&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;ep e164=&amp;quot;0900123&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/cd&amp;gt;&lt;br /&gt;
    &amp;lt;/user&amp;gt;&lt;br /&gt;
&amp;lt;/del-attrib&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To delete such an attribute, it is important that you specify the complete attribute xml syntax as subtag to the &#039;&#039;&#039;&amp;lt;user&amp;gt;&#039;&#039;&#039; tag.  In the previous example, this is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;cd type=&amp;quot;cfb&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;ep e164=&amp;quot;0900123&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/cd&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Removing all Devices from User Object ===&lt;br /&gt;
to be able to delete all Devices/HW-IDs from an Object, an additional attribute &#039;&#039;no-dev&#039;&#039; must be supplied. Otherwise the PBX will add a device with Hardware-ID set to the Name of the Object.&lt;br /&gt;
&lt;br /&gt;
Example modify request:&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;modify&amp;gt;&lt;br /&gt;
   &amp;lt;user cn=&amp;quot;User 6&amp;quot;&lt;br /&gt;
         guid=&amp;quot;819a174e73365901b90b009033400215&amp;quot;&lt;br /&gt;
         e164=&amp;quot;16&amp;quot;&lt;br /&gt;
         h323=&amp;quot;user6&amp;quot;&lt;br /&gt;
         pwd=&amp;quot;********&amp;quot;&lt;br /&gt;
         pwdx=&amp;quot;529c49b24c3e40c67d3f24f214b843cdd77fe777d7dab77f&amp;quot;&lt;br /&gt;
         loc=&amp;quot;hq&amp;quot;&lt;br /&gt;
         node=&amp;quot;root&amp;quot;&lt;br /&gt;
         no-dev=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/modify&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Determination of the cn ===&lt;br /&gt;
When the &#039;&#039;&#039;cn&#039;&#039;&#039; of an object is not known, it can be determined by virtue of the [[Reference:SOAP_API#UserInfo.5B.5D_FindUser.28string_v501.2C_string_cn.2C_string_h323.2C_string_e164.2C_integer_count.2C_integer_next.29|SOAP FindUser]] function.&lt;br /&gt;
&lt;br /&gt;
=== Setting and Retrieving Passwords ===&lt;br /&gt;
Passwords cannot be retrieved in clear.  They can be set and retrieved in encrypted format though, see [[Howto:Using_the_SOAP_Admin_Function#modify|modify]] above.  See &#039;&#039;Related articles&#039;&#039; below for a discussion of password encryption in the PBX.&lt;br /&gt;
&lt;br /&gt;
===Uncovering xml commands with V5 PBXs===&lt;br /&gt;
On more recent V5 (and later) PBX platforms, you can uncover valid syntax by turning on the configuration changes logging (&#039;&#039;Administration&#039;&#039;) in the log interface and then performing the action you want to mimic with your SOAP program in the user interface.  The xml commands will show up as syslog entries.&lt;br /&gt;
&lt;br /&gt;
== Related Articles ==&lt;br /&gt;
&lt;br /&gt;
* [[Howto:Encrypt_or_Decrypt_PBX_user_passwords]] - how PBX passwords are encrypted&lt;br /&gt;
* [[Howto:SOAP API PHP5 Sample Code]] - PHP5 sample code.  Also show sample usage of the SOAP Admin() function, so it is good reading even if you do not implement in PHP!&lt;br /&gt;
&lt;br /&gt;
[[Category:Howto|{{PAGENAME}}]]&lt;/div&gt;</summary>
		<author><name>Franciscopaletta</name></author>
	</entry>
	<entry>
		<id>https://wiki.innovaphone.com/index.php?title=Howto:SOAP_API_Java_Sample_Code&amp;diff=49687</id>
		<title>Howto:SOAP API Java Sample Code</title>
		<link rel="alternate" type="text/html" href="https://wiki.innovaphone.com/index.php?title=Howto:SOAP_API_Java_Sample_Code&amp;diff=49687"/>
		<updated>2018-05-03T13:44:43Z</updated>

		<summary type="html">&lt;p&gt;Franciscopaletta: /* The sample application */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FIXME|reason=TODO: work in progress }}&lt;br /&gt;
&lt;br /&gt;
==Applies To==&lt;br /&gt;
This information applies to&lt;br /&gt;
&lt;br /&gt;
* any innovaphone PBX platform&lt;br /&gt;
* Java Runtime Environment&lt;br /&gt;
&lt;br /&gt;
innovaphone PBX web services can be used from Java Runtime Environment.  Here is how&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- web service, soap service, soapservice, webservice, basic, soap api, soapapi --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==More Information==&lt;br /&gt;
===Configuration===&lt;br /&gt;
Modify the global variables &#039;&#039;SOAPENDPOINTURL&#039;&#039;, &#039;&#039;ADMSOAPUSER&#039;&#039;, &#039;&#039;ADMSOAPUSERPWD&#039;&#039;, &#039;&#039;SOAPUSER&#039;&#039; and &#039;&#039;CNUSER&#039;&#039; according to your specific system.&lt;br /&gt;
&lt;br /&gt;
===Running Sample Code===&lt;br /&gt;
This code is a simple Java console application. It will run on your OS console terminal. As dependencies, you will need JDK to compile the code and JRE to execute it.&lt;br /&gt;
&lt;br /&gt;
To &#039;&#039;&#039;compile&#039;&#039;&#039;, save the code on file &#039;&#039;&#039;innoSOAP.java&#039;&#039;&#039; and provide that file as parameter to &#039;&#039;&#039;javac&#039;&#039;&#039; command.&lt;br /&gt;
*The below code was compiled on javac version 1.8.0 and run on java version 1.8.0 (It was not tested on other versions)&lt;br /&gt;
*You may get a warning regarding the function sun.misc.BASE64Encoder().encode() because it is deprecated. Nevertheless the code will run. You may remove that section of the code (used just for authentication on the PBX) but you will have to allow &amp;quot;public&amp;quot; access to /PBX0/user.soap on HTTP(security risk!!!).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====The sample application ====&lt;br /&gt;
This section will discuss the sample code.  It is not a decent description of the PBX SOAP API.  For this, see the related articles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code java&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import javax.xml.soap.*;&lt;br /&gt;
import org.w3c.dom.NodeList;&lt;br /&gt;
&lt;br /&gt;
public class innoSOAP {&lt;br /&gt;
    /*&lt;br /&gt;
        The example below demonstrates the use of SOAP integration to innovaphone PBX.&lt;br /&gt;
    &lt;br /&gt;
        Reference to innovaphone SOAP integration can be found on:&lt;br /&gt;
        http://wiki.innovaphone.com/index.php?title=Reference:SOAP_API&lt;br /&gt;
&lt;br /&gt;
        INSTRUCTIONS:&lt;br /&gt;
        Modifi the global variables below according to your specific system.&lt;br /&gt;
        &lt;br /&gt;
        The program will perform the following tasks:&lt;br /&gt;
        1 - Send a SOAP message with the instruction &amp;quot;Initialize&amp;quot; and grab the session ID.&lt;br /&gt;
        2 - Referencing the session ID it will send a SOAP message with the instruction &amp;quot;UserInitialize&amp;quot; and grab the user ID.&lt;br /&gt;
        3 - Loop on an SOAP instruction &amp;quot;Poll&amp;quot; to keep looking for information on the user CNUSER (refer to global variables below)&lt;br /&gt;
            User information and Call information.&lt;br /&gt;
        (The Poll call remains opened until information is provided or time out. In case of timeout PBX sends an emtpy response&lt;br /&gt;
         and then another Poll call takes place)&lt;br /&gt;
        &lt;br /&gt;
        Created by:&lt;br /&gt;
        Francisco Paletta&lt;br /&gt;
        &lt;br /&gt;
        Version: 0.2&lt;br /&gt;
    */&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    //innovaphone general information&lt;br /&gt;
    private static final String MYNAMESPACE = &amp;quot;pbx&amp;quot;;&lt;br /&gt;
    private static final String MYNAMESPACEURI = &amp;quot;http://www.innovaphone.com/pbx&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
    //specific system information&lt;br /&gt;
    private static final String SOAPACTION = &amp;quot;&amp;quot;;&lt;br /&gt;
    private static final String SOAPENDPOINTURL = &amp;quot;http://192.168.0.1/PBX0/user.soap&amp;quot;;&lt;br /&gt;
    private static final String ADMSOAPUSER = &amp;quot;admin&amp;quot;; //PBX admin user&lt;br /&gt;
    private static final String ADMSOAPUSERPWD = &amp;quot;ip311&amp;quot;; //PBX admin password&lt;br /&gt;
    private static final String SOAPUSER = &amp;quot;SOAP&amp;quot;; //SOAP user object in PBX with group access to other objects&lt;br /&gt;
    private static final String CNUSER = &amp;quot;User 1&amp;quot;; //CN of user to perform Poll on&lt;br /&gt;
&lt;br /&gt;
    // Main function&lt;br /&gt;
    public static void main(String args[]) {&lt;br /&gt;
        callSoapWebService(SOAPENDPOINTURL, SOAPACTION);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //Prints all nodes on the nodelist&lt;br /&gt;
    private static void nodeListPrint(NodeList list, String tab){&lt;br /&gt;
        NodeList childList;        &lt;br /&gt;
        for (int i = 0; i &amp;lt; list.getLength(); i++) {&lt;br /&gt;
            System.out.print(tab+String.valueOf(list.item(i).getNodeName()));&lt;br /&gt;
            childList = list.item(i).getChildNodes();&lt;br /&gt;
            if(childList.getLength() != 0) {&lt;br /&gt;
                if(!childList.item(0).getNodeName().equals(&amp;quot;#text&amp;quot;)) {&lt;br /&gt;
                    System.out.println(&amp;quot;&amp;quot;);&lt;br /&gt;
                    nodeListPrint(childList, tab+&amp;quot;  &amp;quot;);&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    System.out.print(&amp;quot; -&amp;gt; &amp;quot;);&lt;br /&gt;
                    System.out.println(String.valueOf(childList.item(0).getTextContent()));&lt;br /&gt;
                }                &lt;br /&gt;
            } else {&lt;br /&gt;
                System.out.println(&amp;quot;&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        } &lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //Starts web connection and execute the SOAP calls&lt;br /&gt;
    private static void callSoapWebService(String soapEndpointUrl, String soapAction) {&lt;br /&gt;
        try {&lt;br /&gt;
            &lt;br /&gt;
            String session=&amp;quot;&amp;quot;;&lt;br /&gt;
            String user=&amp;quot;&amp;quot;;&lt;br /&gt;
            &lt;br /&gt;
            // Create SOAP Connection&lt;br /&gt;
            SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();&lt;br /&gt;
            SOAPConnection soapConnection = soapConnectionFactory.createConnection();&lt;br /&gt;
            &lt;br /&gt;
&lt;br /&gt;
            // Send SOAP Message to SOAP Server&lt;br /&gt;
            SOAPMessage soapResponse = soapConnection.call(createSOAPRequest_Initialize(soapAction), soapEndpointUrl);&lt;br /&gt;
            // Print the SOAP Response&lt;br /&gt;
            System.out.println(&amp;quot;Response SOAP Message:&amp;quot;);&lt;br /&gt;
            soapResponse.writeTo(System.out);&lt;br /&gt;
            System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
            SOAPBody body = soapResponse.getSOAPBody();&lt;br /&gt;
            NodeList returnList = body.getElementsByTagName(&amp;quot;InitializeResponse&amp;quot;);&lt;br /&gt;
            &lt;br /&gt;
            System.out.println(&amp;quot;Response Parsed:&amp;quot;);&lt;br /&gt;
            nodeListPrint(returnList,&amp;quot;&amp;quot;);&lt;br /&gt;
            System.out.println(&amp;quot;&amp;quot;);&lt;br /&gt;
            &lt;br /&gt;
            for (int k = 0; k &amp;lt; returnList.getLength(); k++) {&lt;br /&gt;
                NodeList innerResultList = returnList.item(k).getChildNodes();&lt;br /&gt;
                for (int l = 0; l &amp;lt; innerResultList.getLength(); l++) {&lt;br /&gt;
                    if (innerResultList.item(l).getNodeName().equalsIgnoreCase(&amp;quot;return&amp;quot;)) {&lt;br /&gt;
                        session = String.valueOf(innerResultList.item(l).getTextContent().trim());&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            soapResponse = soapConnection.call(createSOAPRequest_UserInitialize(soapAction, session), soapEndpointUrl);&lt;br /&gt;
&lt;br /&gt;
            // Print the SOAP Response&lt;br /&gt;
            System.out.println(&amp;quot;Response SOAP Message:&amp;quot;);&lt;br /&gt;
            soapResponse.writeTo(System.out);&lt;br /&gt;
            System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
            &lt;br /&gt;
            body = soapResponse.getSOAPBody();&lt;br /&gt;
            returnList = body.getElementsByTagName(&amp;quot;UserInitializeResponse&amp;quot;);&lt;br /&gt;
            &lt;br /&gt;
            System.out.println(&amp;quot;Response Parsed:&amp;quot;);&lt;br /&gt;
            nodeListPrint(returnList,&amp;quot;&amp;quot;);&lt;br /&gt;
            System.out.println(&amp;quot;&amp;quot;);&lt;br /&gt;
            &lt;br /&gt;
            for (int k = 0; k &amp;lt; returnList.getLength(); k++) {&lt;br /&gt;
                NodeList innerResultList = returnList.item(k).getChildNodes();&lt;br /&gt;
                for (int l = 0; l &amp;lt; innerResultList.getLength(); l++) {&lt;br /&gt;
                    if (innerResultList.item(l).getNodeName().equalsIgnoreCase(&amp;quot;return&amp;quot;)) {&lt;br /&gt;
                        user = String.valueOf(innerResultList.item(l).getTextContent().trim());&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            boolean returnValue = true;&lt;br /&gt;
            while(returnValue){&lt;br /&gt;
                soapResponse = soapConnection.call(createSOAPRequest_Poll(soapAction, session), soapEndpointUrl);&lt;br /&gt;
                //The call for Poll remains opened until PBX sends a response. In case of timeout PBX sends an empty response.&lt;br /&gt;
                //The loop will guarantee another Poll call is send to keep &amp;quot;channel&amp;quot; running.&lt;br /&gt;
                &lt;br /&gt;
                // Print the SOAP Response&lt;br /&gt;
                System.out.println(&amp;quot;Response SOAP Message:&amp;quot;);&lt;br /&gt;
                soapResponse.writeTo(System.out);&lt;br /&gt;
                System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
                body = soapResponse.getSOAPBody();&lt;br /&gt;
                returnList = body.getElementsByTagName(&amp;quot;PollResponse&amp;quot;);&lt;br /&gt;
                System.out.println(&amp;quot;Response Parsed:&amp;quot;);&lt;br /&gt;
                nodeListPrint(returnList,&amp;quot;&amp;quot;);&lt;br /&gt;
                System.out.println(&amp;quot;&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            soapConnection.close();&lt;br /&gt;
        } catch (Exception e) {&lt;br /&gt;
            System.err.println(&amp;quot;\nError occurred while sending SOAP Request to Server!\nMake sure you have the correct endpoint URL and SOAPAction!\n&amp;quot;);&lt;br /&gt;
            e.printStackTrace();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //Creates a SOAPmessage with the &amp;quot;Initialize&amp;quot; instruction&lt;br /&gt;
    private static SOAPMessage createSOAPRequest_Initialize(String soapAction) throws Exception {&lt;br /&gt;
        MessageFactory messageFactory = MessageFactory.newInstance();&lt;br /&gt;
        SOAPMessage soapMessage = messageFactory.createMessage();&lt;br /&gt;
        SOAPPart soapPart = soapMessage.getSOAPPart();&lt;br /&gt;
        &lt;br /&gt;
        // SOAP Envelope&lt;br /&gt;
        SOAPEnvelope envelope = soapPart.getEnvelope();&lt;br /&gt;
        envelope.addNamespaceDeclaration(MYNAMESPACE, MYNAMESPACEURI);&lt;br /&gt;
&lt;br /&gt;
        // SOAP Body&lt;br /&gt;
        SOAPBody soapBody = envelope.getBody();&lt;br /&gt;
        SOAPElement soapBodyElem = soapBody.addChildElement(&amp;quot;Initialize&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem1 = soapBodyElem.addChildElement(&amp;quot;user&amp;quot;);&lt;br /&gt;
        soapBodyElem1.addTextNode(SOAPUSER);&lt;br /&gt;
        SOAPElement soapBodyElem2 = soapBodyElem.addChildElement(&amp;quot;appl&amp;quot;);&lt;br /&gt;
        soapBodyElem2.addTextNode(&amp;quot;JAVA SOAP CALL&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem3 = soapBodyElem.addChildElement(&amp;quot;bool&amp;quot;);&lt;br /&gt;
        soapBodyElem3.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem4 = soapBodyElem.addChildElement(&amp;quot;v501&amp;quot;);&lt;br /&gt;
        soapBodyElem4.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem5 = soapBodyElem.addChildElement(&amp;quot;v700&amp;quot;);&lt;br /&gt;
        soapBodyElem5.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem6 = soapBodyElem.addChildElement(&amp;quot;v800&amp;quot;);&lt;br /&gt;
        soapBodyElem6.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem7 = soapBodyElem.addChildElement(&amp;quot;vx1000&amp;quot;);&lt;br /&gt;
        soapBodyElem7.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        MimeHeaders headers = soapMessage.getMimeHeaders();&lt;br /&gt;
        headers.addHeader(&amp;quot;SOAPAction&amp;quot;, soapAction);&lt;br /&gt;
&lt;br /&gt;
        String authorization = new sun.misc.BASE64Encoder().encode((ADMSOAPUSER+&amp;quot;:&amp;quot;+ADMSOAPUSERPWD).getBytes());&lt;br /&gt;
        headers.addHeader(&amp;quot;Authorization&amp;quot;, &amp;quot;Basic &amp;quot; + authorization);&lt;br /&gt;
&lt;br /&gt;
        soapMessage.saveChanges();&lt;br /&gt;
&lt;br /&gt;
        /* Print the request message, just for debugging purposes */&lt;br /&gt;
        System.out.println(&amp;quot;Request SOAP Message:&amp;quot;);&lt;br /&gt;
        soapMessage.writeTo(System.out);&lt;br /&gt;
        System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        return soapMessage;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //Creates a SOAPmessage with the &amp;quot;UserInitialize&amp;quot; instruction&lt;br /&gt;
    private static SOAPMessage createSOAPRequest_UserInitialize(String soapAction, String session) throws Exception {&lt;br /&gt;
        MessageFactory messageFactory = MessageFactory.newInstance();&lt;br /&gt;
        SOAPMessage soapMessage = messageFactory.createMessage();&lt;br /&gt;
        SOAPPart soapPart = soapMessage.getSOAPPart();&lt;br /&gt;
        &lt;br /&gt;
        // SOAP Envelope&lt;br /&gt;
        SOAPEnvelope envelope = soapPart.getEnvelope();&lt;br /&gt;
        envelope.addNamespaceDeclaration(MYNAMESPACE, MYNAMESPACEURI);&lt;br /&gt;
&lt;br /&gt;
        // SOAP Body&lt;br /&gt;
        SOAPBody soapBody = envelope.getBody();&lt;br /&gt;
        SOAPElement soapBodyElem = soapBody.addChildElement(&amp;quot;UserInitialize&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem1 = soapBodyElem.addChildElement(&amp;quot;session&amp;quot;);&lt;br /&gt;
        soapBodyElem1.addTextNode(session);&lt;br /&gt;
        SOAPElement soapBodyElem2 = soapBodyElem.addChildElement(&amp;quot;user&amp;quot;);&lt;br /&gt;
        soapBodyElem2.addTextNode(CNUSER);&lt;br /&gt;
        SOAPElement soapBodyElem3 = soapBodyElem.addChildElement(&amp;quot;follow&amp;quot;);&lt;br /&gt;
        soapBodyElem3.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        MimeHeaders headers = soapMessage.getMimeHeaders();&lt;br /&gt;
        headers.addHeader(&amp;quot;SOAPAction&amp;quot;, soapAction);&lt;br /&gt;
&lt;br /&gt;
        String authorization = new sun.misc.BASE64Encoder().encode((ADMSOAPUSER+&amp;quot;:&amp;quot;+ADMSOAPUSERPWD).getBytes());&lt;br /&gt;
        headers.addHeader(&amp;quot;Authorization&amp;quot;, &amp;quot;Basic &amp;quot; + authorization);&lt;br /&gt;
&lt;br /&gt;
        soapMessage.saveChanges();&lt;br /&gt;
&lt;br /&gt;
        /* Print the request message, just for debugging purposes */&lt;br /&gt;
        System.out.println(&amp;quot;Request SOAP Message:&amp;quot;);&lt;br /&gt;
        soapMessage.writeTo(System.out);&lt;br /&gt;
        System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        return soapMessage;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //Creates a SOAPmessage with the &amp;quot;Poll&amp;quot; instruction&lt;br /&gt;
    private static SOAPMessage createSOAPRequest_Poll(String soapAction, String session) throws Exception {&lt;br /&gt;
        MessageFactory messageFactory = MessageFactory.newInstance();&lt;br /&gt;
        SOAPMessage soapMessage = messageFactory.createMessage();&lt;br /&gt;
        SOAPPart soapPart = soapMessage.getSOAPPart();&lt;br /&gt;
        &lt;br /&gt;
        // SOAP Envelope&lt;br /&gt;
        SOAPEnvelope envelope = soapPart.getEnvelope();&lt;br /&gt;
        envelope.addNamespaceDeclaration(MYNAMESPACE, MYNAMESPACEURI);&lt;br /&gt;
&lt;br /&gt;
        // SOAP Body&lt;br /&gt;
        SOAPBody soapBody = envelope.getBody();&lt;br /&gt;
        SOAPElement soapBodyElem = soapBody.addChildElement(&amp;quot;Poll&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem1 = soapBodyElem.addChildElement(&amp;quot;session&amp;quot;);&lt;br /&gt;
        soapBodyElem1.addTextNode(session);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        MimeHeaders headers = soapMessage.getMimeHeaders();&lt;br /&gt;
        headers.addHeader(&amp;quot;SOAPAction&amp;quot;, soapAction);&lt;br /&gt;
&lt;br /&gt;
        String authorization = new sun.misc.BASE64Encoder().encode((ADMSOAPUSER+&amp;quot;:&amp;quot;+ADMSOAPUSERPWD).getBytes());&lt;br /&gt;
        headers.addHeader(&amp;quot;Authorization&amp;quot;, &amp;quot;Basic &amp;quot; + authorization);&lt;br /&gt;
&lt;br /&gt;
        soapMessage.saveChanges();&lt;br /&gt;
&lt;br /&gt;
        /* Print the request message, just for debugging purposes */&lt;br /&gt;
        System.out.println(&amp;quot;Request SOAP Message:&amp;quot;);&lt;br /&gt;
        soapMessage.writeTo(System.out);&lt;br /&gt;
        System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        return soapMessage;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Known Problems ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related Articles==&lt;br /&gt;
[[Reference:SOAP API]]&lt;br /&gt;
&lt;br /&gt;
[[Howto:PBX SOAP Api C-sharp sample code ]]&lt;br /&gt;
&lt;br /&gt;
[[Howto:SOAP with PHP5]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--*[[Main_Page|wiki-innovaphone]]--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Sample|{{PAGENAME}}]]&lt;/div&gt;</summary>
		<author><name>Franciscopaletta</name></author>
	</entry>
	<entry>
		<id>https://wiki.innovaphone.com/index.php?title=Howto:SOAP_API_Java_Sample_Code&amp;diff=49686</id>
		<title>Howto:SOAP API Java Sample Code</title>
		<link rel="alternate" type="text/html" href="https://wiki.innovaphone.com/index.php?title=Howto:SOAP_API_Java_Sample_Code&amp;diff=49686"/>
		<updated>2018-05-03T13:43:34Z</updated>

		<summary type="html">&lt;p&gt;Franciscopaletta: /* The sample application */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FIXME|reason=TODO: work in progress }}&lt;br /&gt;
&lt;br /&gt;
==Applies To==&lt;br /&gt;
This information applies to&lt;br /&gt;
&lt;br /&gt;
* any innovaphone PBX platform&lt;br /&gt;
* Java Runtime Environment&lt;br /&gt;
&lt;br /&gt;
innovaphone PBX web services can be used from Java Runtime Environment.  Here is how&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- web service, soap service, soapservice, webservice, basic, soap api, soapapi --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==More Information==&lt;br /&gt;
===Configuration===&lt;br /&gt;
Modify the global variables &#039;&#039;SOAPENDPOINTURL&#039;&#039;, &#039;&#039;ADMSOAPUSER&#039;&#039;, &#039;&#039;ADMSOAPUSERPWD&#039;&#039;, &#039;&#039;SOAPUSER&#039;&#039; and &#039;&#039;CNUSER&#039;&#039; according to your specific system.&lt;br /&gt;
&lt;br /&gt;
===Running Sample Code===&lt;br /&gt;
This code is a simple Java console application. It will run on your OS console terminal. As dependencies, you will need JDK to compile the code and JRE to execute it.&lt;br /&gt;
&lt;br /&gt;
To &#039;&#039;&#039;compile&#039;&#039;&#039;, save the code on file &#039;&#039;&#039;innoSOAP.java&#039;&#039;&#039; and provide that file as parameter to &#039;&#039;&#039;javac&#039;&#039;&#039; command.&lt;br /&gt;
*The below code was compiled on javac version 1.8.0 and run on java version 1.8.0 (It was not tested on other versions)&lt;br /&gt;
*You may get a warning regarding the function sun.misc.BASE64Encoder().encode() because it is deprecated. Nevertheless the code will run. You may remove that section of the code (used just for authentication on the PBX) but you will have to allow &amp;quot;public&amp;quot; access to /PBX0/user.soap on HTTP(security risk!!!).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====The sample application ====&lt;br /&gt;
This section will discuss the sample code.  It is not a decent description of the PBX SOAP API.  For this, see the related articles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code java&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import javax.xml.soap.*;&lt;br /&gt;
import org.w3c.dom.NodeList;&lt;br /&gt;
&lt;br /&gt;
public class innoSOAP {&lt;br /&gt;
    /*&lt;br /&gt;
        The example below demonstrates the use of SOAP integration to innovaphone PBX.&lt;br /&gt;
    &lt;br /&gt;
        Reference to innovaphone SOAP integration can be found on:&lt;br /&gt;
        http://wiki.innovaphone.com/index.php?title=Reference:SOAP_API&lt;br /&gt;
&lt;br /&gt;
        INSTRUCTIONS:&lt;br /&gt;
        Modifi the global variables below according to your specific system.&lt;br /&gt;
        &lt;br /&gt;
        The program will perform the following tasks:&lt;br /&gt;
        1 - Send a SOAP message with the instruction &amp;quot;Initialize&amp;quot; and grab the session ID.&lt;br /&gt;
        2 - Referencing the session ID it will send a SOAP message with the instruction &amp;quot;UserInitialize&amp;quot; and grab the user ID.&lt;br /&gt;
        3 - Loop on an SOAP instruction &amp;quot;Poll&amp;quot; to keep looking for information on the user CNUSER (refer to global variables below)&lt;br /&gt;
            User information and Call information.&lt;br /&gt;
        (The Poll call remains opened until information is provided or time out. In case of timeout PBX sends an emtpy response&lt;br /&gt;
         and then another Poll call takes place)&lt;br /&gt;
        &lt;br /&gt;
        Created by:&lt;br /&gt;
        Francisco Paletta&lt;br /&gt;
        &lt;br /&gt;
        Version: 0.2&lt;br /&gt;
    */&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    //innovaphone general information&lt;br /&gt;
    private static final String MYNAMESPACE = &amp;quot;pbx&amp;quot;;&lt;br /&gt;
    private static final String MYNAMESPACEURI = &amp;quot;http://www.innovaphone.com/pbx&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
    //specific system information&lt;br /&gt;
    private static final String SOAPACTION = &amp;quot;&amp;quot;;&lt;br /&gt;
    private static final String SOAPENDPOINTURL = &amp;quot;http://pbx-pure.eaibrasil.com.br/PBX0/user.soap&amp;quot;;&lt;br /&gt;
    private static final String ADMSOAPUSER = &amp;quot;soapadm&amp;quot;; //PBX admin user&lt;br /&gt;
    private static final String ADMSOAPUSERPWD = &amp;quot;A2Er@h#dx&amp;quot;; //PBX admin password&lt;br /&gt;
    private static final String SOAPUSER = &amp;quot;SOAP&amp;quot;; //SOAP user object in PBX with group access to other objects&lt;br /&gt;
    private static final String CNUSER = &amp;quot;Francisco Paletta&amp;quot;; //CN of user to perform Poll on&lt;br /&gt;
&lt;br /&gt;
    // Main function&lt;br /&gt;
    public static void main(String args[]) {&lt;br /&gt;
        callSoapWebService(SOAPENDPOINTURL, SOAPACTION);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //Prints all nodes on the nodelist&lt;br /&gt;
    private static void nodeListPrint(NodeList list, String tab){&lt;br /&gt;
        NodeList childList;        &lt;br /&gt;
        for (int i = 0; i &amp;lt; list.getLength(); i++) {&lt;br /&gt;
            System.out.print(tab+String.valueOf(list.item(i).getNodeName()));&lt;br /&gt;
            childList = list.item(i).getChildNodes();&lt;br /&gt;
            if(childList.getLength() != 0) {&lt;br /&gt;
                if(!childList.item(0).getNodeName().equals(&amp;quot;#text&amp;quot;)) {&lt;br /&gt;
                    System.out.println(&amp;quot;&amp;quot;);&lt;br /&gt;
                    nodeListPrint(childList, tab+&amp;quot;  &amp;quot;);&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    System.out.print(&amp;quot; -&amp;gt; &amp;quot;);&lt;br /&gt;
                    System.out.println(String.valueOf(childList.item(0).getTextContent()));&lt;br /&gt;
                }                &lt;br /&gt;
            } else {&lt;br /&gt;
                System.out.println(&amp;quot;&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
        } &lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //Starts web connection and execute the SOAP calls&lt;br /&gt;
    private static void callSoapWebService(String soapEndpointUrl, String soapAction) {&lt;br /&gt;
        try {&lt;br /&gt;
            &lt;br /&gt;
            String session=&amp;quot;&amp;quot;;&lt;br /&gt;
            String user=&amp;quot;&amp;quot;;&lt;br /&gt;
            &lt;br /&gt;
            // Create SOAP Connection&lt;br /&gt;
            SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();&lt;br /&gt;
            SOAPConnection soapConnection = soapConnectionFactory.createConnection();&lt;br /&gt;
            &lt;br /&gt;
&lt;br /&gt;
            // Send SOAP Message to SOAP Server&lt;br /&gt;
            SOAPMessage soapResponse = soapConnection.call(createSOAPRequest_Initialize(soapAction), soapEndpointUrl);&lt;br /&gt;
            // Print the SOAP Response&lt;br /&gt;
            System.out.println(&amp;quot;Response SOAP Message:&amp;quot;);&lt;br /&gt;
            soapResponse.writeTo(System.out);&lt;br /&gt;
            System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
            SOAPBody body = soapResponse.getSOAPBody();&lt;br /&gt;
            NodeList returnList = body.getElementsByTagName(&amp;quot;InitializeResponse&amp;quot;);&lt;br /&gt;
            &lt;br /&gt;
            System.out.println(&amp;quot;Response Parsed:&amp;quot;);&lt;br /&gt;
            nodeListPrint(returnList,&amp;quot;&amp;quot;);&lt;br /&gt;
            System.out.println(&amp;quot;&amp;quot;);&lt;br /&gt;
            &lt;br /&gt;
            for (int k = 0; k &amp;lt; returnList.getLength(); k++) {&lt;br /&gt;
                NodeList innerResultList = returnList.item(k).getChildNodes();&lt;br /&gt;
                for (int l = 0; l &amp;lt; innerResultList.getLength(); l++) {&lt;br /&gt;
                    if (innerResultList.item(l).getNodeName().equalsIgnoreCase(&amp;quot;return&amp;quot;)) {&lt;br /&gt;
                        session = String.valueOf(innerResultList.item(l).getTextContent().trim());&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            soapResponse = soapConnection.call(createSOAPRequest_UserInitialize(soapAction, session), soapEndpointUrl);&lt;br /&gt;
&lt;br /&gt;
            // Print the SOAP Response&lt;br /&gt;
            System.out.println(&amp;quot;Response SOAP Message:&amp;quot;);&lt;br /&gt;
            soapResponse.writeTo(System.out);&lt;br /&gt;
            System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
            &lt;br /&gt;
            body = soapResponse.getSOAPBody();&lt;br /&gt;
            returnList = body.getElementsByTagName(&amp;quot;UserInitializeResponse&amp;quot;);&lt;br /&gt;
            &lt;br /&gt;
            System.out.println(&amp;quot;Response Parsed:&amp;quot;);&lt;br /&gt;
            nodeListPrint(returnList,&amp;quot;&amp;quot;);&lt;br /&gt;
            System.out.println(&amp;quot;&amp;quot;);&lt;br /&gt;
            &lt;br /&gt;
            for (int k = 0; k &amp;lt; returnList.getLength(); k++) {&lt;br /&gt;
                NodeList innerResultList = returnList.item(k).getChildNodes();&lt;br /&gt;
                for (int l = 0; l &amp;lt; innerResultList.getLength(); l++) {&lt;br /&gt;
                    if (innerResultList.item(l).getNodeName().equalsIgnoreCase(&amp;quot;return&amp;quot;)) {&lt;br /&gt;
                        user = String.valueOf(innerResultList.item(l).getTextContent().trim());&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            boolean returnValue = true;&lt;br /&gt;
            while(returnValue){&lt;br /&gt;
                soapResponse = soapConnection.call(createSOAPRequest_Poll(soapAction, session), soapEndpointUrl);&lt;br /&gt;
                //The call for Poll remains opened until PBX sends a response. In case of timeout PBX sends an empty response.&lt;br /&gt;
                //The loop will guarantee another Poll call is send to keep &amp;quot;channel&amp;quot; running.&lt;br /&gt;
                &lt;br /&gt;
                // Print the SOAP Response&lt;br /&gt;
                System.out.println(&amp;quot;Response SOAP Message:&amp;quot;);&lt;br /&gt;
                soapResponse.writeTo(System.out);&lt;br /&gt;
                System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
                body = soapResponse.getSOAPBody();&lt;br /&gt;
                returnList = body.getElementsByTagName(&amp;quot;PollResponse&amp;quot;);&lt;br /&gt;
                System.out.println(&amp;quot;Response Parsed:&amp;quot;);&lt;br /&gt;
                nodeListPrint(returnList,&amp;quot;&amp;quot;);&lt;br /&gt;
                System.out.println(&amp;quot;&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            soapConnection.close();&lt;br /&gt;
        } catch (Exception e) {&lt;br /&gt;
            System.err.println(&amp;quot;\nError occurred while sending SOAP Request to Server!\nMake sure you have the correct endpoint URL and SOAPAction!\n&amp;quot;);&lt;br /&gt;
            e.printStackTrace();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //Creates a SOAPmessage with the &amp;quot;Initialize&amp;quot; instruction&lt;br /&gt;
    private static SOAPMessage createSOAPRequest_Initialize(String soapAction) throws Exception {&lt;br /&gt;
        MessageFactory messageFactory = MessageFactory.newInstance();&lt;br /&gt;
        SOAPMessage soapMessage = messageFactory.createMessage();&lt;br /&gt;
        SOAPPart soapPart = soapMessage.getSOAPPart();&lt;br /&gt;
        &lt;br /&gt;
        // SOAP Envelope&lt;br /&gt;
        SOAPEnvelope envelope = soapPart.getEnvelope();&lt;br /&gt;
        envelope.addNamespaceDeclaration(MYNAMESPACE, MYNAMESPACEURI);&lt;br /&gt;
&lt;br /&gt;
        // SOAP Body&lt;br /&gt;
        SOAPBody soapBody = envelope.getBody();&lt;br /&gt;
        SOAPElement soapBodyElem = soapBody.addChildElement(&amp;quot;Initialize&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem1 = soapBodyElem.addChildElement(&amp;quot;user&amp;quot;);&lt;br /&gt;
        soapBodyElem1.addTextNode(SOAPUSER);&lt;br /&gt;
        SOAPElement soapBodyElem2 = soapBodyElem.addChildElement(&amp;quot;appl&amp;quot;);&lt;br /&gt;
        soapBodyElem2.addTextNode(&amp;quot;JAVA SOAP CALL&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem3 = soapBodyElem.addChildElement(&amp;quot;bool&amp;quot;);&lt;br /&gt;
        soapBodyElem3.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem4 = soapBodyElem.addChildElement(&amp;quot;v501&amp;quot;);&lt;br /&gt;
        soapBodyElem4.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem5 = soapBodyElem.addChildElement(&amp;quot;v700&amp;quot;);&lt;br /&gt;
        soapBodyElem5.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem6 = soapBodyElem.addChildElement(&amp;quot;v800&amp;quot;);&lt;br /&gt;
        soapBodyElem6.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem7 = soapBodyElem.addChildElement(&amp;quot;vx1000&amp;quot;);&lt;br /&gt;
        soapBodyElem7.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        MimeHeaders headers = soapMessage.getMimeHeaders();&lt;br /&gt;
        headers.addHeader(&amp;quot;SOAPAction&amp;quot;, soapAction);&lt;br /&gt;
&lt;br /&gt;
        String authorization = new sun.misc.BASE64Encoder().encode((ADMSOAPUSER+&amp;quot;:&amp;quot;+ADMSOAPUSERPWD).getBytes());&lt;br /&gt;
        headers.addHeader(&amp;quot;Authorization&amp;quot;, &amp;quot;Basic &amp;quot; + authorization);&lt;br /&gt;
&lt;br /&gt;
        soapMessage.saveChanges();&lt;br /&gt;
&lt;br /&gt;
        /* Print the request message, just for debugging purposes */&lt;br /&gt;
        System.out.println(&amp;quot;Request SOAP Message:&amp;quot;);&lt;br /&gt;
        soapMessage.writeTo(System.out);&lt;br /&gt;
        System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        return soapMessage;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //Creates a SOAPmessage with the &amp;quot;UserInitialize&amp;quot; instruction&lt;br /&gt;
    private static SOAPMessage createSOAPRequest_UserInitialize(String soapAction, String session) throws Exception {&lt;br /&gt;
        MessageFactory messageFactory = MessageFactory.newInstance();&lt;br /&gt;
        SOAPMessage soapMessage = messageFactory.createMessage();&lt;br /&gt;
        SOAPPart soapPart = soapMessage.getSOAPPart();&lt;br /&gt;
        &lt;br /&gt;
        // SOAP Envelope&lt;br /&gt;
        SOAPEnvelope envelope = soapPart.getEnvelope();&lt;br /&gt;
        envelope.addNamespaceDeclaration(MYNAMESPACE, MYNAMESPACEURI);&lt;br /&gt;
&lt;br /&gt;
        // SOAP Body&lt;br /&gt;
        SOAPBody soapBody = envelope.getBody();&lt;br /&gt;
        SOAPElement soapBodyElem = soapBody.addChildElement(&amp;quot;UserInitialize&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem1 = soapBodyElem.addChildElement(&amp;quot;session&amp;quot;);&lt;br /&gt;
        soapBodyElem1.addTextNode(session);&lt;br /&gt;
        SOAPElement soapBodyElem2 = soapBodyElem.addChildElement(&amp;quot;user&amp;quot;);&lt;br /&gt;
        soapBodyElem2.addTextNode(CNUSER);&lt;br /&gt;
        SOAPElement soapBodyElem3 = soapBodyElem.addChildElement(&amp;quot;follow&amp;quot;);&lt;br /&gt;
        soapBodyElem3.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        MimeHeaders headers = soapMessage.getMimeHeaders();&lt;br /&gt;
        headers.addHeader(&amp;quot;SOAPAction&amp;quot;, soapAction);&lt;br /&gt;
&lt;br /&gt;
        String authorization = new sun.misc.BASE64Encoder().encode((ADMSOAPUSER+&amp;quot;:&amp;quot;+ADMSOAPUSERPWD).getBytes());&lt;br /&gt;
        headers.addHeader(&amp;quot;Authorization&amp;quot;, &amp;quot;Basic &amp;quot; + authorization);&lt;br /&gt;
&lt;br /&gt;
        soapMessage.saveChanges();&lt;br /&gt;
&lt;br /&gt;
        /* Print the request message, just for debugging purposes */&lt;br /&gt;
        System.out.println(&amp;quot;Request SOAP Message:&amp;quot;);&lt;br /&gt;
        soapMessage.writeTo(System.out);&lt;br /&gt;
        System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        return soapMessage;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //Creates a SOAPmessage with the &amp;quot;Poll&amp;quot; instruction&lt;br /&gt;
    private static SOAPMessage createSOAPRequest_Poll(String soapAction, String session) throws Exception {&lt;br /&gt;
        MessageFactory messageFactory = MessageFactory.newInstance();&lt;br /&gt;
        SOAPMessage soapMessage = messageFactory.createMessage();&lt;br /&gt;
        SOAPPart soapPart = soapMessage.getSOAPPart();&lt;br /&gt;
        &lt;br /&gt;
        // SOAP Envelope&lt;br /&gt;
        SOAPEnvelope envelope = soapPart.getEnvelope();&lt;br /&gt;
        envelope.addNamespaceDeclaration(MYNAMESPACE, MYNAMESPACEURI);&lt;br /&gt;
&lt;br /&gt;
        // SOAP Body&lt;br /&gt;
        SOAPBody soapBody = envelope.getBody();&lt;br /&gt;
        SOAPElement soapBodyElem = soapBody.addChildElement(&amp;quot;Poll&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem1 = soapBodyElem.addChildElement(&amp;quot;session&amp;quot;);&lt;br /&gt;
        soapBodyElem1.addTextNode(session);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        MimeHeaders headers = soapMessage.getMimeHeaders();&lt;br /&gt;
        headers.addHeader(&amp;quot;SOAPAction&amp;quot;, soapAction);&lt;br /&gt;
&lt;br /&gt;
        String authorization = new sun.misc.BASE64Encoder().encode((ADMSOAPUSER+&amp;quot;:&amp;quot;+ADMSOAPUSERPWD).getBytes());&lt;br /&gt;
        headers.addHeader(&amp;quot;Authorization&amp;quot;, &amp;quot;Basic &amp;quot; + authorization);&lt;br /&gt;
&lt;br /&gt;
        soapMessage.saveChanges();&lt;br /&gt;
&lt;br /&gt;
        /* Print the request message, just for debugging purposes */&lt;br /&gt;
        System.out.println(&amp;quot;Request SOAP Message:&amp;quot;);&lt;br /&gt;
        soapMessage.writeTo(System.out);&lt;br /&gt;
        System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        return soapMessage;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Known Problems ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related Articles==&lt;br /&gt;
[[Reference:SOAP API]]&lt;br /&gt;
&lt;br /&gt;
[[Howto:PBX SOAP Api C-sharp sample code ]]&lt;br /&gt;
&lt;br /&gt;
[[Howto:SOAP with PHP5]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--*[[Main_Page|wiki-innovaphone]]--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Sample|{{PAGENAME}}]]&lt;/div&gt;</summary>
		<author><name>Franciscopaletta</name></author>
	</entry>
	<entry>
		<id>https://wiki.innovaphone.com/index.php?title=Howto:SOAP_API_Java_Sample_Code&amp;diff=49682</id>
		<title>Howto:SOAP API Java Sample Code</title>
		<link rel="alternate" type="text/html" href="https://wiki.innovaphone.com/index.php?title=Howto:SOAP_API_Java_Sample_Code&amp;diff=49682"/>
		<updated>2018-05-03T12:04:04Z</updated>

		<summary type="html">&lt;p&gt;Franciscopaletta: /* Running Sample Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FIXME|reason=TODO: work in progress }}&lt;br /&gt;
&lt;br /&gt;
==Applies To==&lt;br /&gt;
This information applies to&lt;br /&gt;
&lt;br /&gt;
* any innovaphone PBX platform&lt;br /&gt;
* Java Runtime Environment&lt;br /&gt;
&lt;br /&gt;
innovaphone PBX web services can be used from Java Runtime Environment.  Here is how&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- web service, soap service, soapservice, webservice, basic, soap api, soapapi --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==More Information==&lt;br /&gt;
===Configuration===&lt;br /&gt;
Modify the global variables &#039;&#039;SOAPENDPOINTURL&#039;&#039;, &#039;&#039;ADMSOAPUSER&#039;&#039;, &#039;&#039;ADMSOAPUSERPWD&#039;&#039;, &#039;&#039;SOAPUSER&#039;&#039; and &#039;&#039;CNUSER&#039;&#039; according to your specific system.&lt;br /&gt;
&lt;br /&gt;
===Running Sample Code===&lt;br /&gt;
This code is a simple Java console application. It will run on your OS console terminal. As dependencies, you will need JDK to compile the code and JRE to execute it.&lt;br /&gt;
&lt;br /&gt;
To &#039;&#039;&#039;compile&#039;&#039;&#039;, save the code on file &#039;&#039;&#039;innoSOAP.java&#039;&#039;&#039; and provide that file as parameter to &#039;&#039;&#039;javac&#039;&#039;&#039; command.&lt;br /&gt;
*The below code was compiled on javac version 1.8.0 and run on java version 1.8.0 (It was not tested on other versions)&lt;br /&gt;
*You may get a warning regarding the function sun.misc.BASE64Encoder().encode() because it is deprecated. Nevertheless the code will run. You may remove that section of the code (used just for authentication on the PBX) but you will have to allow &amp;quot;public&amp;quot; access to /PBX0/user.soap on HTTP(security risk!!!).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====The sample application ====&lt;br /&gt;
This section will discuss the sample code.  It is not a decent description of the PBX SOAP API.  For this, see the related articles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code java&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import javax.xml.soap.*;&lt;br /&gt;
import org.w3c.dom.NodeList;&lt;br /&gt;
&lt;br /&gt;
public class innoSOAP {&lt;br /&gt;
	/*&lt;br /&gt;
		The example below demonstrates the use of SOAP integration to innovaphone PBX.&lt;br /&gt;
		&lt;br /&gt;
		Reference to innovaphone SOAP integration can be found on:&lt;br /&gt;
		http://wiki.innovaphone.com/index.php?title=Reference:SOAP_API&lt;br /&gt;
&lt;br /&gt;
		INSTRUCTIONS:&lt;br /&gt;
		Modify the global variables below according to your specific system.&lt;br /&gt;
		&lt;br /&gt;
		The program will perform the following tasks:&lt;br /&gt;
		1 - Send a SOAP message with the instruction &amp;quot;Initialize&amp;quot; and grab the session ID.&lt;br /&gt;
		2 - Referencing the session ID it will send a SOAP message with the instruction &amp;quot;UserInitialize&amp;quot; and grab the user ID.&lt;br /&gt;
		3 - Loop on an SOAP instruction &amp;quot;Poll&amp;quot; to keep looking for information on the user CNUSER (refer to global variables below)&lt;br /&gt;
			User information and Call information.&lt;br /&gt;
		(The Poll call remains opened until information is provided or time out. In case of timeout PBX sends an emtpy response&lt;br /&gt;
		 and then another Poll call takes place)&lt;br /&gt;
		&lt;br /&gt;
		Created by:&lt;br /&gt;
		Francisco Paletta&lt;br /&gt;
		&lt;br /&gt;
		Version: 0.1&lt;br /&gt;
	*/&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	//innovaphone general information&lt;br /&gt;
	private static final String MYNAMESPACE = &amp;quot;pbx&amp;quot;;&lt;br /&gt;
    private static final String MYNAMESPACEURI = &amp;quot;http://www.innovaphone.com/pbx&amp;quot;;&lt;br /&gt;
	&lt;br /&gt;
	//specific system information&lt;br /&gt;
	private static final String SOAPACTION = &amp;quot;&amp;quot;;&lt;br /&gt;
    private static final String SOAPENDPOINTURL = &amp;quot;http://192.168.0.1/PBX0/user.soap&amp;quot;;&lt;br /&gt;
	private static final String ADMSOAPUSER = &amp;quot;admin&amp;quot;; //PBX admin user&lt;br /&gt;
    private static final String ADMSOAPUSERPWD = &amp;quot;ip311&amp;quot;; //PBX admin password&lt;br /&gt;
	private static final String SOAPUSER = &amp;quot;SOAP&amp;quot;; //SOAP user object in PBX with group access to other objects&lt;br /&gt;
	private static final String CNUSER = &amp;quot;User 1&amp;quot;; //CN of user to perform Poll on&lt;br /&gt;
&lt;br /&gt;
    // Main function&lt;br /&gt;
    public static void main(String args[]) {&lt;br /&gt;
        callSoapWebService(SOAPENDPOINTURL, SOAPACTION);&lt;br /&gt;
    }&lt;br /&gt;
	&lt;br /&gt;
	//Prints all nodes on the nodelist&lt;br /&gt;
	private static void nodeListPrint(NodeList list, String tab){&lt;br /&gt;
		NodeList childList;		&lt;br /&gt;
		for (int i = 0; i &amp;lt; list.getLength(); i++) {&lt;br /&gt;
			if(!list.item(i).getNodeName().equals(&amp;quot;#text&amp;quot;)) {&lt;br /&gt;
				System.out.println(&amp;quot;&amp;quot;);&lt;br /&gt;
				System.out.print(tab+String.valueOf(list.item(i).getNodeName()));&lt;br /&gt;
			}&lt;br /&gt;
			childList = list.item(i).getChildNodes();&lt;br /&gt;
			if(childList.getLength() == 0) {&lt;br /&gt;
				System.out.print(&amp;quot; -&amp;gt; &amp;quot;);&lt;br /&gt;
				System.out.print(String.valueOf(list.item(i).getTextContent()));&lt;br /&gt;
			} else {&lt;br /&gt;
				nodeListPrint(childList, tab+&amp;quot;  &amp;quot;);&lt;br /&gt;
			} &lt;br /&gt;
		} &lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	//Starts web connection and execute the SOAP calls&lt;br /&gt;
    private static void callSoapWebService(String soapEndpointUrl, String soapAction) {&lt;br /&gt;
        try {&lt;br /&gt;
			&lt;br /&gt;
			String session=&amp;quot;&amp;quot;;&lt;br /&gt;
			String user=&amp;quot;&amp;quot;;&lt;br /&gt;
			&lt;br /&gt;
            // Create SOAP Connection&lt;br /&gt;
            SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();&lt;br /&gt;
            SOAPConnection soapConnection = soapConnectionFactory.createConnection();&lt;br /&gt;
			&lt;br /&gt;
&lt;br /&gt;
            // Send SOAP Message to SOAP Server&lt;br /&gt;
            SOAPMessage soapResponse = soapConnection.call(createSOAPRequest_Initialize(soapAction), soapEndpointUrl);&lt;br /&gt;
            // Print the SOAP Response&lt;br /&gt;
            System.out.println(&amp;quot;Response SOAP Message:&amp;quot;);&lt;br /&gt;
            soapResponse.writeTo(System.out);&lt;br /&gt;
            System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
			SOAPBody body = soapResponse.getSOAPBody();&lt;br /&gt;
			NodeList returnList = body.getElementsByTagName(&amp;quot;InitializeResponse&amp;quot;);&lt;br /&gt;
			&lt;br /&gt;
			System.out.print(&amp;quot;Response Parsed:&amp;quot;);&lt;br /&gt;
			nodeListPrint(returnList,&amp;quot;&amp;quot;);&lt;br /&gt;
			System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
			&lt;br /&gt;
			for (int k = 0; k &amp;lt; returnList.getLength(); k++) {&lt;br /&gt;
				NodeList innerResultList = returnList.item(k).getChildNodes();&lt;br /&gt;
				for (int l = 0; l &amp;lt; innerResultList.getLength(); l++) {&lt;br /&gt;
					if (innerResultList.item(l).getNodeName().equalsIgnoreCase(&amp;quot;return&amp;quot;)) {&lt;br /&gt;
						session = String.valueOf(innerResultList.item(l).getTextContent().trim());&lt;br /&gt;
						}&lt;br /&gt;
				}&lt;br /&gt;
    	    }&lt;br /&gt;
&lt;br /&gt;
	    	soapResponse = soapConnection.call(createSOAPRequest_UserInitialize(soapAction, session), soapEndpointUrl);&lt;br /&gt;
&lt;br /&gt;
            // Print the SOAP Response&lt;br /&gt;
            System.out.println(&amp;quot;Response SOAP Message:&amp;quot;);&lt;br /&gt;
            soapResponse.writeTo(System.out);&lt;br /&gt;
			System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
			&lt;br /&gt;
			body = soapResponse.getSOAPBody();&lt;br /&gt;
			returnList = body.getElementsByTagName(&amp;quot;UserInitializeResponse&amp;quot;);&lt;br /&gt;
			&lt;br /&gt;
			System.out.print(&amp;quot;Response Parsed:&amp;quot;);&lt;br /&gt;
			nodeListPrint(returnList,&amp;quot;&amp;quot;);&lt;br /&gt;
			System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
			&lt;br /&gt;
			for (int k = 0; k &amp;lt; returnList.getLength(); k++) {&lt;br /&gt;
				NodeList innerResultList = returnList.item(k).getChildNodes();&lt;br /&gt;
				for (int l = 0; l &amp;lt; innerResultList.getLength(); l++) {&lt;br /&gt;
					if (innerResultList.item(l).getNodeName().equalsIgnoreCase(&amp;quot;return&amp;quot;)) {&lt;br /&gt;
						user = String.valueOf(innerResultList.item(l).getTextContent().trim());&lt;br /&gt;
						}&lt;br /&gt;
				}&lt;br /&gt;
    	    }&lt;br /&gt;
&lt;br /&gt;
			boolean returnValue = true;&lt;br /&gt;
			while(returnValue){&lt;br /&gt;
				soapResponse = soapConnection.call(createSOAPRequest_Poll(soapAction, session), soapEndpointUrl);&lt;br /&gt;
				//The call for Poll remains opened until PBX sends a response. In case of timeout PBX sends an empty response.&lt;br /&gt;
				//The loop will guarantee another Poll call is send to keep &amp;quot;channel&amp;quot; running.&lt;br /&gt;
				&lt;br /&gt;
				// Print the SOAP Response&lt;br /&gt;
				System.out.println(&amp;quot;Response SOAP Message:&amp;quot;);&lt;br /&gt;
            	soapResponse.writeTo(System.out);&lt;br /&gt;
				System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
				body = soapResponse.getSOAPBody();&lt;br /&gt;
				returnList = body.getElementsByTagName(&amp;quot;PollResponse&amp;quot;);&lt;br /&gt;
				System.out.print(&amp;quot;Response Parsed:&amp;quot;);&lt;br /&gt;
				nodeListPrint(returnList,&amp;quot;&amp;quot;);&lt;br /&gt;
				System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
            soapConnection.close();&lt;br /&gt;
        } catch (Exception e) {&lt;br /&gt;
            System.err.println(&amp;quot;\nError occurred while sending SOAP Request to Server!\nMake sure you have the correct endpoint URL and SOAPAction!\n&amp;quot;);&lt;br /&gt;
            e.printStackTrace();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
	//Creates a SOAPmessage with the &amp;quot;Initialize&amp;quot; instruction&lt;br /&gt;
    private static SOAPMessage createSOAPRequest_Initialize(String soapAction) throws Exception {&lt;br /&gt;
        MessageFactory messageFactory = MessageFactory.newInstance();&lt;br /&gt;
        SOAPMessage soapMessage = messageFactory.createMessage();&lt;br /&gt;
		SOAPPart soapPart = soapMessage.getSOAPPart();&lt;br /&gt;
		&lt;br /&gt;
        // SOAP Envelope&lt;br /&gt;
        SOAPEnvelope envelope = soapPart.getEnvelope();&lt;br /&gt;
        envelope.addNamespaceDeclaration(MYNAMESPACE, MYNAMESPACEURI);&lt;br /&gt;
&lt;br /&gt;
        // SOAP Body&lt;br /&gt;
        SOAPBody soapBody = envelope.getBody();&lt;br /&gt;
        SOAPElement soapBodyElem = soapBody.addChildElement(&amp;quot;Initialize&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem1 = soapBodyElem.addChildElement(&amp;quot;user&amp;quot;);&lt;br /&gt;
        soapBodyElem1.addTextNode(SOAPUSER);&lt;br /&gt;
		SOAPElement soapBodyElem2 = soapBodyElem.addChildElement(&amp;quot;appl&amp;quot;);&lt;br /&gt;
        soapBodyElem2.addTextNode(&amp;quot;JAVA SOAP CALL&amp;quot;);&lt;br /&gt;
		SOAPElement soapBodyElem3 = soapBodyElem.addChildElement(&amp;quot;bool&amp;quot;);&lt;br /&gt;
        soapBodyElem3.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
		SOAPElement soapBodyElem4 = soapBodyElem.addChildElement(&amp;quot;v501&amp;quot;);&lt;br /&gt;
        soapBodyElem4.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
		SOAPElement soapBodyElem5 = soapBodyElem.addChildElement(&amp;quot;v700&amp;quot;);&lt;br /&gt;
        soapBodyElem5.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
		SOAPElement soapBodyElem6 = soapBodyElem.addChildElement(&amp;quot;v800&amp;quot;);&lt;br /&gt;
        soapBodyElem6.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
		SOAPElement soapBodyElem7 = soapBodyElem.addChildElement(&amp;quot;vx1000&amp;quot;);&lt;br /&gt;
        soapBodyElem7.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        MimeHeaders headers = soapMessage.getMimeHeaders();&lt;br /&gt;
        headers.addHeader(&amp;quot;SOAPAction&amp;quot;, soapAction);&lt;br /&gt;
&lt;br /&gt;
		String authorization = new sun.misc.BASE64Encoder().encode((ADMSOAPUSER+&amp;quot;:&amp;quot;+ADMSOAPUSERPWD).getBytes());&lt;br /&gt;
		headers.addHeader(&amp;quot;Authorization&amp;quot;, &amp;quot;Basic &amp;quot; + authorization);&lt;br /&gt;
&lt;br /&gt;
        soapMessage.saveChanges();&lt;br /&gt;
&lt;br /&gt;
        /* Print the request message, just for debugging purposes */&lt;br /&gt;
        System.out.println(&amp;quot;Request SOAP Message:&amp;quot;);&lt;br /&gt;
        soapMessage.writeTo(System.out);&lt;br /&gt;
		System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        return soapMessage;&lt;br /&gt;
    }&lt;br /&gt;
	&lt;br /&gt;
	//Creates a SOAPmessage with the &amp;quot;UserInitialize&amp;quot; instruction&lt;br /&gt;
	private static SOAPMessage createSOAPRequest_UserInitialize(String soapAction, String session) throws Exception {&lt;br /&gt;
        MessageFactory messageFactory = MessageFactory.newInstance();&lt;br /&gt;
        SOAPMessage soapMessage = messageFactory.createMessage();&lt;br /&gt;
		SOAPPart soapPart = soapMessage.getSOAPPart();&lt;br /&gt;
		&lt;br /&gt;
        // SOAP Envelope&lt;br /&gt;
        SOAPEnvelope envelope = soapPart.getEnvelope();&lt;br /&gt;
        envelope.addNamespaceDeclaration(MYNAMESPACE, MYNAMESPACEURI);&lt;br /&gt;
&lt;br /&gt;
        // SOAP Body&lt;br /&gt;
        SOAPBody soapBody = envelope.getBody();&lt;br /&gt;
        SOAPElement soapBodyElem = soapBody.addChildElement(&amp;quot;UserInitialize&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem1 = soapBodyElem.addChildElement(&amp;quot;session&amp;quot;);&lt;br /&gt;
        soapBodyElem1.addTextNode(session);&lt;br /&gt;
		SOAPElement soapBodyElem2 = soapBodyElem.addChildElement(&amp;quot;user&amp;quot;);&lt;br /&gt;
        soapBodyElem2.addTextNode(CNUSER);&lt;br /&gt;
		SOAPElement soapBodyElem3 = soapBodyElem.addChildElement(&amp;quot;follow&amp;quot;);&lt;br /&gt;
        soapBodyElem3.addTextNode(&amp;quot;true&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        MimeHeaders headers = soapMessage.getMimeHeaders();&lt;br /&gt;
        headers.addHeader(&amp;quot;SOAPAction&amp;quot;, soapAction);&lt;br /&gt;
&lt;br /&gt;
		String authorization = new sun.misc.BASE64Encoder().encode((ADMSOAPUSER+&amp;quot;:&amp;quot;+ADMSOAPUSERPWD).getBytes());&lt;br /&gt;
		headers.addHeader(&amp;quot;Authorization&amp;quot;, &amp;quot;Basic &amp;quot; + authorization);&lt;br /&gt;
&lt;br /&gt;
        soapMessage.saveChanges();&lt;br /&gt;
&lt;br /&gt;
        /* Print the request message, just for debugging purposes */&lt;br /&gt;
        System.out.println(&amp;quot;Request SOAP Message:&amp;quot;);&lt;br /&gt;
        soapMessage.writeTo(System.out);&lt;br /&gt;
		System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        return soapMessage;&lt;br /&gt;
    }&lt;br /&gt;
	&lt;br /&gt;
	//Creates a SOAPmessage with the &amp;quot;Poll&amp;quot; instruction&lt;br /&gt;
	private static SOAPMessage createSOAPRequest_Poll(String soapAction, String session) throws Exception {&lt;br /&gt;
        MessageFactory messageFactory = MessageFactory.newInstance();&lt;br /&gt;
        SOAPMessage soapMessage = messageFactory.createMessage();&lt;br /&gt;
		SOAPPart soapPart = soapMessage.getSOAPPart();&lt;br /&gt;
		&lt;br /&gt;
        // SOAP Envelope&lt;br /&gt;
        SOAPEnvelope envelope = soapPart.getEnvelope();&lt;br /&gt;
        envelope.addNamespaceDeclaration(MYNAMESPACE, MYNAMESPACEURI);&lt;br /&gt;
&lt;br /&gt;
        // SOAP Body&lt;br /&gt;
        SOAPBody soapBody = envelope.getBody();&lt;br /&gt;
        SOAPElement soapBodyElem = soapBody.addChildElement(&amp;quot;Poll&amp;quot;);&lt;br /&gt;
        SOAPElement soapBodyElem1 = soapBodyElem.addChildElement(&amp;quot;session&amp;quot;);&lt;br /&gt;
        soapBodyElem1.addTextNode(session);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        MimeHeaders headers = soapMessage.getMimeHeaders();&lt;br /&gt;
        headers.addHeader(&amp;quot;SOAPAction&amp;quot;, soapAction);&lt;br /&gt;
&lt;br /&gt;
		String authorization = new sun.misc.BASE64Encoder().encode((ADMSOAPUSER+&amp;quot;:&amp;quot;+ADMSOAPUSERPWD).getBytes());&lt;br /&gt;
		headers.addHeader(&amp;quot;Authorization&amp;quot;, &amp;quot;Basic &amp;quot; + authorization);&lt;br /&gt;
&lt;br /&gt;
        soapMessage.saveChanges();&lt;br /&gt;
&lt;br /&gt;
        /* Print the request message, just for debugging purposes */&lt;br /&gt;
        System.out.println(&amp;quot;Request SOAP Message:&amp;quot;);&lt;br /&gt;
        soapMessage.writeTo(System.out);&lt;br /&gt;
		System.out.println(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        return soapMessage;&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;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Known Problems ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related Articles==&lt;br /&gt;
[[Reference:SOAP API]]&lt;br /&gt;
&lt;br /&gt;
[[Howto:PBX SOAP Api C-sharp sample code ]]&lt;br /&gt;
&lt;br /&gt;
[[Howto:SOAP with PHP5]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--*[[Main_Page|wiki-innovaphone]]--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Sample|{{PAGENAME}}]]&lt;/div&gt;</summary>
		<author><name>Franciscopaletta</name></author>
	</entry>
</feed>