cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
843
Views
1
Helpful
6
Replies

NBR response is empty

dcburleigh
Level 1
Level 1

I'm succssfully posting my SOAP request the WebEx NBR endpoint.

I get a response code of 200, but the response content is empty; Content-Length = 0.

What does that mean?

1 Accepted Solution

Accepted Solutions

Ok, then that means you are probably not using an incorrect service URL, so it may be code related. You should also be sure to use HTTPS instead of HTTP, as WebEx generally requires a secure connection. I am also providing a more generic PHP example that can be modified for NBR API by changing the file_get_contents URL, adding a SOAPAction to the stream_context_create array, modifying the XML data, and deleting the sitename variable. This sample is useful for XML API if you are developing against that as well. I also recommend setting an actual value for the SOAPAction, like www.webex.com or another value of your choice so it isn't null.

<?php

        header("Content-Type: text/xml");

        $sitename = "apidemoeu";        //Sitename is the subdomain of a WebEx URL. ex: sitename for https://apidemoeu.webex.com is apidemoeu

        $username = "username";

        $password = "password";

        $XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

        $XML .="<serv:message xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">";

        $XML .="        <header>";

        $XML .="                <securityContext>";

        $XML .="                        <webExID>$username</webExID>";

        $XML .="                        <password>$password</password>";

        $XML .="                        <siteName>$sitename</siteName>";

        $XML .="                        <returnAdditionalInfo>TRUE</returnAdditionalInfo>";

        $XML .="                </securityContext>";

        $XML .="        </header>";

        $XML .="        <body>";

        $XML .="                <bodyContent xsi:type=\"java:com.webex.service.binding.site.GetSite\">";

        $XML .="                </bodyContent>";

        $XML .="        </body>";

        $XML .="</serv:message>";

        $request = stream_context_create(array("http"=>array("method"=>"POST","header"=>"Content-Type:text/xml","content"=>$XML)));

        $response = file_get_contents("https://$sitename.webex.com/nbr/services", false, $request);

        echo $response;

?>

View solution in original post

6 Replies 6

nmorrow
Cisco Employee
Cisco Employee

Hello,

     There was a recent apache update that affected XML API services and may also affect NBR API. The update strictly enforces HTTP standard and requires that header lines be terminated by full CRLF (\r\n). Failure to adhere to the standard did result in a null response such as that. This was not observed with NBR API, so this is just a guess, so any reply with your actual code (without passwords) would help to identify the cause.

Here is the header of the SOAP client:

POST http://xxx.webex.com/nbr/services/NBRStorageService

Content-Type: text/xml; charset=utf-8

SOAPAction:

and here is the body

<?xml version="1.0" encoding="UTF-8"?>

<soapenv:Envelope

  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

  xmlns:xsd="http://www.w3.org/2001/XMLSchema"

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body>

  <ns1:getStorageAccessTicket

soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"

xmlns:ns1="NBRStorageService"><siteId xsi:type="xsd:long">123XXX</siteId><username xsi:type="xsd:string">xxx</username><password xsi:type="xsd:string">xxx</password></ns1:getStorageAccessTicket></soapenv:Body>

</soapenv:Envelope>

where I've replace  some parts with XXX

I'm using the LWP::UserAgent module in Perl.

Here is the full content of the response:

HTTP/1.1 200 OK

Date: Mon, 11 Dec 2017 19:50:06 GMT

Content-Length: 0

Client-Date: Mon, 11 Dec 2017 19:50:06 GMT

Client-Peer: 66.114.168.244:80

Client-Response-Num: 1

Set-Cookie: NSC_wocut1-ocs-xtt=ffffffff09f4ff1d45525d5f4f58455e445a4a4231e1;path=/

I've also tried the PHP method I found here:

https://github.com/rsathishtechit/webex

with similar results

It looks like you might be using the wrong service URL, NBR API uses a generic datacenter subdomain instead of your WebEx sitename. You can respond here with your WebEx site URL or if you prefer to keep it private, send an email to webex-meetings-api-dev@cisco.com with your WebEx site URL and request the NBR service URL.

Apparently the API works with GET method:

GET http://xxx.webex.com/nbr/services/NBRStorageService?method=getStorageAccessTicket&site_id=123xxx9&username=xxx&password=xxx

I get:

<?xml version="1.0" encoding="UTF-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Body>

  <getStorageAccessTicketResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

   <getStorageAccessTicketReturn xsi:type="xsd:string">xxxxxx</getStorageAccessTicketReturn>

  </getStorageAccessTicketResponse>

</soapenv:Body>

</soapenv:Envelope>

Ok, then that means you are probably not using an incorrect service URL, so it may be code related. You should also be sure to use HTTPS instead of HTTP, as WebEx generally requires a secure connection. I am also providing a more generic PHP example that can be modified for NBR API by changing the file_get_contents URL, adding a SOAPAction to the stream_context_create array, modifying the XML data, and deleting the sitename variable. This sample is useful for XML API if you are developing against that as well. I also recommend setting an actual value for the SOAPAction, like www.webex.com or another value of your choice so it isn't null.

<?php

        header("Content-Type: text/xml");

        $sitename = "apidemoeu";        //Sitename is the subdomain of a WebEx URL. ex: sitename for https://apidemoeu.webex.com is apidemoeu

        $username = "username";

        $password = "password";

        $XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

        $XML .="<serv:message xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">";

        $XML .="        <header>";

        $XML .="                <securityContext>";

        $XML .="                        <webExID>$username</webExID>";

        $XML .="                        <password>$password</password>";

        $XML .="                        <siteName>$sitename</siteName>";

        $XML .="                        <returnAdditionalInfo>TRUE</returnAdditionalInfo>";

        $XML .="                </securityContext>";

        $XML .="        </header>";

        $XML .="        <body>";

        $XML .="                <bodyContent xsi:type=\"java:com.webex.service.binding.site.GetSite\">";

        $XML .="                </bodyContent>";

        $XML .="        </body>";

        $XML .="</serv:message>";

        $request = stream_context_create(array("http"=>array("method"=>"POST","header"=>"Content-Type:text/xml","content"=>$XML)));

        $response = file_get_contents("https://$sitename.webex.com/nbr/services", false, $request);

        echo $response;

?>

https

That did it.

FYI I used a blank string for the SOAPAction, because that was in the docs.

Also, I'll be filing away the PHP code for future refererence.

Thanks for the help.