Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SharePoint > SharePoint Development
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SharePoint Development Programming and development for SharePoint Portal Server and Windows SharePoint Services
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SharePoint Development section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 10th, 2013, 01:15 PM
Registered User
Points: 13, Level: 1
Points: 13, Level: 1 Points: 13, Level: 1 Points: 13, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Why doesn't this web service call post to the list?

Hi,

First time poster, here.

I am trying to create a SharePoint 2007 .aspx feedback form on a page on the same site where the list (Issues) I want to submit to exists. I'm trying to use Lists.asmx web service, UpdateListItems, to post to the Issues list. The page looks great...the problem is, it doesn't work. Can anyone tell me what I'm missing?

Thanks, ~R

Below is the code for the entire page:

Code:
<%@ Page Language="C#" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Feedback Submission Sample - Using SharePoint</title>
 

<style>
    BODY {background:navy}
    A.Action {text-decoration:none;color:white;filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=5, OffY=5, Color='black', Positive='true',enabled=true)}
       A.Action:HOVER {background:white;color:blue}
       .FeedbackSection {color:white}
       Table.FeedbackSection {background:highlight;border-color:indigo}
</style>
 

<script language="jscript" id="FeedbackScript">
 

var FeedbackHTTP;
var WSSSiteURL="http://server/site"; //do not terminate with a slash
var ListName="Sample Issue List"
var FeedbackTitle="Feedback Sample App";
 

function showFeedback()
{
    //This is a fancy dropshadow effect
       sectionFeedback.style.filter="progid:DXImageTransform.Microsoft.DropShadow(OffX=3, OffY=4, Positive='true', enabled=true, Color='Gray')";
       
       linkShowFeedback.style.display="none"; //This hides the "Provide Feedback" link while the user is providing feedback
       sectionFeedback.style.display=""; //This shows the feedback form;
       sectionFeedback.style.position="absolute";
       
       //Now we need to position the form in the middle of the screen so that it appears to float over the page.
       sectionFeedback.style.posLeft=(document.body.offsetWidth/2)-(sectionFeedback.offsetWidth/2);
       if (document.body.offsetHeight>sectionFeedback.offsetHeight)
       {
          sectionFeedback.style.posTop=(document.body.offsetHeight/2)-(sectionFeedback.offsetHeight/2);
       }
       else
       {
           sectionFeedback.style.posTop=5;
       }
       frmFeedback.txtFeedback.select();  //Just to speed things up, we select the feedback textbox so the user can start typing their thought right away.
}
 

function provideFeedback()
{
       var xmldoc;
       var batch;
       
       //The batch variable builds up the XML that we are going to submit to the SharePoint list via the SharePoint web service
       batch = "<Batch><Method ID='1' Cmd='New'><Field Name='Description'>"+ frmFeedback.txtFeedback.value +"</Field><Field Name='Title'>" + FeedbackTitle + ", Sample 1: " + SampleForm.txtSample1.value + ", Sample 2: " + SampleForm.txtSample2.value + "</Field></Method></Batch>      ";
       //Make sure you add a "Description" column to the issue list. It isn't there by default.
       xmldoc='<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">'
       xmldoc=xmldoc+'<listName>'+ListName+'</listName>';
       xmldoc=xmldoc+'<updates>' + batch +'</updates></UpdateListItems></soap:Body></soap:Envelope>';
       FeedbackHTTP=new ActiveXObject("MSXML2.XMLHTTP.3.0");
       FeedbackHTTP.Open("POST", WSSSiteURL + "/_vti_bin/Lists.asmx?op=UpdateListItems", true); 
       FeedbackHTTP.setRequestHeader("Content-Type","text/xml; charset=utf-8");
       FeedbackHTTP.setRequestHeader("SOAPAction","http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");
 

    FeedbackHTTP.onreadystatechange=provideFeedbackResponse;
    FeedbackHTTP.Send(xmldoc);
    
    sectionFeedback.style.display="none" //This hides the feedback form now that the user is done submitting feedback
    linkShowFeedback.style.display="";  //This displays the "Provide feedback" link now that the user is done submitting feedback
    frmFeedback.txtFeedback.value=""; //This clears the feedback text
    
       return false;  //We return false so that the form doesn't attempt to POST or GET
}
 

