WCF called from Sharepoint - thread abort exception

Hello,
we have an SP web part calling WCF service using simple http binding. SP and WCF are located on different servers in different countries, so not at the same machine. Using WCF we send/receive some files, which are processed at the WCF server site, parsed
and stored to database. It takes some time, of course, but usually not more than minute or 2. On development server it works normally but on production server we are facing problems like
System.Threading.ThreadAbortException: Thread was being aborted. at System.Net.UnsafeNclNativeMethods.OSSOCK.recv(IntPtr socketHandle, Byte* pinnedBuffer, Int32 len, SocketFlags socketFlags) at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset,
Int32 size, SocketFlags socketFlags, SocketError& errorCode) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.Connection.SyncRead(HttpWebRequest
request, Boolean userRetrievedStream, Boolean probeRead) at System.Net.ConnectStream.ProcessWriteCallDone(ConnectionReturnResult returnResult) at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan
timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type) at DHI.FRMP.Sharepoint.Tasks.MCSPConnector.IMCSPConnector.TaskUpdate(TaskUpdateRequest request) at DHI.FRMP.Sharepoint.Tasks.TaskEditSave.TaskEditSave.btnSaveChanges_Click(Object sender, ImageClickEventArgs e)
or
System.Threading.ThreadAbortException: Thread was being aborted. at System.Threading.WaitHandle.WaitOneNative(SafeHandle waitableSafeHandle, UInt32 millisecondsTimeout, Boolean hasThreadAffinity, Boolean exitContext) at System.Threading.WaitHandle.InternalWaitOne(SafeHandle
waitableSafeHandle, Int64 millisecondsTimeout, Boolean hasThreadAffinity, Boolean exitContext) at System.Net.LazyAsyncResult.WaitForCompletion(Boolean snap) at System.Net.Connection.SubmitRequest(HttpWebRequest request, Boolean forcedsubmit) at System.Net.ServicePoint.SubmitRequest(HttpWebRequest
request, String connName) at System.Net.HttpWebRequest.SubmitRequest(ServicePoint servicePoint) at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at System.Net.HttpWebRequest.GetRequestStream() at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout) at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message
message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at DHI.FRMP.Sharepoint.Tasks.MCSPConnector.IMCSPConnector.GetTaskCatchmentList(GetTaskCatchmentListRequest
request) at DHI.FRMP.Sharepoint.Tasks.TaskAdd.ddlWaterRegion_SelectedIndexChanged(Object sender, EventArgs e)
We have already checked that the client is properly closed and disposed. We also know that the web service call is processed correctly (from the logs).
Streams are closed.
Sharepoint timeout for long operation is set to 3600.
WCF is hosted in windows service application, used .NET 4.0. WCF config:
<system.serviceModel>
<client />
<bindings>
<basicHttpBinding>
<binding name="StreamedHTTP" closeTimeout="04:01:00" openTimeout="04:01:00"
receiveTimeout="04:10:00" sendTimeout="04:01:00" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647" messageEncoding="Mtom" transferMode="Streamed">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="DHI.FRMP.MCSPConnector.MCSPConnector">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="StreamedHTTP"
contract="DHI.FRMP.MCSPConnector.IMCSPConnector">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="False"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
Client creation code
public static IMCSPConnectorChannel CreateWCFclient(out ChannelFactory<IMCSPConnectorChannel> factory)
BasicHttpBinding myBinding = new BasicHttpBinding();
TimeSpan timeOut = new TimeSpan(4, 1, 0);
int maxSize = 2147483647;
myBinding.CloseTimeout = timeOut;
myBinding.OpenTimeout = timeOut;
myBinding.ReceiveTimeout = timeOut;
myBinding.SendTimeout = timeOut;
myBinding.AllowCookies = false;
myBinding.BypassProxyOnLocal = false;
myBinding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
myBinding.MaxBufferSize = maxSize;
myBinding.MaxBufferPoolSize = maxSize;
myBinding.MaxReceivedMessageSize = maxSize;
myBinding.MessageEncoding = WSMessageEncoding.Mtom;
myBinding.TextEncoding = System.Text.Encoding.UTF8;
myBinding.TransferMode = TransferMode.Streamed;
myBinding.UseDefaultWebProxy = true;
myBinding.ReaderQuotas.MaxDepth = 128;
myBinding.ReaderQuotas.MaxStringContentLength = maxSize;
myBinding.ReaderQuotas.MaxArrayLength = maxSize;
myBinding.ReaderQuotas.MaxBytesPerRead = maxSize;
myBinding.ReaderQuotas.MaxNameTableCharCount = maxSize;
ChannelFactory<IMCSPConnectorChannel> myFactory = null;
//SPSecurity.RunWithElevatedPrivileges(delegate()
var constants = new Settings(SPContext.Current.Site);//siteelev);
string endpointAddress = constants.WcfUrl;
EndpointAddress myEndpoint = new EndpointAddress(endpointAddress);
myFactory = new ChannelFactory<IMCSPConnectorChannel>(myBinding, myEndpoint);
IMCSPConnectorChannel channel = myFactory.CreateChannel();
factory = myFactory;
return channel;
Client and factory are both disposed after each usage.
this is the simplified code with some comments
IMCSPConnectorChannel channel = CommonFunctions.CreateWCFclient();
using (var proxy = channel.Wrap<IMCSPConnectorChannel>())
var svcClient = proxy.BaseObject;
try
// do something - works ok
if (success)
//try update
try
//time consuming WCF method - sometimes 2 minutes, however it passes and in the WCF log is record about it just a second before it crashes back here
svcClient.TaskUpdate(new TaskUpdateRequest(_taskID));
catch (FaultException fe)
//some processing here - not reached
catch (Exception ue)
//here it goes to - exception is caught and
success = false;
siteelev.WriteLogError(String.Format("Task '{0}' - task update fail on general exception: {1}", _taskID, ue.ToStringWithInnerExceptions()));
//previos line is processesd, no more code exists after that
//go back to folder if WCF returns success
if (success)
//not reached (success has been set to false when it crashed)
else
siteelev.WriteLogInfo("Some log text");
//this is ALSO NOT reached!! why, I don't understand
catch (Exception ee)
// it goes to here!! why ? - the exception has been already handled!
throw;;
I don't understand why it goes to the second catch when the exception has been already hadled in previous catch and why it doesn't go into success=false block.
Any idea what can be wrong?
Many thanks
Filip

