3ds-cpe-emed / ws3dx-dotnet

C# client SDKs for Dassault Systèmes 3DEXPERIENCE web services.
MIT License
14 stars 1 forks source link
3dexperience csharp dotnet-core sdk webservice webservice-client

WS3DX .NET

The WS3DX .NET repository contains a collection of C# client SDKs to access Dassault Systèmes 3DEXPERIENCE web services.

Overview

The WS3DX .NET repository contains multiple Visual Studio solutions one for each 3DEXPERIENCE Web Service family. Check the 3DEXPERIENCE Web Service public documentation for details on how the 3DEXPERIENCE web services are organized.

The solution files are named in the form ws3dx.xyz.sln where xyz matches the 3DEXPERIENCE web service family abreviation name that the solution addresses (e.g. ws3dx.dseng.sln for engineering item, ws3dx.dsmfg.sln for manufacturing items - see coverage table below for more).

The only current exception is the wd3dx.sln file that is used only has an aggregator for all projects.

With a few exceptions a ws3dx solution normally contains 5 projects. As a general example, for the {xyz} corpus, we would have the followin projects:

3DEXPERIENCE Web Services coverage

The current (initial) set of C# client web services SDKs provided is detailed in the table below. This table will be expanded as time and opportunity allows to incorporate other families.

The priority is to support the 3DEXPERIENCE Cloud Web Services. Support for specific 3DEXPERIENCE OnPremise Web Services is second priority. Please note however that Cloud and OnPremise web services are - for the most part - the same.

3DEXPERIENCE WS VS Solution Versions
Engineering Web Services ws3dx.dseng 2024x FD02 (1.3.0), 2024x FD03 (1.4.0)
Manufacturing Item Web Services ws3dx.dsmfg 2024x FD03 (1.15.0)
Task Rest Services ws3dx.project.task 2024x FD03 (1.1.0)
CAD Collaboration Web Services ws3dx.dsxcad 2024x FD03 (1.5.0)

Note access to the 3DEXPERIENCE web service public documentation requires a 3DEXPERIENCE ID.

Getting Started

In order to compile the source code you need to have Visual Studio 2022 and .NET 8.0 SDK. Other Visual Studio versions have not been tried.

The following Nuget packages are required but should be downloaded and installed automatically for you.

For the Unit Tests:

Nuget package Version
NUnit 3.13.1
NUnit3TestAdapter 3.17.0
Microsoft.NET.Test.Sdk 16.9.4
coverlet.collector 3.0.2

SDK Design Goals

The following points describe the goals driving some of the design decisions taken in this project.

SDK Design Choices

Find below some of the technical decisions taken to support 3DEXPERIENCE web service concepts:

Mask concept as interface

The mask concept determines what should be returned from a given web service. Depending on the mask parameter passed the same web service can return different attributes. Many (but not all) 3DEXPERIENCE web services make use of this mask concept.

This has been translated in the C# SDK as an interface that is marked with the csharp MaskSchema attribute. for instance :

namespace ws3dx.dseng.data 
{
 [MaskSchema('dskern:Mask.Default')]
 public interface IEngItemDefaultMask : IItem
 {}
}

To restrict the client service methods to use only the masks that are supported by each web service, would ideally have been done on the method definition itself using template constraints (e.gIList<T> method1<T>(...) where T : IMask1, IMask2) However, even if C# allows this syntax, it does not give the expected results. Due to this limitation, this type-checking constraint needs to be done at runtime. This is the responsibility of the GenericParameterConstraintUtils.CheckConstraints that is used as input validation in many of the client service functions.

Enterprise attributes

Enterprise Attributes provide a way to extend the existing 3DEXPERIENCE standard attributes with additional custom attributes associated to different types of items. The Enterprise Attributes concept is common to all Cloud flavours as well as OnPremise environments. Enterprise Attributes come in the form of key-value pairs but given that it is not possible to know in advance their definitions, as each customer will implement ones depending on their needs, the current SDK support for this is to derive enterprise attributes interfaces from an csharp IDictionary<string, object>. This gives the greater flexibility to serialize/deserialize a key-value pair structure.

Customer attributes

At the web services layer, Customer Attributes are similar to Enterprise Attributes. They also provide a mechanism to extend the 3DEXPERIENCE data model with additional attributes the only 0difference being the internal 3DEXPERIENCE structure from which they are generated (e.g. TXO Deployment Extensions or Specialization Packages).

Unlike Enterprise Attributes however, Customer Attributes are not available on public Cloud and are only applicable to private and dedicate Cloud and OnPremise environments. In the same way that Enterprise Attributes, the support for it is to derive from an csharp IDictionary<string, object> which gives the maximum freedom to set a key-value pair.

simplify return collections

Many web services return a collection in the form For instance in the case of /resources/v1/modeler/dseng/dseng:EngItem/{ID} we could have, as a successful response (simplified):

    "totalItems": 1,
    "member": [
        {
            "id": "A437358E0000861C61E6E89F0000C526",
            "title": "Physical Product00410106",
            "type": "VPMReference",
            "cestamp": "795A0F6C8258000061EE6364000476D6",
                //...
        }
    ],
    "nlsLabel": {
       //...
    }
}

The data that we are interested comes in the array of the json member attribute. So, in order to simplify, a design decision was made to directly to wrap the return type within an IList or IEnumeration.

In the future we want to be able to also differentiate web services that return at most a single value from those that can return multiple values. In the first case we can even simplify further by returning a single object rather than the IList/IEnumeration.

Known Limitations

Semi-automated SDK generation process

In order to be able to keep up with new updates every new 3DEXPERIENCE release, or FD release, the creation of this SDK relies on a semi-automated process.

This process relies on two main transformation steps.

Given that the process is still being improved some manual tweaks might be required at the end of any of the steps above.

Contributing

Feel free to contribute by creating issues on the repository. If you would like to contribute with code contact us directly.

Next Steps

Some of the planned next activities.

Related Projects

This project is a spin-off and learning experience result of the first SDK project here:

Notes / History

The current branch dev/net8/ is a major refactoring of the ws3dx project upgrading to .NET 8 and taking advantage of the provided standard serialization and, to the extent possible, minimize some of the custom serial/deserialization patterns.

License

The MIT license applies to all of the artifacts produced and maintained in this repository.

Credits

Dassault Systèmes Euromed CPE

Disclaimer

As described by the associated open source MIT license, this is not an official dassault systèmes product, so, it's not subject, under any circumstance, to official Dassault Systèmes warranty or support.