4 Replies Latest reply on Jul 28, 2016 1:01 AM by RoH1

    RaiseError with SOAP.request

    RoH1 Level 1

      Hi all,

      what I'm trying to do is to synchronize the value of some formular field to SharePoint list columns. I try to realize this by executing a SOAP.request.

      Actually my experience with JS is poor and I did also not really work with XML and SOAP before. Maybe someone can tell me what I'm doing wrong here.

       

      function SyncMetadata(){

          var webUrl = "https://website/_vti_bin/Lists.asmx?wsdl";

          var action = "http://schemas.microsoft.com/sharepoint/soap/UpdateListItems";

          var xmlmsg;

          var listname = "Orders";

          var anumber = this.getField("OrderID").value;

       

          var user = app.response({cLabel:"Username", cTitle:"Authentification"});

          var pwd = app.response({bPassword:true, cLabel:"Password", cTitle:"Authentification"});

          var auth ={

              Username: user,

              Password: pwd

          }

       

          xmlmsg = '<?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/">'+

                          '<listName>'+listname+'</listName>'+

                          '<Where><Eq><FieldRef Name="ID"><Value Type="Integer">+8+</Value></Eq></Where>'+

                          '<updates>'+

                              '<Batch OnError="Continue">'+

                              '<Method ID="1" Cmd="Update">'+

                                  '<Field Name="OrderID"/>'+anumber+'</Field>'+

                              '</Method>'+

                              '</Batch>'+

                          '</updates>'+

                          '</UpdateListItems>'+

                      '</soap:Body>'+

                  '</soap:Envelope>';

       

          try{ 

          Net.SOAP.connect(webUrl);

          } catch(e){

              app.alert({

                  cMsg: "Connection failed for",

                  cTitle: "SOAP Error"

              })

              return null;

          };

       

          Net.SOAP.request(

          {

              cURL: webUrl,

              cAction: action,

              oAuthentication: auth,

              oRequest: xmlmsg

          });

      }

       

      The code stops with:

      RaiseError:

      Net.SOAP.request:50:AcroForm:Sync:Annot1:OnFocus:Action1

      ===>

       

      Line 50 points to oRequest: xmlmsg