Custom Rest service with complex type not appearing in smartobject tester

  • 23 September 2017
  • 3 replies
  • 4 views

HI

I am fairly new in K2.I had to update one hidden field using workflow so I tried to create custom web service which will be deployed in Sharepoint and then we are going to register that service in K2.

FOr the simple get and post I was able to register and see the methods in smartobject tester and was working fine so Now I created a new service with complex types but that is not visible in smart object tester.

I have attached the swagger file and service tester file how it looks.I had other simple services those are working fine so those I have commented.If you see service tester complex type definition has come but the method is not coming.

Below is c# signature code.Any help would be appreciated

 

[OperationContract(Name = "AppendProcessInstanceId")]
[WebInvoke(Method = "POST", UriTemplate = "AppendProcessInstanceId",
RequestFormat = WebMessageFormat.Json,BodyStyle =WebMessageBodyStyle.WrappedRequest,
ResponseFormat = WebMessageFormat.Json)]
string AppendProcessInstanceId(AppendProcessIdContract processIdContract);

 

 

[DataContract]
public class AppendProcessIdContract
{
[DataMember]
public int ItemId { get; set; }

[DataMember]
public string ListUrl { get; set; }

[DataMember]
public string ProcessInstanceId { get; set; }

}


3 replies

Badge +9

Hi Check this Post and see if this helps

https://vijaydk2guy.wordpress.com/2017/09/13/handling-complex-objects-in-k2-smartobjects/

I have the same issue when I use a complex type as the response type.

 

Also when the method returns a string it shows up, but when I use the complex type it isn't.

 

[HttpGet]
[ResponseType(typeof(Certificate))]
public HttpResponseMessage CreateCertificatesRequest(string serializedCertificateRequest)

{

      Certificate result = new Certificate();

      try

         {

//....................... removed for readability

              return Request.CreateResponse(HttpStatusCode.OK, result);
         }
         catch (Exception ex)
         {
              return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
         }

 

}

Sorry, I found it. It is under the Object Type > complex type > Method. Not under the Service Operation category.

 

 

Reply