<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Error updating pin with SOAP request</title>
  <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_thread?p_l_id=&amp;threadId=12227163" />
  <subtitle>Error updating pin with SOAP request</subtitle>
  <id>http://developer.cisco.com/c/message_boards/find_thread?p_l_id=&amp;threadId=12227163</id>
  <updated>2013-06-19T12:00:41Z</updated>
  <dc:date>2013-06-19T12:00:41Z</dc:date>
  <entry>
    <title>RE: Error updating pin with SOAP request</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=12230328" />
    <author>
      <name>darrell breyer</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=12230328</id>
    <updated>2013-02-21T19:48:15Z</updated>
    <published>2013-02-21T19:48:15Z</published>
    <summary type="html">using System;
using System.Net;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using System.Net.Mail;
using System.Net.Mime;
using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.Data.SqlClient;
using System.Text;
using System.Runtime.InteropServices;
using System.Xml.Serialization;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            String axlSoapRequest = null;
            String axlRequestEnvelope = null;
            axlRequestEnvelope = "&lt;soapenv:Envelope xmlns:soapenv=\"[url=http://schemas.xmlsoap.org/soap/envelope//]http://schemas.xmlsoap.org/soap/envelope/\[/url]" xmlns:ns=\"[url=http://www.cisco.com/AXL/API/8.5/]http://www.cisco.com/AXL/API/8.5\[/url]"&gt; ";
            axlRequestEnvelope += "&lt;soapenv:Header/&gt;";
            axlRequestEnvelope += "&lt;soapenv:Body&gt;";
            axlRequestEnvelope += "&lt;ns:updateUser sequence=\"?\"&gt;";
            axlRequestEnvelope += "&lt;userid&gt;user&lt;/userid&gt;";
            axlRequestEnvelope += "&lt;password&gt;pass&lt;/password&gt;";
            axlRequestEnvelope += "&lt;pin&gt;pin&lt;/pin&gt;";
            axlRequestEnvelope += "&lt;/ns:updateUser&gt;";
            axlRequestEnvelope += "&lt;/soapenv:Body&gt; ";
            axlRequestEnvelope += "&lt;/soapenv:Envelope&gt;";

            ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri("[url=https://:8443/axl/]https://:8443/axl/[/url]"));
            request.ProtocolVersion = System.Net.HttpVersion.Version10;
            request.Credentials = new NetworkCredential("user", "pass");
            request.Timeout = 100000;
            request.Method = "POST";
            request.ContentType = "text/xml; charset=utf-8";
            request.Accept = "text/xml";
            request.ContentLength = axlRequestEnvelope.Length;
           // request.ContentLength =
            Stream requestStream = request.GetRequestStream();
            requestStream.Write(System.Text.Encoding.ASCII.GetBytes(axlRequestEnvelope), 0, axlRequestEnvelope.Length);
            requestStream.Close();
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            Stream responseStream = response.GetResponseStream();
            StreamReader readStream = new StreamReader(responseStream, Encoding.UTF8);
            Label1.Text = readStream.ReadToEnd();
            Response.ContentType = "text/xml";
            Response.Charset = "utf-8";
            Response.Write(readStream.ReadToEnd());
          

          
 

           
           
        }
        catch (Exception ex)
        { 
        
        }
        
    
    }
}</summary>
    <dc:creator>darrell breyer</dc:creator>
    <dc:date>2013-02-21T19:48:15Z</dc:date>
  </entry>
  <entry>
    <title>RE: Error updating pin with SOAP request</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=12230302" />
    <author>
      <name>darrell breyer</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=12230302</id>
    <updated>2013-02-21T19:47:12Z</updated>
    <published>2013-02-21T19:47:12Z</published>
    <summary type="html">Thanks for you help on this David, very much appreciated!
