Defining CM DB Version in SoapAction Header

Version 1
    This document was generated from CDN thread

    Created by: Martin Sloan on 22-11-2011 10:09:31 AM
    Hello,
     
    I'm running into an issue when trying to use the 'addUserPhoneAssociation' operation and the error indicates to me that I probably need to specify the DB version of our CUCM (8.5) in the SOAPAction header.  The parameters that I'm setting in the Perl script for SOAP messages are:
     
    my $cucmip = "10.186.78.4";
    my $axl_port = "8443";
    my $user = "axluser";
    my $password = "password";
    my $axltoolkit = "AXLAPI.wsdl";

    BEGIN {
        sub SOAP::Transport::HTTP::Client::get_basic_credentials {
    return ($user => $password)
        };
    }

    my $cm = new SOAP::Lite
        encodingStyle => '',
        uri => "$axltoolkit",
        proxy => "https://$cucmip:$axl_port/axl/" ;
     
    The error I'm receiving is 'Failed to read schema document '/usr/local/thirdparty/jakarta-tomcat/webapps/axl/schema/6.1/SoapEnvelope.xsd'', which I believe I'm getting because CUCM is using the default version 6.1.  When tracing the messages,  I see the CUCM list SOAPAction: CUCMB ver=6.1.  I've tried to update the SOAP action header in my messaging to 'http://www.cisco.com/AXL/API/8.5' (and also tried 8.0) but I receive the same error and the CUCM SOAPAction stays at 6.1.  I'm relatively new to SOAP/Perl scripts so if anyone has a suggestion on how to correctly update the SOAPAction header it would be appreciated.
     
    Thank you,
     
    Marty

    Subject: RE: Defining CM DB Version in SoapAction Header
    Replied by: Dan-Anders Hook on 29-11-2011 04:00:32 PM
    Hi,

    Which AXLAPI.wsdl and AXLSoap.xsd are you using? Try with the latest wsdl, you can download it from your CUCM under applications.

    Kind regards,

    //Dan

    Subject: RE: Defining CM DB Version in SoapAction Header
    Replied by: Martin Sloan on 01-12-2011 10:39:28 AM
    Hi Dan,

    Thanks for replying.  I guess I'm not completely sure which wsdl is being used....  I've downloaded the 8.5(1) Admin XML Interface Specs and use that as my reference when building the scripts and also have the AXLAPI.wsdl and AXLSoap.xsd downloaded but I'm not completely clear on how to reference the specific files from the script.  I've run into another issue with updating the subscribeCallingSearchSpaceName under updateUser, which I've read wasn't available until 8.0 so I'm most likely hitting this wall again.  Here's a little snip of the trace from my script:

    My message to CUCM:

    <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><updateUser xmlns="http://www.cisco.com/AXL/API/8.5"><userid xsi:type="xsd:int">387653</userid><presenceGroupName xsi:type="xsd:string">TestGroup</presenceGroupName><subscribeCallingSearchSpaceName xsi:type="xsd:string">GLB-PRESENCE_SUBSCRIBE-CSS</subscribeCallingSearchSpaceName></updateUser></soap:Body></soap:Envelope>


    CUCM Response:

    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><axl:updateUserResponse xmlns:axl="http://www.cisco.com/AXL/API/6.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><return>{AF7D7A2A-BAF5-41A1-9CF1-E8DDD9121D8D}</return></axl:updateUserResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

    The request *seems* to be trying to use 8.5 but the reply lists 6.1.  I'm not sure if this is a standard reply or the root of my issues.  I don't get an error on this one, just the UUID of the end user I'm trying to update.  There are some fundamentals that I'm obviously missing here :-|  Any help is appreciated!

    Thanks,

    Marty

    Subject: RE: Defining CM DB Version in SoapAction Header
    Replied by: Dan-Anders Hook on 01-12-2011 02:40:18 PM
    Hi,

    Ah, Ok. Sorry, I did not really look at your code at first, I just saw the "AXLAPI.wsdl" in there. I doubt that SOAP::Lite can parse that monstruos wsdl. Even if it could I don't think that is how you do it in SOAP::Lite.

    You did not post your whole code, but I'm guessing you have two problems. First of all I think your action header contains the wrong value. That is probably why CUCM responds with version 6.1. I thought 7.0 was the oldest API that worked with 8.5, at least that's what the XML dev guide says... The older API's did not really care about the namespaces that much so that's why you don't get any complaints about the 8.5 in there.
    Second, which is visible in the XML, is that the userid etc should be unbounded i.e not in a namespace. According to the AXL docs it's only valid to send uuid for presenceGroup and subscribeCSS, but it works with name to.

    The return value is quite often an UUID. When you receive that it indicates that the operation was successful. In this case it clearly was not, so you should have received an error. Since you were talking to an older API version I would'nt think to much about it.

    Here's quick sample that works in my 8.6 lab. Hops this helps!

     1
     2#!/usr/bin/perl
     3use warnings;
     4use strict;
     5use SOAP::Lite;
     6use Data::Dumper;
     7
     8$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
     9
    10my $debug = 1;
    11my $cucmip = "172.28.0.4";
    12my $axl_port = "8443";
    13my $user = "administrator";
    14my $password = "cisco";
    15my $ver = "8.5";
    16my $axltoolkit = "http://www.cisco.com/AXL/API/$ver";
    17
    18use SOAP::Lite +trace => 'debug';
    19
    20BEGIN {
    21  sub SOAP::Transport::HTTP::Client::get_basic_credentials {
    22    return ($user => $password)
    23  };
    24}
    25my $cm = SOAP::Lite
    26    -> encodingStyle('')
    27    -> on_action(sub { return "CUCM:DB ver=$ver" })
    28    -> proxy("https://$cucmip:$axl_port/axl/")
    29    -> uri("http://www.cisco.com/AXL/API/$ver");
    30
    31#axl request
    32my $res =  $cm->updateUser( SOAP::Data->attr({xmlns => ''})->name("userid" => "dahook"),
    33                        =>  SOAP::Data->attr({xmlns => ''})->name("presenceGroupName" => "Test"),
    34                        =>  SOAP::Data->attr({xmlns => ''})->name("firstName" => "Test"),
    35                        =>  SOAP::Data->attr({xmlns => ''})->name("subscribeCallingSearchSpaceName" => "CSS_Test")
    36                          );
    37unless ($res->fault) {
    38  print $res->valueof('//updateUserResponse/return');
    39  print "\n";
    40  $Data::Dumper::Indent = 3;
    41  print Dumper($res->paramsall()) if ( $debug==1);
    42}
    43   
    44 else {
    45        print join ', ',
    46        $res->faultcode,
    47        $res->faultstring;
    48}
    49__END__


    All the best,

    //Dan

    Subject: RE: Defining CM DB Version in SoapAction Header
    Replied by: Dan-Anders Hook on 01-12-2011 02:47:46 PM
    Hi,

    Just for reference, here is the request/response from the script above:


    Hi,

    Just for reference, here is the request/response from the script above:

    Request:
    POST https://172.28.0.4:8443/axl/ HTTP/1.1
    Accept: text/xml
    Accept: multipart/*
    Accept: application/soap
    Content-Length: 604
    Content-Type: text/xml; charset=utf-8
    SOAPAction: CUCMB ver=8.5

    <?xml version="1.0" encoding="UTF-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
      <updateUser xmlns="http://www.cisco.com/AXL/API/8.5">
       <userid xmlns="" xsi:type="xsd:string">dahook</userid>
       <presenceGroupName xmlns="" xsi:type="xsd:string">Test</presenceGroupName>
       <firstName xmlns="" xsi:type="xsd:string">Test</firstName>
       <subscribeCallingSearchSpaceName xmlns="" xsi:type="xsd:string">CSS_Test</subscribeCallingSearchSpaceName>
      </updateUser>
    </soap:Body>
    </soap:Envelope>


    Response:
    HTTP/1.1 200 OK
    Connection: close
    Date: Thu, 01 Dec 2011 19:32:16 GMT
    Server:
    Content-Length: 308
    Content-Type: text/xml;charset=UTF-8
    Client-Date: Thu, 01 Dec 2011 19:32:15 GMT
    Client-Peer: 172.28.0.4:8443
    Client-Response-Num: 1
    Client-SSL-Cert-Issuer: /C=SE/O=lab/OU=lab/CN=cucm1/ST=lab/L=lab
    Client-SSL-Cert-Subject: /C=SE/O=lab/OU=lab/CN=cucm1/ST=lab/L=lab
    Client-SSL-Cipher: AES256-SHA
    Client-SSL-Socket-Class: IO::Socket::SSL
    Client-SSL-Warning: Peer certificate not verified
    Set-Cookie: JSESSIONIDSSO=CD97AF241827DD4B78F90D969460C94C; Path=/; Secure
    Set-Cookie: JSESSIONID=B296F2E8C8C32221E7A3FDAB12AA8285; Path=/axl; Secure

    <?xml version='1.0' encoding='utf-8'?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
      <ns:updateUserResponse xmlns:ns="http://www.cisco.com/AXL/API/8.5">
       <return>{4329DD7F-07FF-FDB2-E8E8-C67BA86550E2}</return>
      </ns:updateUserResponse>
    </soapenv:Body>
    </soapenv:Envelope>



    Subject: RE: Defining CM DB Version in SoapAction Header
    Replied by: Martin Sloan on 13-12-2011 10:32:28 AM
    Hi Dan,

    Thanks again for some great advice.  I'm able to update the fields using the info you provided.  I'm running into issues with namespaces for sure.  I know you replied to another post that I had and I'm sure it's all related to this.  If I use the messaging above I can update the presence info but some fields that I was able to update before, like "enableCTI", don't update.  I've just split out the messages as a workaround while I read through more docs on SOAP/XML and namespaces.....

    Cheers,

    Marty