I wanted to share today how to access EsxAgentManager . I tried to search the internet but unfortunately i could not find much about how to access it. From few bits of documentation i just understood that EAM is working as soap api. I have divided this into two pieces, one is connecting to it via SoapUI, and the other using of course powershell 😉
For the SoapUI part, you would have to create new SOAP project and point to the WSDL. I still don’t know where is the WSDL located via the url, of if it even is accessible for us. I did download a SDK package where you can find the needed WSDL for EAM. It resides in the SDK folder insidea eam\wsdl, eam.wsdl
Ok, so once this is imported, you will have methods built. At this stage , go to the project interface viewer and add a new endpoint where the eam api is ‘hosted’
I have added my two test vcenters, you can add how many you want of course. Then you have to take some method to work on, i took the QueryAgency, initially we will see this
For this to work, you would have to change the type and value for the QueryAgency, to EsxAgentManager. If this is done, we would have
At this stage you probably might have not selected the endpoint, so please do so via the top bar
After this is done, we can add the last bit, notice that we have not authenticated yet , did not do any logins etc. inside the SDK java i found information that the authentication is done via cookie
This part actually got me confused as i was doing it in wrong way… long story short, i received help from Dimitar Milov (thank you again for the effort and time !!!) and could make the correct cookie. The correct cookie name is : vmware_soap_session and the value should equal to SessionSecret if you would connect using PowerCLI. So in order to get that, we would need to establish session quickly.
We have to use connect-viserver to our vcenter. Once connected ,we can then check the sessionsecret
So with this secret we can then construct the cookie, in our case this will be Cookie = vmware_soap_session=”32a463002dc0173897d64a26472c61de942579cf” .
With that fixed, we can apply it in SoapUI so, the program cat it cookies
And now we should get reply 200 from the EAM soap api with the returned message.
Ok so one more example, lets say that you want to query for the agents in this agency, then you have to pass properly the arguments for the QueryAgent. QueryAgent expects the right Agency in which we do the query. We obtained it few seconds ago from the QueryAgency. In that case we just provide the right information to next method.
Ok , and now let’s move to powershell
We will do exactly the same what was done in SoapUI
At this moment i wanted to put a nice code block, but something is not working here on wordpress… and i dont have time now as it is really late to fix this, hence i am just pasting text..
$ws = New-WebServiceProxy -Uri ‘D:\vsphereWebServicesSDK67\eam\wsdl\eam.wsdl’ -Namespace eam
$ws.Url = ‘https://vc002.greg.labs/eam/sdk/’ single quote here…
$ws.CookieContainer = New-Object system.net.CookieContainer
$cookie = New-Object System.Net.Cookie
$cookie.Name = “vmware_soap_session”
$cookie.Value = “32a463002dc0173897d64a26472c61de942579cf”
$cookie.Domain = “vc002.greg.labs”
$ws.CookieContainer.Add($cookie)
Basically we used new-webserviceproxy with pointing to the right wsdl that we took from the SDK archive from vmware, then we changed the url endpoint where our EAM is lcoated. Then we created cookie container and added 1 cookie with the right value of sessionsecret. After this we can start using it.
We have to create the same thing which we did in SoapUI – this is that ESXAgentManager part, but using Moref way. After this is done, we can start using methods like QueryAgency
We can later then query for agent
I left this error on purpose 😉 so that you get not surprised if you would also try to run it like me hehe. And just last call to check the agent configs:
And this is how we talk to EAM EsxAgentManager Soap api. Really sorry for bad formatting of the post, I really have not much spare time lately. I hope that will help out others who are searching for how to talk with this webservice.