Here is the final code in case anyone else comes across this issue:
[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Net;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Collections.Generic;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Linq;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Web;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Web.UI;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Web.UI.WebControls;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Xml;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Net.Mail;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Net.Mime;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Data;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Configuration;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Web.Security;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Web.UI.WebControls.WebParts;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Web.UI.HtmlControls;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Collections;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Data.SqlClient;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Text;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Runtime.InteropServices;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Xml.Serialization;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.ComponentModel;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Diagnostics;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.Globalization;

[color=#0000ff][/color]
using
[color=#0000ff][/color]
 

 System.IO;

[color=#0000ff][/color]
public
[color=#0000ff][/color]
 
 partial class _Default : System.Web.UI.

Page



{

 

protected void Page_Load(object sender, EventArgs
e)
{

　

　

}

　

 


protected void Button1_Click(object sender, EventArgs
e)
{

 




try



{

 

String axlSoapRequest = null
;
 


String axlRequestEnvelope = null
;
axlRequestEnvelope =


"&lt;soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://www.cisco.com/AXL/API/8.5\"&gt; "
;
axlRequestEnvelope +=


"&lt;soapenv:Header/&gt;"
;
axlRequestEnvelope +=


"&lt;soapenv:Body&gt;"
;
axlRequestEnvelope +=


"&lt;ns:updateUser sequence=\"?\"&gt;"
;
axlRequestEnvelope +=


"&lt;userid&gt;user&lt;/userid&gt;"
;
axlRequestEnvelope +=


"&lt;password&gt;pass&lt;/password&gt;"
;
axlRequestEnvelope +=


"&lt;pin&gt;pin&lt;/pin&gt;"
;
axlRequestEnvelope +=


"&lt;/ns:updateUser&gt;"
;
axlRequestEnvelope +=


"&lt;/soapenv:Body&gt; "
;
axlRequestEnvelope +=


"&lt;/soapenv:Envelope&gt;"
;
　

 


ServicePointManager.ServerCertificateValidationCallback += delegate { return true
; };
 


HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri("https://:8443/axl/"
));
request.ProtocolVersion = System.Net.


HttpVersion
.Version10;
request.Credentials =


new NetworkCredential("user", "pass"
);
request.Timeout = 100000;

request.Method =


"POST"
;
request.ContentType =


"text/xml; charset=utf-8"
;
request.Accept =


"text/xml"
;
request.ContentLength = axlRequestEnvelope.Length;








 

Stream
 requestStream = request.GetRequestStream();
requestStream.Write(System.Text.


Encoding
.ASCII.GetBytes(axlRequestEnvelope), 0, axlRequestEnvelope.Length);
requestStream.Close();

 


HttpWebResponse response = (HttpWebResponse
)request.GetResponse();
 


Stream
 responseStream = response.GetResponseStream();
 


StreamReader readStream = new StreamReader(responseStream, Encoding
.UTF8);
Label1.Text = readStream.ReadToEnd();

Response.ContentType =


"text/xml"
;
Response.Charset =


"utf-8"
;
Response.Write(readStream.ReadToEnd());

 

　

 

　

　

　

 

 

}

 


catch (Exception
ex)
{

 

}

 

 

}

}</summary>
    <dc:creator>darrell breyer</dc:creator>
    <dc:date>2013-02-21T19:47:12Z</dc:date>
  </entry>
  <entry>
    <title>RE: Error updating pin with SOAP request</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=12228492" />
    <author>
      <name>David Staudt</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=12228492</id>
    <updated>2013-02-21T19:34:26Z</updated>
    <published>2013-02-21T19:34:26Z</published>
    <summary type="html">Response looks right...the return value should be the primary key (uuid) of the effected device.</summary>
    <dc:creator>David Staudt</dc:creator>
    <dc:date>2013-02-21T19:34:26Z</dc:date>
  </entry>
  <entry>
    <title>RE: Error updating pin with SOAP request</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=12227986" />
    <author>
      <name>darrell breyer</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=12227986</id>
    <updated>2013-02-21T19:32:38Z</updated>
    <published>2013-02-21T19:32:38Z</published>
    <summary type="html">Thanks David, I took your suggestions and got the following response:
This looks like a successful response yes?  I am working with the our engireers to see if the pin was in fact updated...

[url=http://localhost:50677/CiscoResetPassword/Default.aspx#][b]-[/b][/url] [color=#0000ff]&lt;[/color][color=#990000]SOAP-ENV:Envelope[/color] SOAP-ENV:encodingStyle[color=#0000ff]="[/color][b]http://schemas.xmlsoap.org/soap/encoding/[/b][color=#0000ff]"[/color][color=#ff0000] xmlns:SOAP-ENV[/color][color=#0000ff]="[/color][color=#ff0000]http://schemas.xmlsoap.org/soap/envelope/[/color][/b][color=#0000ff]"[/color]&gt;


[b] [/b] [color=#0000ff]&lt;[/color][color=#990000]SOAP-ENV:Header[/color] [color=#0000ff]/&gt;[/color]


[url=http://localhost:50677/CiscoResetPassword/Default.aspx#][b]-[/b][/url] [color=#0000ff]&lt;[/color][color=#990000]SOAP-ENV:Body[/color][color=#0000ff]&gt;[/color]


[url=http://localhost:50677/CiscoResetPassword/Default.aspx#][b]-[/b][/url] [color=#0000ff]&lt;[/color][color=#990000]axl:updateUserResponse[/color] sequence[color=#0000ff]="[/color][b]?[/b][color=#0000ff]"[/color][color=#ff0000] xmlns:axl[/color][color=#0000ff]="[/color][color=#ff0000]http://www.cisco.com/AXL/API/6.1[/color][/b][color=#0000ff]"[/color][color=#ff0000] xmlns:xsi[/color][color=#0000ff]="[/color][color=#ff0000]http://www.w3.org/2001/XMLSchema-instance[/color][/b][color=#0000ff]"[/color]&gt;


[b] [/b] [color=#0000ff]&lt;[/color][color=#990000]return[/color][color=#0000ff]&gt;[/color][b]{29B11E42-4B4E-4EA3-B1DF-482CB0CEAAC4}[/b][color=#0000ff]&lt;/[/color][color=#990000]return[/color][color=#0000ff]&gt;[/color]

[b] [/b] [color=#0000ff]&lt;/[/color][color=#990000]axl:updateUserResponse[/color][color=#0000ff]&gt;[/color]


[b] [/b] [color=#0000ff]&lt;/[/color][color=#990000]SOAP-ENV:Body[/color][color=#0000ff]&gt;[/color]


[b] [/b] [color=#0000ff]&lt;/[/color][color=#990000]SOAP-ENV:Envelope[/color][color=#0000ff]&gt;[/color]
[color=#0000ff][/color] 
[color=#0000ff][/color] </summary>
    <dc:creator>darrell breyer</dc:creator>
    <dc:date>2013-02-21T19:32:38Z</dc:date>
  </entry>
  <entry>
    <title>RE: Error updating pin with SOAP request</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=12225691" />
    <author>
      <name>David Staudt</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=12225691</id>
    <updated>2013-02-21T19:07:17Z</updated>
    <published>2013-02-21T19:07:17Z</published>
    <summary type="html">The error usually means that the beginning of the XML is somehow corrupt/malformed.

From your code, it looks like you are appending the Content-Length header - with no actual content length value or terminating carriage-return/life-feed - and then immediately starting in  with the XML.  This probably looks like a badly malformed Content-Length header followed by a body containing nothing.

I think you need to do something like:
- Create/concatenate the XML payload in a string variable
- Calculate the XML variable's length
- In a new variable start building/concatenating the headers, including Content-Length header, with the value calculated above, and terminating CR/LF
- Append an intervening CR/LF (to terminate the header part of the packet)
- Append the XML
 </summary>
    <dc:creator>David Staudt</dc:creator>
    <dc:date>2013-02-21T19:07:17Z</dc:date>
  </entry>
  <entry>
    <title>Error updating pin with SOAP request</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=12227162" />
    <author>
      <name>darrell breyer</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=12227162</id>
    <updated>2013-02-21T18:49:01Z</updated>
    <published>2013-02-21T18:49:01Z</published>
    <summary type="html">HI All, I'm trying to update users Pin number with a .Net C# webpage.
I have pasted the code and error below.  I ended up using soap although I noticed there is a risservice.wsdl that should have methods to update pins.  Any help would be greatly appreciated.
code
----------------------
using System;
using System.Net;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using System.Net.Mail;
using System.Net.Mime;
using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.Data.SqlClient;
using System.Text;
using System.Runtime.InteropServices;
using System.Xml.Serialization;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
 
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
 
 
    }
 
 
    protected void Button1_Click(object sender, EventArgs e)
    {
 
        try
        {
 
            ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri("https://ip:8443/axl/"));
            request.ProtocolVersion = System.Net.HttpVersion.Version10;
            request.Credentials = new NetworkCredential("user", "pass");
            request.Timeout = 100000;
            request.Method = "POST";
            request.ContentType = "text/xml";
 
            String axlSoapRequest = null;
            String axlRequestEnvelope = null;
 
            axlSoapRequest = "POST /axl/ HTTP/1.0\r\n";
            axlSoapRequest += "Host: host:8443 \r\n"; axlSoapRequest += "Authorization: Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(("user" + ":" + "pass"))) + "==\r\n";
            axlSoapRequest += "Accept: text/*\r\n";
            axlSoapRequest += "Content-type: text/xml\r\n";
            axlSoapRequest += "SOAPAction: \"CUCM:DB ver=8.0\"\r\n";
            axlSoapRequest += "Content-length: ";
            axlRequestEnvelope = "&lt;soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://www.cisco.com/AXL/API/8.5\"&gt; ";
            axlRequestEnvelope += "&lt;soapenv:Header/&gt;";
            axlRequestEnvelope += "&lt;soapenv:Body&gt;";
            axlRequestEnvelope += "&lt;ns:updateUser sequence=\"?\"&gt;";
            axlRequestEnvelope += "&lt;userid&gt;user&lt;/userid&gt;";
            axlRequestEnvelope += "&lt;password&gt;user pass&lt;/password&gt;";
            axlRequestEnvelope += "&lt;pin&gt;new pin&lt;/pin&gt;";
            axlRequestEnvelope += "&lt;/ns:updateUser&gt;";
            
            
            axlRequestEnvelope += "&lt;/soapenv:Body&gt; ";
            axlRequestEnvelope += "&lt;/soapenv:Envelope&gt;";
            axlSoapRequest += axlRequestEnvelope.ToString();
            axlSoapRequest += "\r\n\r\n";
 
 
           
 
 
 
 
            Stream requestStream = request.GetRequestStream();
 
            requestStream.Write(System.Text.Encoding.ASCII.GetBytes(axlSoapRequest), 0, axlSoapRequest.Length);
            requestStream.Close();
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            Stream responseStream = response.GetResponseStream();
            StreamReader readStream = new StreamReader(responseStream, Encoding.UTF8);
 
            Label1.Text = readStream.ReadToEnd();
 
            Response.ContentType = "text/xml";
            Response.Charset = "utf-8";
            Response.Write(readStream.ReadToEnd());
            
 
        }
        catch (Exception ex)
        { 
        
        }  
    
    }
}
 
this is the error that is printed to the page
&lt;SOAP-ENV:Envelope SOAP-ENV:encodingStyle="[b]http://schemas.xmlsoap.org/soap/encoding/[/b]" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/[/b]"&gt;


  &lt;SOAP-ENV:Header /&gt;


[url=http://localhost:50677/CiscoResetPassword/Default.aspx#]-[/url] &lt;SOAP-ENV:Body&gt;


[url=http://localhost:50677/CiscoResetPassword/Default.aspx#]-[/url] &lt;SOAP-ENV:Fault&gt;


  &lt;faultcode&gt;SOAP-ENV:Client&lt;/faultcode&gt;


  &lt;faultstring&gt;Content is not allowed in prolog.&lt;/faultstring&gt;


[url=http://localhost:50677/CiscoResetPassword/Default.aspx#]-[/url] &lt;detail&gt;


[url=http://localhost:50677/CiscoResetPassword/Default.aspx#]-[/url] &lt;axl:Error xmlns:axl="http://www.cisco.com/AXL/API/1.0[/b]"&gt;


  &lt;axl:code&gt;5001&lt;/axl:code&gt;


  &lt;axl:message&gt;Content is not allowed in prolog.&lt;/axl:message&gt;


  &lt;request /&gt;

  &lt;/axl:Error&gt;


  &lt;/detail&gt;


  &lt;/SOAP-ENV:Fault&gt;


  &lt;/SOAP-ENV:Body&gt;


  &lt;/SOAP-ENV:Envelope&gt;

 </summary>
    <dc:creator>darrell breyer</dc:creator>
    <dc:date>2013-02-21T18:49:01Z</dc:date>
  </entry>
</feed>

