Call Web Service - The remote server returned an error: (500) Internal Server Error.


Badge +4

Hi All,

We have a requirement to create an Item in a list via the workflow. this works fine, if both the lists are in the same Site Collection. In this scenario, we have 2 Site collections and when a workflow is run on an Item in a list which exists in Site A, we need to create an Item in another list which exists under Site B.

I am trying to use the 'Call Web Service' Action and using the 'UpdateListItems' Method to add a new Item. The XML I use is as below and have tried with many variants as seen on Nintex Connect and other sites.

<Batch OnError="Continue" ListVersion="1">
   <Method ID="1" Cmd="New">
      <Field Name='ID'>New</Field>
      <Field Name="Title">This is a new Title</Field>
   </Method>
</Batch>

But no matter what I pass through, I get the below error

The remote server returned an error: (500) Internal Server Error.

I have seen suggestions to 'Encode Inserted Tokens' but still no luck. Anyone else faced similar issues. Is it possible at all to create an Item in a list in a separate site collection to where the workflow is running ? Any leads on what could possibly be the issue ?

Thanks in advance.

Shaju Samuel


13 replies

Userlevel 5
Badge +12

Are you seeing this error only in the "Run Now" test result view mode?    This is pretty common.   If your answer is yes, try running your workflow to see if the results are what you were expecting.


Thanks

Badge +4

Thanks Mark.
Yes that is when I click on 'Run Now' but even if I run the workflow, I get the below error

Failed to invoke web service. Error returned from server: <soap:Fault xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soap:Server</faultcode><faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.

Userlevel 5
Badge +12

In the Soap Editor copy and paste the following, make sure to change listName to your list name where i have "Your List Name":

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/">
<soap:Header>
</soap:Header>
<soap:Body>
<m:UpdateListItems>
<m:listName>Your List Name</m:listName>
<m:updates>
<Batch OnError="Continue">
<Method ID="1" Cmd="New">
<Field Name="ID">New</Field>
<Field Name="Title">Test One</Field>
</Method>
</Batch>
</m:updates>
</m:UpdateListItems>
</soap:Body>
</soap:Envelope>

Badge +4

Thanks again Mike

Still gives the same error. Tried both options, 'Run Now' and running the workflow.

Badge +7

Are you seeing any errors in the ULS logs?

Userlevel 6
Badge +12

Hello Shaju Samuel‌ - 

A few things to try.

Does the login that is executing the web service have access to the list that is being written to? If not, you will be able "Test the connection" just fine, but will not be able to Run Now.

Also, check the spelling on the list name, could be something as simple as a typo confused.png.

Hope this helps!

Userlevel 5
Badge +12

Can you take a screen shot of the action showing the Soap Editor along with the soap above?     This will  help to narrow it down a bit.

Thanks

Badge +4

Thanks Jan

I don't see anything specific in the ULS logs in regards to the error.

Badge +4

Hi Jesse

Thanks.

Yes the user have access to the list and I have made sure that the Spellings and names are all correct.

Badge +4

Hi Mike

The screenshot as requested. Also, I have tested the list name with and without spaces (to test)

Userlevel 6
Badge +12

Hmmm... That was going to be my next question if the name is accurate. We ran into an issue as a user renamed their list and we saw failures.

Have you tried any other web service calls? Do they work? What about writing to a different list?

Userlevel 5
Badge +12

Sometimes I've seen errors like this occur because of the URL.    It is the difference between using the "Internal" and "External" URL's specified in your URL mapping in Central Admin.    This may very well be the reason you are seeing this.    Please check your mappings and test with the URLS you see in the URL mapping.

You may also want to test with an "Https" variant, as opposed to "Http".

Hopefully this solves your issue once you locate the correct URL.

Thanks,
Mike

Badge +5

I think ‌ is right with the URL Mapping in Central Administration. I had the same issue at a customer and  the solution was to use the internal URL from Access Mappings in CA

Reply