Log In
Developer Network
Technologies
Join the Network
Member Services
Events & Community
Extension Mobility API (EMAPI) Developer Center
Overview
Documentation
Community
Wiki
Testing
Everything
This Site
Blogs
9.1 Mobility API Documentation Now Available
Ting-Hao Chen
10 Jan 2013
Unified Communications 9.0 Partner Bundle Offer Now Available to Order
Amanda Whaley
21 Sep 2012
Unified CM 9.0(1) Developer Guides
George Gary
26 Aug 2012
Developer Partner 2012 US Update Presentations Available
George Gary
29 Jun 2012
Developer Partner 2012 London Update Presentations Available
George Gary
10 Feb 2012
Showing 1 - 5 of 21 results.
Items per Page 5
Page
(Changing the value of this field will reload the page.)
1
2
3
4
5
of 5
First
Previous
Next
Last
Forums
Message Boards Home
Recent Posts
Statistics
Answer
(
Unmark
)
Mark as an Answer
« Back to Extension Mobility API Questions
Extension Mobility Query...
Threads [
Previous
|
Next
]
dan turner
Posts:
3
Join Date:
3/11/09
Recent Posts
Extension Mobility Query...
Answer
2/2/10 9:35 PM
Mark as an Answer
Submit
Reply with Quote
Quick Reply
Hey guys,
I'm just trying to execute a query using EMAPI...
heres the Code...
ExtQuery = "<query>/n";
ExtQuery += "<appInfo> /n";
ExtQuery += "<appID>admin</appID> /n";
ExtQuery += "<appCertificate>p1tBas!c</appCertificate> /n";
ExtQuery += "</appInfo> /n";
ExtQuery += "<userDevicesQuery> /n";
ExtQuery += "<userID>" + UserID + "</userID> /n";
ExtQuery += "</userDevicesQuery> </query>/n";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://192.168.200.15/emservice/EMServiceServlet");
req.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*";
req.ContentType = "application/x-www-form-urlencoded";
req.Method = "POST";
req.KeepAlive = true;
Stream s = req.GetRequestStream();
s.Write(System.Text.Encoding.ASCII.GetBytes(ExtQuery), 0, ExtQuery.Length);
s.Close();
WebResponse resp = req.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream());
string XMLResult = sr.ReadToEnd();
Im getting an Error 500 Internal server error...
does anyone have any suggestions? if i browse to the URL i also get an error 500 page.
Dan
Sign in to vote.
Flag
Please sign in to flag this as inappropriate.
Top
Michel Shuqair
Posts:
3
Join Date:
1/22/10
Recent Posts
RE: Extension Mobility Query...
Answer
2/3/10 5:59 PM as a reply to dan turner.
Mark as an Answer
Submit
Reply with Quote
Quick Reply
Hi,
I've seen this error before. For us the solution was to enable Extension Mobility on BOTH publisher and subscriber. If it was enabled for only one of them it gave http 500 error.
Hope this helps.
Sign in to vote.
Flag
Please sign in to flag this as inappropriate.
Top
dan turner
Posts:
3
Join Date:
3/11/09
Recent Posts
RE: Extension Mobility Query...
Answer
2/4/10 4:52 PM as a reply to Michel Shuqair.
Mark as an Answer
Submit
Reply with Quote
Quick Reply
very odd...
there must be multiple causes for this then!!!
i only have a publisher.. its a vmware test machine...
anyhoo i think it was my headers...
In case anyone is curious I got it working with this:
ExtQuery = "xml=<query>";
ExtQuery += "<appInfo> <appID>admin</appID> <appCertificate>p1tBas!c</appCertificate> </appInfo>";
ExtQuery += "<userDevicesQuery> <userID>"+UserID+"</userID> </userDevicesQuery>";
ExtQuery += "</query>";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://x.x.x.x:8080/emservice/EMServiceServlet");
req.Accept = "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2";
req.ContentType = "application/x-www-form-urlencoded";
req.Method = "POST";
req.KeepAlive = true;
Stream s = req.GetRequestStream();
s.Write(System.Text.Encoding.ASCII.GetBytes(ExtQuery), 0, ExtQuery.Length);
s.Close();
WebResponse resp = req.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream());
string XMLResult = sr.ReadToEnd();
Sign in to vote.
Flag
Please sign in to flag this as inappropriate.
Top
dan turner
Posts:
3
Join Date:
3/11/09
Recent Posts
RE: Extension Mobility Query...
Answer
2/4/10 4:55 PM as a reply to Michel Shuqair.
Mark as an Answer
Submit
Reply with Quote
Quick Reply
Sorry Michael, I meant to say thanks for the suggestion too!!!
this forum seems awfully quiet so I wasn't really expecting a response.
Dan
Sign in to vote.
Flag
Please sign in to flag this as inappropriate.
Top
dan dan
Posts:
3
Join Date:
3/12/10
Recent Posts
RE: Extension Mobility Query...
Answer
3/12/10 9:35 PM as a reply to dan turner.
Mark as an Answer
Submit
Reply with Quote
Quick Reply
may you say how to work this services on IP phones??
userid ,machine id e.g values how to take??
Sign in to vote.
Flag
Please sign in to flag this as inappropriate.
Top
Axel Schemberg
Posts:
5
Join Date:
8/21/08
Recent Posts
RE: Extension Mobility Query...
Answer
9/16/10 3:35 PM as a reply to dan turner.
Mark as an Answer
Submit
Reply with Quote
Quick Reply
Hi Dan,
I ran into the same problem with CUCM 6.1.2 (on VMWare too).
While my C# doesn't work a simple HTML works.
Did you find any solution?
Kind regards
Axel
Sign in to vote.
Flag
Please sign in to flag this as inappropriate.
Top
Axel Schemberg
Posts:
5
Join Date:
8/21/08
Recent Posts
RE: Extension Mobility Query...
Answer
9/24/10 3:47 PM as a reply to dan turner.
Mark as an Answer
Submit
Reply with Quote
Quick Reply
Hi Dan,
I think I found "your" fault ... it isn't really yours, it is more to the developer or those who write the documentation.
1. Although you might think we are talking XML, no, we don't. That means no xml header like <?xml version=1.0> etc. Just use simple string.
2. urlencode the xml based em api call "urlencode("<query>...some content ...</query>");"
3. prepend an xml= (not urlencode!) to encoded xml (see step 2).
4. use HTTP header "Content-Type: application/x-www-form-urlencoded"
that should work. In your example you miss step 3 I think.
Kind reagards
Axel
Sign in to vote.
Flag
Please sign in to flag this as inappropriate.
Top
Sascha Monteiro
Posts:
5
Join Date:
10/6/08
Recent Posts
RE: Extension Mobility Query...
Answer
11/23/10 2:49 AM as a reply to Axel Schemberg.
Mark as an Answer
Submit
Reply with Quote
Quick Reply
cool, I couldn't find the "Content-Type: application/x-www-form-urlencoded" in the API doco, very odd that this is used...
I had to run wireshark to trace the message from the EMApi example to see the header..
a REST service would have been nice, like CUPI, Cisco introduced too many different webservices ;-)
Sign in to vote.
Flag
Please sign in to flag this as inappropriate.
Top
Collateral
No files available