cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5780
Views
13
Helpful
5
Replies

Powershell API - XML and/or API

tony.langlet
Level 1
Level 1

Hello,

I've been working with trying to automate the creation of user accounts in WebEx and activate/deactivate accounts but I've encountered a problem.

 

With XML API you assign the securitycontext first and does not require any session creation like you do in URL API. I've managed to create a URL API to create a user but when I'm using some sort of signin mechanism it crashes, or I get a pop-up window of Internet Explorer where it tells me to allow cookies to run (I've followed the instructions on this site to turn allow cookies and also added webex to trusted sites).

 

I've tried with partnerId and siteId aswell, it seems like the request get accepted but there is some type of cookie issue.

 

I would really appreciate some help with the question.

 

This Code is used in Powershell

$body ='

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

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

<header>

    <securityContext>

        <siteName>sitename</siteName>

        <webExID>username</webExID>

        <password>password!</password>

    </securityContext>

</header>

<body>

    <bodyContent xsi:type="java:com.webex.service.binding.user.GetUser">

            <webExId>UserToRemove</webExId>

    </bodyContent>

</body>

</serv:message>

'

$uri = "https://company.webex.com/company/"

 

Invoke-WebRequest -Uri $uri -Method Post -ContentType 'text/xml' -Body $body

1 Accepted Solution

Hi Tony,

I see that you're posting to sitename.webex.com/sitename, but our XMLService URL is https://sitename.webex.com/WBXService/XMLService

Could you try posting to that address (sub in your sitename where it says "sitename") and see if that changes the behavior?

Kasey

View solution in original post

5 Replies 5

tony.langlet
Level 1
Level 1

In powershell I've tried Invoke-webrequest, Invoke-restMethod and also creating the request from .NET library directly by [System.Net.HttpWebRequest]::CreateHttp('URL'). None of the methods work and all give the same response (see below). Because several posts about URI and XML APIs where the administrators recommend using XML instead of URI I've done the requests with XML instead of URI.

When I use Invoke-WebRequest I do get a pop-up window within Internet Explorer (11) where it say that cookies needs to be enabled. According to WebEx webmeetings prerequists you need Internet Explorer 4.0+ with Cookies and Java enabled and all those prereqs have been fullfilled. I've also tried using the properties in Powershell Invoke-Webrequest named UserAgent and chosen between all different types without any success.

I don't think I'm the only one trying to solve this process with Powershell and would really like to get some examples where it works.

The error message i get in response from Webex is the following.

<noframes>

<h2>Sorry.</h2>

<p><b>WebEx requires the use of Netscape Navigator 4.0, Internet Explorer 4.0 or better.</b></p>

</noframes>

</html>

Hi Tony,

I see that you're posting to sitename.webex.com/sitename, but our XMLService URL is https://sitename.webex.com/WBXService/XMLService

Could you try posting to that address (sub in your sitename where it says "sitename") and see if that changes the behavior?

Kasey

I've changed the URL and it seem to work now.

I did some changes to the script as well which might have made some kind of change to the result. I added the XML namespace for SERV which can't be found anywhere except in the example codes in the end of the documentation of XML API.

In case someone needs the working script I'll post it here.

$XML =[xml]'<?xml version="1.0" encoding="UTF-8" ?>

<serv:message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:serv="http://www.webex.com/schemas/2002/06/service">

<header>

    <securityContext>

        <webExID>AdminID</webExID>

        <password>AdminPassword</password>

        <siteID>SiteID</siteID>

        <partnerID>PartnerID</partnerID>

    </securityContext>

</header>

<body>

    <bodyContent xsi:type="java:com.webex.service.binding.user.GetUser">

        <webExId>UserID</webExId>

    </bodyContent>

</body>

</serv:message>'

$webex_URI = "https://Sitename.webex.com/WBXService/XMLService"

$response = Invoke-WebRequest -Uri $webex_URI -Method Post -ContentType 'text/xml' -TimeoutSec 120 -Body $XML

$response

$response.Content

For those that still struggling to get shared script work please add following line at the beginning to use TLS1.2 to create session.

 

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Artem,

I am still at the point where do find the any code that would work. 

Getting Started

Welcome to the Webex Community. This is your home to ask questions, share knowledge, and attend live webinars.