Unexpected error when copying dynamics GP share point workflow.

An unexpected error has been encountered in this Web Part. Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. You don’t have Add and Customize Pages permissions required to perform this action.,

The issue was the copy to company was not enabled for work flow type which was being attempted for copy!

Cheers!
Sanjay

Workflow XAML failed validation

Workflow Pairing

Default ports –
12291 – Http
12290 – Https
::obtain the ports from workflow server IIS and check the bindings for the workflow management site

Register-SPWorkflowService –SPSite “Site URL” –WorkflowHostUri “http://workflowhost:12291” –AllowOAuthHttp -Force
::use -Force to re register a already paired workflow.
::Pair the workflow server from the Sharepoint portal

Error message when the pairing is broken:
System.InvalidOperationException: Microsoft.Workflow.Client.ActivityValidationException: Workflow XAML failed validation due

to the following errors: Cannot set unknown member ‘LookupSPListItem.ItemId’. HTTP headers received from the server –

ActivityId: 304fb4ee-901d-43b8-b7ef-a8bcb220d599. NodeId: SP-WFE01. Scope: /SharePoint/default/0f273f2f-d070-4581-869b-

a684dfb4710c/e4b00a05-214e-4b0a-995d-fcd25c56d0c1. Client ActivityId : 3c801e9c-334a-10f4-b8e1-3c6fe1cae7af. —>

System.Net.WebException: The remote server returned an error: (400) Bad Request

Manually host a wcf service on IIS

Manually host a wcf service on IIS:

Attempted to deploy the webservice created here to IIS.  The wcf deploy from visual studio through web deploy kept on complaining web management service is not running on webserver – figured out a manual deploy would be simple solution.

  1. Create empty website on IIS.
    1. Home directory -> C:\WCFService on webserver
  2. Open the WCF visual studio project.
    1. Build >> Publish
    2. Create a new profile as WCFService
    3. Publish Method = File System
    4. Target Location c:\wcfservice on Visual studio machine
    5. Publish
    6. The publish folder will contain :
      1. PreCompiledApp.config
      2. Service1.svc
      3. web.config
      4. bin/webservice.dll
      5. bin/webservice.xml
  3. Copy the contents of published WCF project to the root directory of website published
    1. Copy c:\wcfservice\*.* on visual studio machine
      to
      c:\wcfservice on webserver
  4. Browse the service1.svc

See also:
How to create a WCF returning response in JSON format.

Cheers!
Sanjay

 

WCF webservice returning data in JSON format – VB.Net

WCF webservice returning data in JSON format:

  1. Create a visual basic WCF Service Application project at visual studio 2013
  2. Name the project JSONWebservice.
  3. Replace Iservice1.vb with following code
  4. <ServiceContract()> _
    Public Interface IService1
        <OperationContract()> _
        <WebInvoke(Method:="GET", ResponseFormat:=WebMessageFormat.Json, BodyStyle:=WebMessageBodyStyle.Wrapped, UriTemplate:="GetApprover/{value}")>
        Function GetApprover(ByVal value As String) As String
    End Interface
    
    
  5. Replace Service1.svc with following
  6. Imports System.Data
    Imports System.Data.SqlClient
    Public Class Service1
        Implements IService1
        Public Function GetApprover(ByVal value As String) As String Implements IService1.GetApprover
            Dim connectionstring As String
            Dim connection As SqlConnection
            Dim command As SqlCommand
            Dim adaptor As New SqlDataAdapter
            Dim ds As New DataSet
            Dim sql As String
            connectionstring = "Data Source = SQLSERVER;Initial Catalog=DBNAME;User Id=USERID;Password=PASSWORD"
            sql = "select approverlogin from DBNAME.dbo.TABLENAME where employeelogin = '" & value & "'"
            connection = New SqlConnection(connectionstring)
            connection.Open()
            command = New SqlCommand(sql, connection)
            adaptor.SelectCommand = command
            adaptor.Fill(ds)
            adaptor.Dispose()
            command.Dispose()
            connection.Close()
            If ds.Tables(0).Rows.Count > 0 Then
                connectionstring = ds.Tables(0).Rows(0).Item(0)
            Else
                connectionstring = "approver not found"
            End If
            ds.Clear()
            Return connectionstring
        End Function
    End Class
  7. Update the web.config
  8. <system.serviceModel>
        <services>
          <service name="JSONWebService.Service1" behaviorConfiguration="JSONWebService.Service1Behavior">
            <!-- Service Endpoints -->
            <endpoint address="../Service1.svc"
                      binding="webHttpBinding"
                      contract="JSONWebService.IService1"
                      behaviorConfiguration="webBehaviour"/>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="JSONWebService.Service1Behavior">
              <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
              <serviceMetadata httpGetEnabled="true"/>
              <!-- 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="false"/>
            </behavior>
          </serviceBehaviors>
          <endpointBehaviors>
            <behavior name="webBehaviour" >
              <webHttp />
            </behavior>
          </endpointBehaviors>
        </behaviors>
      </system.serviceModel>
  9. Setup up the start page at project propertiesScreenShot017
  10. Create a table with two columns approverlogin and employeelogin
  11. Insert sample date employeelogin (Sanjay Rajarao), (Ryan Jeffryes)
  12. Test ::  http://localhost:57086/Service1.svc/GetApprover/Sanjay%20Rajarao
  13. Return Value :
    {"GetApproverResult":"Ryan Jeffryes"}
  14. Webservice returns data in JSON format.

See also:
How to manually host WCF Service on IIS

 

Cheers!

Sanjay