Hi,
thanks for your reply. Now it seems that everything works (I'm still keepng my fingers crossed ;-)
What we did:
1) to the page I added 
protected void Page_Load(object sender, EventArgs e)
                this.Page.Server.ScriptTimeout = 3600;
2) to WCF confing at server side we added 
 <serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100"/>
But if this is what helped, I don't know. The timeout had to be already set in cofig files, but this is only what the SP server administrator claimed, I haven't done it personally. This seems to be much clear
for me.

Similar Messages

  • Thread Aborted Exception

    Hi,
    I'm using LDAP with Active Directory.
    When I run a query, the very first time, results are correctly
    populated. Every successive query then fails, with a thread aborted
    exception:
    Message: Thread was being aborted.
    Stack Trace:
    at System.Net.UnsafeNclNativeMethods.OSSOCK.recv(IntP tr
    socketHandle, Byte* pinnedBuffer, Int32 len, SocketFlags socketFlags)
    at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset,
    Int32 size, SocketFlags socketFlags, SocketError& errorCode)
    at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset,
    Int32 size, SocketFlags socketFlags)
    at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32
    offset, Int32 size)
    at System.IO.Stream.ReadByte()
    at Novell.Directory.Ldap.Asn1.Asn1Identifier..ctor(St ream
    in_Renamed)
    at Novell.Directory.Ldap.Connection.ReaderThread.Run( )
    Could anyone help with why this is happening?
    Thanks,
    Nedar
    nedar
    nedar's Profile: http://forums.novell.com/member.php?userid=78416
    View this thread: http://forums.novell.com/showthread.php?t=401581

    nedar;1936674 Wrote:
    > I did try simply replacing the dll, but that did not help.
    Can you encapsulate the failure into a test harness and post the code
    some place? If you are running latest libraries... and you do get a
    correct run the first time through... perhaps the issue is in the way
    you are using them.
    Also, have you seen 'similar'
    (http://developer.cisco.com/web/cuae/.../105446316CEF7)
    error? Seems to involve the FQN / BaseDN being used... same stack
    traces, essentially. Specifically:
    > DC=cisco,DC=com is reproducing the same error on my side. "o=cisco.com"
    > is working fine.
    >
    > Basically, the correct format of BaseDN for your specific ldap server
    > is needed to make the Query work. You may be able to look at your ldap
    > server to figure correct format.
    >
    -- Bob
    Bob Mahar -- Novell Knowledge Partner
    Do you do what you do at a .EDU? http://novell.com/ttp
    "Programming is like teaching a jellyfish to build a house."
    http://twitter.com/BobMahar http://vimeo.com/boborama
    Bob-O-Rama's Profile: http://forums.novell.com/member.php?userid=5269
    View this thread: http://forums.novell.com/showthread.php?t=401581

  • Independent stateful calls from different threads on one destination

    Hello SAP-Experts,
    i'm dealing with the problem on the Web AS to guarantee some independent stateful call sequences for different calling threads.
    One application running on a WAS (the WAS-app) is called by different clients to pass some data. The WAS-app has to distribute the data to another system by using one RFC-destination.
    As i have understood i have to guarantee thread-safe sessions for stateful calls from different thread by implementing a custom SessionReferenceProvider that binds the session to the thread. I have done this.
    My problem is to register my custom SessionReferenceProvider to the WAS environment. By trying i get the following error:
    [java.lang.IllegalStateException: SessionReferenceProvider already registered [com.sap.engine.sessionmgmt.jco.applib.impl.SessionReferenceProviderImpl]]
    Does anyone can tell me how to register the custom SessionReferenceProvider on a WAS?
    Thanks and greetings
    Robert

    Hi Robert,
    You can first try stopping a Java application named sessionmgmtjcoapplib from Star&Stop, then register yours sessionReferenceProvider again.
    Jian

  • Make Calls From Message Threads

    Regard From Sweden
    I love the phone, I've had it almost a week now and the communication possibilities are endless.  My job just got so much easier. Today however, I received an SMS from someone and then I was going to try to call them and realized that I could not do it. On my old Android, all I had to do was swipe the message. But that did not work here. I have been searching in Google and here under the following titles:
    “Make calls from message threads”
    “Ring from SMS”
    I have found nothing. Part of the problem is always coming up with the right search words. Surely one should be able to dial the number of a recieved SMS Thread  without having to memorize the number.  I also have had the problem of being unable to send longer SMS/Chat messages but I shall try turning off the WiFi as some have met with success with that measure
    My last problem is with Nokia’s City Lens. It worked fine the first 3 days that I had it, but now it won’t go past the Figure 8 page.
    Happy to report that battery life gets better and better with every charge. It's fun to be a telephone pioneer, I'm happy to be at the forefront for once instead of at the back. All my Iphone friends gawked at the new phone saying "What is that?"
    S-E

    Figured out the City Lens problem too. I have the phone i a Black Vegan Folio Wallet Case  even though the lens and camera are not covered by the case, the remainder of the backside is covered by a black plastic cóver. City Lens works out of the case, but not in it.

  • Environment.Exit hangs when called from an application domain exception handler

    I've implemented a handler for exceptions not thrown in the main GUI thread of my C# WinForms application, as follows:
        AppDomain.CurrentDomain.UnhandledException  += OnUnhandledExceptionThrown;
    This handler is called from a background thread. The last statement in this handler is a call to
    Environment.Exit with the application exit code. However, the application hangs in this call. From within Visual Studio, it hangs and I'm unable to break the application; I have to use Task Manager to terminate Visual Studio. Environment.Exit
    works fine when called from the unhandled exception handler for the GUI thread. Is there a better way to terminate the application in the context of an unhandled exception thrown by a background thread?

    Are you just trying to avoid a crash? Environment.Exit can cause deadlocking if exiting in the wrong kind of scenario; if you're just trying to avoid a crash, use
    GetCurrentProcess with
    TerminateProcess to terminate your own process.  It skips the notification phases that Environment.Exit uses which prevents the common deadlock scenarios.
    WinSDK Support Team Blog: http://blogs.msdn.com/b/winsdk/

  • Need assistance using coherence calls from an ejb, get exception

    I've added some Coherence calls to a simple EJB, that can be called from a plain java client or a jsp. The bean code is attached as well as the call stack for the exceptions, first
    for plain java client, second for jsp. Have also run Web installer, this file
    is attached too.
    Your help would be greatly appreciated.
    Thank you,
    Ken Rubin<br><br> <b> Attachment: </b><br>javaclientexception.txt <br> (*To use this attachment you will need to rename 209.bin to javaclientexception.txt after the download is complete.)<br><br> <b> Attachment: </b><br>jspexception.txt <br> (*To use this attachment you will need to rename 210.bin to jspexception.txt after the download is complete.)<br><br> <b> Attachment: </b><br>ConverterBean.java <br> (*To use this attachment you will need to rename 211.bin to ConverterBean.java after the download is complete.)<br><br> <b> Attachment: </b><br>coherence-web.xml <br> (*To use this attachment you will need to rename 212.bin to coherence-web.xml after the download is complete.)

    Hi CP,
    I had added C:/tangosol/lib/tangosol.jar;C:/tangosol/lib/coherence.jar
    to my classpath originally and could not find the classes. After I copied both jars into
    my Sun/AppServer/lib path, the jars were found, yet I
    get another exception, which is attached.
    My server is Sun Java Application Server 8 Q1.
    Thank you,
    Ken<br><br> <b> Attachment: </b><br>aftercopyinglibs.txt <br> (*To use this attachment you will need to rename 213.bin to aftercopyinglibs.txt after the download is complete.)

  • JFrame instance called from a Thread

    Hi All,
    I have an application that fetches data from a database. I have a thread that displays a 'Please wait' message in a JFrame while the software fetches data from the databse.
    The trouble is that the message does not appear on the JPanel untill the data is completely fetched from the database.
    The frame appears with a button, but no message on it!
    Please help.
    Thanks.
    Anuj.
    Code :
    // calling method
    InformationBox ib = new InformationBox("Please wait while the software fetches data from the database");
    ib.setTitle("Please wait");
    ib.setLocation(100,100);
    ib.setVisible(true);
    ib.pack();
    public class InformationBox extends javax.swing.JFrame implements ActionListener {
    JButton ok = new JButton("OK");
    JPanel text = new JPanel();
    JPanel okp = new JPanel();
    JLabel center = new JLabel();
    FlowLayout f1 = new FlowLayout();
    FlowLayout f2 = new FlowLayout();
    BorderLayout b1 = new BorderLayout();
    String comments ="" ;
    public InformationBox(String sd) {
    this.comments=sd;
    jbInit();
    public void jbInit() {
    this.getContentPane().setLayout(b1);
    text.setLayout(f1);
    text.add(center);
    center.setLayout(new FlowLayout());
    center.setText(comments);
    ok.addActionListener(this);
    okp.setLayout(new FlowLayout());
    okp.add(ok);
    getContentPane().add(center, BorderLayout.CENTER);
    getContentPane().add(okp, BorderLayout.SOUTH);
    public void actionPerformed(ActionEvent e) {
    if (e.getSource() == ok) {
    //eq.setEnabled(true);
    this.setVisible(false);
    }

    // calling method
    InformationBox ib = new InformationBox("Please wait while the software fetches data from the database");
    ib.setTitle("Please wait");
    ib.setLocation(100,100);
    ib.setVisible(true);
    ib.pack();--------------------------------
    public class InformationBox extends javax.swing.JFrame implements ActionListener {
    JButton ok = new JButton("OK");
    JPanel text = new JPanel();
    JPanel okp = new JPanel();
    JLabel center = new JLabel();
    FlowLayout f1 = new FlowLayout();
    FlowLayout f2 = new FlowLayout();
    BorderLayout b1 = new BorderLayout();
    String comments ="" ;
    public InformationBox(String sd) {
    this.comments=sd;
    jbInit();
    public void jbInit() {
    this.getContentPane().setLayout(b1);
    text.setLayout(f1);
    text.add(center);
    center.setLayout(new FlowLayout());
    center.setText(comments);
    ok.addActionListener(this);
    okp.setLayout(new FlowLayout());
    okp.add(ok);
    getContentPane().add(center, BorderLayout.CENTER);
    getContentPane().add(okp, BorderLayout.SOUTH);
    public void actionPerformed(ActionEvent e) {
    if (e.getSource() == ok) {
    //eq.setEnabled(true);
    this.setVisible(false);
    }

  • External Rest API call from SharePoint 2013 On Premises

    Hi All,
    May my questions is silly but I am totally tired by trying different things.
    I need to call a third party rest api from my SharePoint Designer page using &Ajax call.First time when i tried it gave me access denied then added this line
    jQuery.support.cors =true;
    Again error changed to "No Transport" last time i had the same situation i saw some sites where people mentioned some power shell script to enable something at web app level but didn't remember if possible can some help me please i already wasted
    my half long weekend :(
    Note :- This is SharePoint On Premises
    Thanks in Advance :)

    Hi All,
    May my questions is silly but I am totally tired by trying different things.
    I need to call a third party rest api from my SharePoint Designer page using &Ajax call.First time when i tried it gave me access denied then added this line
    jQuery.support.cors =true;
    Again error changed to "No Transport" last time i had the same situation i saw some sites where people mentioned some power shell script to enable something at web app level but didn't remember if possible can some help me please i already wasted
    my half long weekend :(
    Note :- This is SharePoint On Premises
    Thanks in Advance :)

  • Error when running backend call in a thread

    Hi,
    When trying to execute a RFC call from a thread in a webdynpro componennt, I am getting the follwing error.
         Unable to access Task Scope in DynamicRFCModelClass. Either run in Engine, or turn Test mode on in WDModelFactory!
    Thnakd and Regards,
    Aditya

    Hi Aditya
    I think that WebDynpro Java application cannot launch any threads in general. The reason is the WebDynpro application is fully controlled by WebDynpro framework (container), but your custom thread launched is working outside the WebDynpro framework and cannot properly access all the WebDynpro API and services.
    BR, Siarhei

  • Killing an exec'ed process from another thread

    Hi all,
    I written an application that executes some external OS - processes. There is a dispatcher thread, that starts the execution threads for some jobs. Every execution thread creates a Processes by calling runtime.exec(), adds this object to a TreeMap ( member of the dispatcher ), creates two threads for reading the output of the process ( sdtout & stderr ) and calls p.waitFor(). From this moment this thread is blocked. After the process is done, the results will be processed by this thread etc. Now I want to go ahead and let the application user kill the process. For them I let the dispatcher - thread, that has also a reference to the executed process to call destroy of it if necessary during the execution thread is blocked by waitFor() and two output threads are reading stdout & stderr. The problem is however that destroy() - call from another thread doesn't kill the subprocess. The subprocess is running until it's done or terminated from out of jvm. Have you an idea or example?
    Thanks a lot & regards
    Alex

    >
    I know you have been discussing your problem is that
    you can't kill a "sleep" process. But just to be
    sure, I tested your description by one thread exec-ing
    a "not-sleep" program, and then another thread had no
    trouble killing it.
    I took your code and wrote a program around it such
    that
    Thread1 :
    - creates a Job (but not a "sleep" job); creates a
    JobMap ; puts Job in JobMap
    - starts Thread2 (passing it JobMap)
    - sleeps 15 seconds
    - calls Job.kill() (your method)
    Thread2 :
    - gets Job from JobMap
    - calls Job.execute() (your method)
    It's quick and dirty and sloppy, but it works. The
    result is when the kill takes place, the execute
    method (Thread2) wakes from its waitFor, and gets
    exitValue() = 1 for the Process.
    so,
    In order to kill the sleep process, which (according
    to BIJ) is not the Process that you have from exec
    call, maybe the only way to kill it is to get its PID
    an exec a "kill -9" on it, same as you said you had to
    do from the commandline. I don't know if you can get
    the PID, maybe you can get the exec-ed process to spit
    it onto stdout or stderr?
    (I am on win, not *nix, right now, so I am just
    throwing out a suggestion before bowing out of this
    discussion.)
    /MelHi Mel,
    yes, it should work right on windows because you created probably the shell by cmd /c or something like this. If you kill the cmd - process, everithing executed by the interpretter will be killed too. My application is running on Windows and unix. On unix I have to execute the process from a shell ( in my case it is the born shell ). The problem is however, that the born shell has another behaviour as cmd and doesn't die. Do you have an idea how to get the pid of the process started by sh without command line? To kill the processes from the command line is exactly what my customers do now. But they want to get "a better service" ...:-)
    Regards
    Alex

  • How to call COPY web service from sharepoint in SAP

    Hello Experts,
    I want to call COPY web service from SharePoint in SAP  web dynpro / JAVA application.
    However, when I try to connect to web service and download wsdl using   http:// <hostname:port>/_vti_bin/copy.asmx?wsdl
    it results in Unauthorized error and doesnt complete the setup. Detail error is :
     Error occurred while downloading WSIL file. Error message: Deserializing xml stream  http:// <hostname:port>/_vti_bin/copy.asmx?wsdl
    failed.com.sap.engine.services.webservices.espbase.wsdl.exceptions.WSDLException: Invalid Response Code: (401) Unauthorized. The requested URL was:"Connect to 
    http:// <hostname:port>/_vti_bin/copy.asmx?wsdl , used user to connect: userid"
    I am trying to connect with server user account. Any idea on what authorizations might be required or any help on the scenario .
    -Abhijeet

    Here's an example on how to delete a list item, hopefully this helps
    package com.jw.sharepoint.examples;
    import java.io.File;
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import java.util.Date;
    import java.util.Properties;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import com.microsoft.sharepoint.webservices.CopySoap;
    import com.microsoft.sharepoint.webservices.GetListItems;
    import com.microsoft.sharepoint.webservices.GetListItemsResponse;
    import com.microsoft.sharepoint.webservices.ListsSoap;
    import com.microsoft.sharepoint.webservices.UpdateListItems.Updates;
    import com.microsoft.sharepoint.webservices.UpdateListItemsResponse.UpdateListItemsResult;
    public class SharePointDeleteListItemExample extends SharePointBaseExample {
     private String delete = null;
     private String deleteListItemQuery = null;
     private String queryOptions = null;
     private static final Log logger = LogFactory.getLog(SharePointUploadDocumentExample.class);
     private static Properties properties = new Properties();
     public Properties getProperties() {
      return properties;
      * @param args
     public static void main(String[] args) {
      logger.debug("main...");
      SharePointDeleteListItemExample example = new SharePointDeleteListItemExample();
      try {
       example.initialize();
       CopySoap cp = example.getCopySoap();
       example.uploadDocument(cp, properties.getProperty("copy.sourceFile"));
       ListsSoap ls = example.getListsSoap();
       example.executeQueryAndDelete(ls);
      } catch (Exception ex) {
       logger.error("Error caught in main: ", ex);
     public void executeQueryAndDelete(ListsSoap ls) throws Exception {
      Date today = Calendar.getInstance().getTime();
      SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
      String formattedDate = simpleDateFormat.format(today);
      String queryFormatted = String.format(deleteListItemQuery,formattedDate);  
      GetListItems.QueryOptions msQueryOptions = new GetListItems.QueryOptions();
      GetListItems.Query msQuery = new GetListItems.Query();
      msQuery.getContent().add(createSharePointCAMLNode(queryFormatted));
      msQueryOptions.getContent().add(createSharePointCAMLNode(this.queryOptions));
      GetListItemsResponse.GetListItemsResult result = ls.getListItems(
        properties.getProperty("folder"), "", msQuery, null, "",
        msQueryOptions, "");
      writeResult(result.getContent().get(0), System.out);
      Element element = (Element) result.getContent().get(0);
      NodeList nl = element.getElementsByTagName("z:row");
      for (int i = 0; i < nl.getLength(); i++) {
       Node node = nl.item(i);
       String id = node.getAttributes().getNamedItem("ows_ID").getNodeValue();
       String fileRefRelativePath = node.getAttributes().getNamedItem("ows_FileRef").getNodeValue();
       logger.debug("id: " + id);
       logger.debug("fileRefRelativePath: " + fileRefRelativePath);
       String fileRef = properties.getProperty("delete.FileRef.base") + fileRefRelativePath.split("#")[1];
       logger.debug("fileRef: " + fileRef);
       deleteListItem(ls, properties.getProperty("folder"), id, fileRef);
     public void deleteListItem(ListsSoap ls, String listName, String listId, String fileRef) throws Exception {
      String deleteFormatted = String.format(delete, listId, fileRef);  
      Updates u = new Updates();
      u.getContent().add(createSharePointCAMLNode(deleteFormatted));
      UpdateListItemsResult ret = ls.updateListItems(listName, u);
      writeResult(ret.getContent().get(0), System.out);
     public void initialize() throws Exception {
      logger.info("initialize()...");
      properties.load(getClass().getResourceAsStream("/SharePointDeleteListItemExample.properties"));
      super.initialize();
      this.delete = new String(readAll(new File(this.getClass().getResource("/Delete.xml").toURI())));
      this.deleteListItemQuery = new String(readAll(new File(this.getClass().getResource("/DeleteListItemQuery.xml").toURI())));
      this.queryOptions = new String(readAll(new File(this.getClass().getResource("/QueryOptions.xml").toURI())));
    Brandon James SharePoint Developer/Administrator

  • Catching an exception thrown from another thread

    I have a SocketServer that creates new threads to handle incoming clients. If one of the threads throw a SQLException is it possible to catch that exception in the SocketServer that created that thread.
    I tried implementing this code and I cannot get the server to catch an exception thrown in the thread. Are my assumptions correct?
    I was reading something about Thread Groups and implementing an uncoughtException() method, but this looked like overkill.
    Thanks for your time!
    Some Example code would be the following where the ClientThread will do a database query which could cause an SQLException. I'd like to catch that exception in my Socket Server
          try
                 new ClientThread( socketServer.accept() , host, connection ).start();
          catch( SQLException e )
                 System.out.println( "DataSource Connection Problem" );
                  e.printStackTrace();
          }

    hehe, why?
    The server's job is to listen for an incoming message from a client and pass it off to a thread to handle the client. Otherwise the server will have to block on that incoming port untill it has finished handling the client and usually there are many incoming clients continuously.
    The reason I would want to catch an exception in the server based on the SQLException thrown in the thread is because the SQLException is usually going to be due to the fact the datasource connection has become unavalable, or needs to be refreshed. This datasource connection is a private variable stored in the socket server. The SocketServer now needs to know that it has to refresh that datasource connection. I would normally try to use somesort of flag to set the variable but to throw another wrench into my dilemma, the SocketServer is actually its own thread. So I can't make any of these variables static, which means I can't have the thread call a method on teh socket server to change the status flag. :)
    I guess I need implement some sort of Listener that the thread can notify when a datasource connection goes down?
    Thanks for the help so far, I figured java would not want one thread to catch another thread's exceptions, but I just wanted to make sure.

  • Calling an external web service from SharePoint 2010

    Hi Friends,
    Idea is to call an external web service from SharePoint 2010 list.
    Can we do this using visual studio 2010, how.
    another pointers, please advise.

    Hi,
    You can create Windows Communication Foundation (WCF) web services that you can consume as external content types from Microsoft Business Connectivity Services (BCS).
    For more information, you can refer to:
    http://msdn.microsoft.com/en-us/library/office/gg318615(v=office.14).aspx
    http://www.c-sharpcorner.com/UploadFile/Roji.Joy/connecting-to-a-web-service-using-business-connectivity-serv/
    http://blogs.msmvps.com/windsor/2011/11/04/walkthrough-creating-a-custom-asp-net-asmx-web-service-in-sharepoint-2010/
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • How can I pass an exception from one thread to another thread

    If I create a new class, that will extends the class Thread, the methode run() can not be use with the statement Throws Exeption .
    The question now: Is there any possibility to pass an exception from one thread to another thread?
    Thx.

    It really depends on what you want to do with your exception. Is there some sort of global handler that will process the exceptions in some meaningful way? Unless you have that, there's not much point in throwing an exception in a thread, unless you simply want the stack trace generated.
    Presuming that you have a global handler that can catch exceptions, nest your Exception subclass inside a RuntimeException:
    public class NestedRuntimeException extends RuntimeException
        private final m_nestedException;
        public NestedRuntimeException(final Exception originalException)
            super("An exception occurred with message: " + originalException.getMessage());
            m_nestedException;
        public Exception getNestedException()
            return m_nestedException;
    }Your global handler can catch the NestedRuntimeException or be supplied it to process by the thread group.

  • Error: There was a failure to call cluster code from a provider. Exception message: Generic failure . Status code: 5015. SQL 2012 SP1

    Hi,
    Please help. I was trying to remove a SQL 2012 SP1 two node clustered instance using setup (Mantenance -> Remove Node)
    I started by doing this on passive node (and was successful) but when I ran setup on active node just before finishing successfully I got this error:
    TITLE: Microsoft SQL Server 2012 Service Pack 1 Setup
    The following error has occurred:
    The resource 'BCK_SG1DB' could not be moved from cluster group 'SQL Server (SG1DB)' to cluster group 'Available Storage'. 
    Error: There was a failure to call cluster code from a provider. Exception message: Generic failure . Status code: 5015.
    Description: The operation failed because either the specified cluster node is not the owner of the resource, or the node
    is not a possible owner of the resource.
    For help, click:
    http://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft%20SQL%20Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.3000.0&EvtType=0xE8049925%25400x42B4DED7
    BUTTONS:
    OK
    I noticed that SG1DB instance was removed on both nodes but on Failover Cluster Manager -> Services and Applications the SQL server instance for SG1DB is still there. So I tried to delete it but got the error:
    Failed to delete SQL Server SG1DB. An error was encountered while deleting the cluster service or
    application SQL Server SG1DB. Could not move the resource to available storage. An error occured
    while moving the resource BCK_SG1DB to the clustered service or application Available Storage
    Any ideas why it failed or how could I delete the SQL server instance from Clauster?
    Thx

    Hello,
    Please read the following resource.
    https://support.microsoft.com/en-us/kb/kbview/313882?wa=wsignin1.0
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

Maybe you are looking for

  • Cancel Subscription doesn't work !!!

    1) On a expired Skype Number subscription, Skype keeps trying to charge the Credit Card 2) Even worse, it doesn't let the end user remove the Credit Card. It claims that it is required to cancel subscription first, but when the option is selected, no

  • W2 Forms on Portal

    Hi All, We are implementing SAP HR, Payroll along with Portal with ESS/MSS. We have a trouble around making W2 Forms available in Portal. There is no standard functionality available to make W2 Forms available over Portal. Std SAP Process for W2 is w

  • Junk mail shuts down

    I have a piece of junk mail in my Inbox that I can't delete. When I try, Mail shuts down. How do I get rid of it? Should I worry that it's dangerous? I haven't noticed any other problems.

  • HT4519 setting up my pop mail on my IPad

    i can receive mail but not send, for some reason it won't verify server identity for smtp.  I have the exact same settings on my iphone and it works fine...  Any ideas???

  • Any way to update attribute in all Items of an Item Type ?

    Is there any way an attribute in all items publish of a single item type? I want to change all File Items so that they open in a New Browser. Please note: This is not for all items that we will publish going forward, just for the current items. I don