cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Exception thrown from the server code is not received in the C# client. But a generic exception is thrown

ttom1
1-Newbie

Exception thrown from the server code is not received in the C# client. But a generic exception is thrown

Hi All,

I created a service in the TWX server which does a particular action.

The service code will throw some exception during some failure scenarios. Code which throw the exception is below:

if()

{

do something

}

else {

    throw ("A device with ID already exists.");

}

Then i wrote a client application using TWX Edge .NET SDK v5.6.5.

This application will connect to the server and calls the service. My expectation was that if service code throws above exception, i would get exception string in the client, so that i can take some decisions.

In positive scenarios, everything is working fine.

But during the failure scenarios (i.e. exception thrown from the service code in server), i am getting a entirely different exception in the client application.

Exception details are below:

"TwApiException was caught"

"Error invoking Service for Entity. Internal Server Error. (Code 1110)"

Any idea on why i am not getting the exception that is thrown from the server??/

Thanks in advance.

2 REPLIES 2
supandey
19-Tanzanite
(To:ttom1)

Tobin, in which log are you seeing this? What client is this which are you referring to? Was the service created within the .NET SDK and do you see this exception when that service fails to execute correctly when called within the ThingWorx composer? or was the service created directly in ThingWorx Composer ?

ttom1
1-Newbie
(To:supandey)

Sushant,

Thanks for the response.

- Service was created directly in the ThingWorx Composer.

- Exception is observed in the client application which communicate with TWX server and invoke this service.

- Client application is something similar to SteamSensor application.

- Client application is written in C# .NET.

More information:

Below api in the 'BaseClient' class is used for invoking the service from the client application:

public InfoTable invokeService(RelationshipTypes.ThingworxEntityTypes entityType, string entityName, string service, ValueCollection parameters, int timeout);

Top Tags