function provideFeedbackResponse()
{
       if (FeedbackHTTP.readyState==4){
              linkShowFeedback.style.display="";
              var xmlResponse=new ActiveXObject("MSXML2.DOMDocument.3.0");
              xmlResponse.async=false;
              var issueID;
              xmlResponse.loadXML(FeedbackHTTP.responseXML.xml);
              
              //This next bit you don't really need, but it is nice to provide the user with some subtle indication that their response was submitted.
              issueID=xmlResponse.selectSingleNode("/soap:Envelope/soap:Body/UpdateListItemsResponse/UpdateListItemsResult/Results/Result/z:row/@ows_SelectTitle").text;
              showstatus("<a target='_blank' href='"+ WSSSiteURL +"/Lists/" + ListName + "/DispForm.aspx?ID=" + issueID + "'>Feedback submitted</a>");
       }
}
 

function showstatus(message)
{
       sectionStatus.style.position="absolute";
       sectionStatus.style.posLeft=document.body.clientWidth-sectionStatus.width-10;
       if (document.body.clientHeight>sectionStatus.height)
           sectionStatus.style.posTop=document.body.clientHeight - sectionStatus.height - 5;
       else
           sectionStatus.style.posTop=document.body.offsetHeight-5;
       sectionStatus.filters[0].Apply();
       sectionStatusBody.innerHTML=message;
       sectionStatus.style.display="";
       sectionStatus.filters[0].Play();
       window.setTimeout("hidestatus()",4500);
}
function hidestatus()
{
       sectionStatus.filters[1].Apply();
       sectionStatus.style.display="none";
       sectionStatus.filters[1].Play();
}
function CancelFeedback()
{
       sectionFeedback.style.display="none"
       linkShowFeedback.style.display="";
       frmFeedback.txtFeedback.value="";
       return false;
}
</script>
</head>
 

<body>
<table bgcolor=ActiveCaption><tr><td>
This page demonstrates how to integrate a unobtrusive user feedback mechanism into your web application that leverages simple Windows SharePoint Services issue lists.  This example uses a basic SharePoint issue list and AJAX programming to allow the user to provide feedback about the application without disrupting their work.
</td></tr></table>
 

<table width="100%">
<tr height="100%">
<td>
    <font color=Menu>Actions</font><br />
    <nobr><a id="linkShowFeedback" href="javascript:showFeedback();" class="Action">+ Provide Feedback</a></nobr>
</td>
<td bgcolor="Window" height="100%">
 

    <div id="sectionFeedback" class="FeedbackSection" style="display:none">
           <table border="2" class="FeedbackSection">
                  <tr>
                         <td align="center" valign="middle" class="FeedbackSection">
                         <form id="frmFeedback" onsubmit="return(provideFeedback());" onreset="return(CancelFeedback())">
                               Provide a comment, suggestion, issue, or praise:<br>
                               <input type="text" style="width:100%" id="txtFeedback"><br>
                               <input type="submit" value="Submit Feedback" style="FONT-SIZE: 8pt">
                               <input type="reset" value="Cancel" style="font-size:8pt" onclick="CancelFeedback()">
                         </form>
                         </td>
                  </tr>
           </table>
    </div>
 

       <table id="sectionStatus" class="StatusSection" width="100" height="100" border="1" bordercolor="ActiveBorder" bgcolor="InactiveCaption" style="display:none;border-style:ridge; filter: progid:DXImageTransform.Microsoft.Blinds(direction='up', bands=1,duration=1) progid:DXImageTransform.Microsoft.Blinds(direction='down', bands=1);">
              <tr>
                     <td align="center">
                     <span id="sectionStatusBody" style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana">
                     </span></td>
              </tr>
       </table>
       
       <form id="SampleForm" name="SampleForm">
       Sample Field 1: <input type=text id="txtSample1" name="txtSample1"/>
       <br />Sample Field 2: <input type=text id="txtSample2" name="txtSample2"/>
       </form>
</td>
</tr>
</table>
 

</body>
 

</html>
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Call a Web Service deer_reema ASP.NET 1.0 and 1.1 Basics 1 April 28th, 2006 10:12 AM
Call the Java Web Service using HTTP-POST/GET anand_indya J2EE 0 January 17th, 2005 07:23 AM
Simple HTTP POST .Net web service? DaveCollinsPenchant .NET Web Services 1 September 10th, 2004 04:46 PM
How to call WMI from web service? yezh99 .NET Web Services 1 July 22nd, 2003 11:58 PM
How to call WMI from web service? yezh99 VS.NET 2002/2003 1 July 14th, 2003 10:45 AM



All times are GMT -4. The time now is 10:01 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.