<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Sending SOAP to CUPS server</title>
  <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_thread?p_l_id=&amp;threadId=3823137" />
  <subtitle>Sending SOAP to CUPS server</subtitle>
  <id>http://developer.cisco.com/c/message_boards/find_thread?p_l_id=&amp;threadId=3823137</id>
  <updated>2013-05-18T22:28:13Z</updated>
  <dc:date>2013-05-18T22:28:13Z</dc:date>
  <entry>
    <title>RE: Sending SOAP to CUPS server</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=3901870" />
    <author>
      <name>Doug Kartio</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=3901870</id>
    <updated>2011-05-18T16:26:44Z</updated>
    <published>2011-05-18T16:26:44Z</published>
    <summary type="html">[b]Update:[/b]
 
Within CUPS plugin menu, you can find a download for the axltoolkit.zip  this is not the same axltoolkit you find on Cisco's website or in the CUCM plugins menu.  This one is specific to CUPS.  Within that you can find the CUPS wsdl.  As with most wsdls, it is pretty unreadable.  By using a program called SoupUI, you can get a pretty good idea of what is needed with each call.
 
Using this and the sample code that is in the axltoolkit (CUPS version), you can work your way through the calls.  Remember that CUPS works with Soap 1.2 (whereas CUCM is Soap 1.1), so the main differences between this sample code and the sample code that comes with CUCM is in the sendMessage method where the soap message is made.</summary>
    <dc:creator>Doug Kartio</dc:creator>
    <dc:date>2011-05-18T16:26:44Z</dc:date>
  </entry>
  <entry>
    <title>RE: Sending SOAP to CUPS server</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=3825085" />
    <author>
      <name>Doug Kartio</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=3825085</id>
    <updated>2011-05-03T17:47:36Z</updated>
    <published>2011-05-03T17:47:36Z</published>
    <summary type="html">Ok, found my answer.  Still can't get the above code to work, but was able to modify the code that came with the CUCM and tweak it to work.

The problem that was causing my stuff to fail was the fact that CUCM works with SOAP 1.1 so the envelope call:

xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

is bad.  CUPS on the otherhand, expects SOAP 1.2 which means the soap ns needs to be:

xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"

My guess with the code above, the problem is somewhere in the POST header information.  Maybe someone else can get it</summary>
    <dc:creator>Doug Kartio</dc:creator>
    <dc:date>2011-05-03T17:47:36Z</dc:date>
  </entry>
  <entry>
    <title>Sending SOAP to CUPS server</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=3823136" />
    <author>
      <name>Doug Kartio</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=3823136</id>
    <updated>2011-05-02T20:58:41Z</updated>
    <published>2011-05-02T20:58:41Z</published>
    <summary type="html">Has anyone actual been able to make a SOAP call to a cups server??
 
Here is what I have been trying to do:
 

 
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
 
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
 
public class PostXML_CUPS {
 
  public static void main(String[] args) {
 
    PostXML_CUPS axl = new PostXML_CUPS();
 
    try {
 
 
      // build SOAP request
      String xmldata = "&lt;SOAP-ENV:Envelope " + 
                "xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"&gt; " +
                "&lt;SOAP-ENV:Header/&gt; " +
                "&lt;SOAP-ENV:Body&gt; " +
                "     &lt;login xmlns=\"urn:cisco:cup:presence:soap\" force=\"true\" &gt; " +
                "        &lt;username&gt;TPAUser&lt;/username&gt; " +
                "        &lt;password&gt;password&lt;/password&gt; " +
                "     &lt;/login&gt; " +
                "  &lt;/SOAP-ENV:Body&gt; " +
                "&lt;/SOAP-ENV:Envelope&gt; ";
 
      //Create socket
          String path = "/EPASSoap/service/v70";  
          String host = "AAA.BBB.CCC.DDD";
          String port = "8443";
 
       // Implement the certificate-related stuffs required for sending request via https
          X509TrustManager xtm = axl.new MyTrustManager();
          TrustManager[] mytm = { xtm };
          SSLContext ctx = SSLContext.getInstance("SSL");
          ctx.init(null, mytm, null);
          SSLSocketFactory sslFact = (SSLSocketFactory) ctx.getSocketFactory();
          Socket sock = (SSLSocket) sslFact.createSocket(host, Integer.parseInt(port));
 
      //Send header
 
      BufferedWriter  wr = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream(),"UTF-8"));
      wr.write("POST " + path + " HTTP/1.1\r\n");
      wr.write("Content-Type: application/soap+xml; charset=UTF-8; action=\"urn:cisco:cup:presence:soap/login\"\r\n");
      wr.write("Connection: Keep-Alive\r\n");
      wr.write("Host: " + host + ":" + port + "\r\n");
      wr.write("Content-Length: " + xmldata.length() + "\r\n");
      wr.write("\r\n");
 
      //Send data
      wr.write(xmldata);
      System.out.println(xmldata);
      wr.flush();
 
      // Response
      BufferedReader rd = new BufferedReader(new InputStreamReader(sock.getInputStream()));
      String line;
      while((line = rd.readLine()) != null)
  System.out.println(line);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 
  //  **************************************************************
  //  inner class
 
  /* testing the SSL interface */
  public class MyTrustManager implements X509TrustManager {
      MyTrustManager() {}
      public void checkClientTrusted(X509Certificate chain[], String authType) throws CertificateException {}
      public void checkServerTrusted(X509Certificate chain[], String authType) throws CertificateException {}
      public X509Certificate[] getAcceptedIssuers() {
          return null;
      }
  }
}

 
 
When I run this code, I get this back:
 

   &lt;env:Fault&gt;
     &lt;env:Code&gt;&lt;env:Value&gt;env:Sender&lt;/env:Value&gt;&lt;/env:Code&gt;
     &lt;env:Reason&gt;&lt;env:Text xml:lang="en"&gt;Invalid request.&lt;/env:Text&gt;&lt;/env:Reason&gt;
   &lt;/env:Fault&gt;

 
Anyone got any ideas, or is willing to share their working code?
 
Thanks</summary>
    <dc:creator>Doug Kartio</dc:creator>
    <dc:date>2011-05-02T20:58:41Z</dc:date>
  </entry>
</feed>

