Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SharePoint > SharePoint Development
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 10th, 2013, 01:15 PM
Registered User
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?


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:

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

    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}

<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;
       //Now we need to position the form in the middle of the screen so that it appears to float over the page.
       if (document.body.offsetHeight>sectionFeedback.offsetHeight)
       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+'<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");

    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){
              var xmlResponse=new ActiveXObject("MSXML2.DOMDocument.3.0");
              var issueID;
              //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.
              showstatus("<a target='_blank' href='"+ WSSSiteURL +"/Lists/" + ListName + "/DispForm.aspx?ID=" + issueID + "'>Feedback submitted</a>");

function showstatus(message)
       if (document.body.clientHeight>sectionStatus.height)
           sectionStatus.style.posTop=document.body.clientHeight - sectionStatus.height - 5;
function hidestatus()
function CancelFeedback()
       return false;

<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.

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

    <div id="sectionFeedback" class="FeedbackSection" style="display:none">
           <table border="2" class="FeedbackSection">
                         <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()">

       <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);">
                     <td align="center">
                     <span id="sectionStatusBody" style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana">
       <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"/>



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 08: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

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.