# OpcServiceResponse Members

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcServiceResponse</a></dd>
<dt>Namespace</dt>
<dd><a href="../namespaces/opc.uafx.services">Opc.UaFx.Services</a></dd>
<dt>Assembly</dt>
<dd>Opc.UaFx.Advanced.dll</dd>
<dt>Package</dt>
<dd>Opc.UaFx.Advanced v2.59.0</dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

## Constructors

### OpcServiceResponse

<span class="api-meta">protected · 3 overloads</span>

| Overload | Description |
|---|---|
| [OpcServiceResponse()](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcserviceresponse/members#opcserviceresponse-noparams)<span class="api-meta">protected</span> | Initializes a new instance of the [OpcServiceResponse](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcserviceresponse/) class using a new header. |
| [OpcServiceResponse(IOpcServiceResponseHeader)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcserviceresponse/members#opcserviceresponse-opc-uafx-services-iopcserviceresponseheader)<span class="api-meta">protected · since v2.7</span> | Initializes a new instance of the [OpcServiceResponse](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcserviceresponse/) class using the specified `header` and no diagnostic information. |
| [OpcServiceResponse(IOpcServiceResponseHeader, DiagnosticInfoCollection)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcserviceresponse/members#opcserviceresponse-opc-uafx-services-iopcserviceresponseheader-opc-ua-diagnosticinfocollection)<span class="api-meta">protected · since v2.7</span> | Initializes a new instance of the [OpcServiceResponse](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcserviceresponse/) class using the specified `header` and `diagnosticInfos`. |

#### OpcServiceResponse()

<span class="api-meta">protected</span>

Initializes a new instance of the [OpcServiceResponse](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcserviceresponse/) class using a new header.

<div class="api-signature" data-lang="csharp">

```csharp
protected OpcServiceResponse()
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Protected Sub New()
```

</div>

#### OpcServiceResponse(IOpcServiceResponseHeader)

<span class="api-meta">protected · since v2.7</span>

Initializes a new instance of the [OpcServiceResponse](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcserviceresponse/) class using the specified `header` and no diagnostic information.

<div class="api-signature" data-lang="csharp">

```csharp
protected OpcServiceResponse(IOpcServiceResponseHeader header)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Protected Sub New(header As IOpcServiceResponseHeader)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `header` | [IOpcServiceResponseHeader](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcserviceresponseheader/) | The header of the response. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `header` is a null reference (Nothing in Visual Basic). |

#### OpcServiceResponse(IOpcServiceResponseHeader, DiagnosticInfoCollection)

<span class="api-meta">protected · since v2.7</span>

Initializes a new instance of the [OpcServiceResponse](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcserviceresponse/) class using the specified `header` and `diagnosticInfos`.

<div class="api-signature" data-lang="csharp">

```csharp
protected OpcServiceResponse(
    IOpcServiceResponseHeader header,
    DiagnosticInfoCollection diagnosticInfos)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Protected Sub New(
    header As IOpcServiceResponseHeader,
    diagnosticInfos As DiagnosticInfoCollection)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `header` | [IOpcServiceResponseHeader](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcserviceresponseheader/) | The header of the response. |
| `diagnosticInfos` | <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.DiagnosticInfoCollection">DiagnosticInfoCollection</abbr> | The diagnostic information of the operations of the service, or a null reference (Nothing in Visual Basic) for none. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `header` is a null reference (Nothing in Visual Basic). |

## Properties

### DiagnosticInfos

<span class="api-meta">since v2.7</span>

Gets the diagnostic information of the operations of the service.

<div class="api-signature" data-lang="csharp">

```csharp
public DiagnosticInfoCollection DiagnosticInfos { get; protected set; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
<CLSCompliant(False)>
Public Property DiagnosticInfos As DiagnosticInfoCollection
```

</div>

**Property value**

<abbr title="OPC Foundation stack type, not documented here: Opc.Ua.DiagnosticInfoCollection">DiagnosticInfoCollection</abbr>

The diagnostic information of the response.

### Exception

<span class="api-meta">since v2.19</span>

Gets the exception which represents the bad result of the service.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcException Exception { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public ReadOnly Property Exception As OpcException
```

</div>

**Property value**

[OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/)

An [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) of the [Result](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcserviceresponseheader/members#result) of the [Header](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcserviceresponse/members#header) if it is bad; otherwise a null reference (Nothing in Visual Basic).

### Header

Gets the header of the response.

<div class="api-signature" data-lang="csharp">

```csharp
public IOpcServiceResponseHeader Header { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public ReadOnly Property Header As IOpcServiceResponseHeader
```

</div>

**Property value**

[IOpcServiceResponseHeader](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcserviceresponseheader/)

The [IOpcServiceResponseHeader](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcserviceresponseheader/) of the response.

**Implements**

[Header](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcserviceresponse/members#header)

### ServiceName

<span class="api-meta">since v2.19</span>

Gets the name of the service of the response.

<div class="api-signature" data-lang="csharp">

```csharp
public string ServiceName { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public ReadOnly Property ServiceName As String
```

</div>

**Property value**

[String](https://learn.microsoft.com/dotnet/api/system.string)

The name of the type of the response without the prefix "Opc" and the suffix "Response" (e.g. "ReadNodes" for [OpcReadNodesResponse](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcreadnodesresponse/)); for a response of a service without a type of its own, the name of the service as defined by OPC UA.

### Success

<span class="api-meta">virtual</span>

Gets a value indicating whether the service succeeded.

<div class="api-signature" data-lang="csharp">

```csharp
public virtual bool Success { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Overridable ReadOnly Property Success As Boolean
```

</div>

**Property value**

[Boolean](https://learn.microsoft.com/dotnet/api/system.boolean)

The value true if the [Result](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcserviceresponseheader/members#result) of the [Header](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcserviceresponse/members#header) is good; otherwise the value false.

**Implements**

[Success](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcserviceresponse/members#success)

**Remarks**

An uncertain result is not a success, but there is no [Exception](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcserviceresponse/members#exception) for it.

## Methods

### CreateHeader

<span class="api-meta">protected · since v2.7</span>

Creates the header of the response using [CreateHeaderCore](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcserviceresponse/members#createheadercore) and assigns it to the response.

<div class="api-signature" data-lang="csharp">

```csharp
protected IOpcServiceResponseHeader CreateHeader()
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Protected Function CreateHeader() As IOpcServiceResponseHeader
```

</div>

**Returns**

[IOpcServiceResponseHeader](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcserviceresponseheader/)

The header created.

### CreateHeaderCore

<span class="api-meta">protected · virtual · since v2.7</span>

When overridden in a derived class, creates the header of the response.

<div class="api-signature" data-lang="csharp">

```csharp
protected virtual IOpcServiceResponseHeader CreateHeaderCore()
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Protected Overridable Function CreateHeaderCore() As IOpcServiceResponseHeader
```

</div>

**Returns**

[IOpcServiceResponseHeader](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcserviceresponseheader/)

The header created. The default implementation returns an [OpcServiceResponseHeader](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcserviceresponseheader/) which represents the header of the response data, or a new [OpcServiceResponseHeader](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcserviceresponseheader/) if the response data does not have a header.

### GetResultExceptions

<span class="api-meta">since v2.19</span>

Retrieves an exception for each bad result of the operations of the service (see [GetResults](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcserviceresponse/members#getresults)).

<div class="api-signature" data-lang="csharp">

```csharp
public IEnumerable<OpcException> GetResultExceptions()
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Function GetResultExceptions() As IEnumerable(Of OpcException)
```

</div>

**Returns**

[IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;[OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/)&gt;

A sequence of an [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) for each bad result; the sequence does not contain an entry for a result which is not bad.

### GetResults

<span class="api-meta">abstract · since v2.19</span>

When overridden in a derived class, retrieves the results of the operations of the service.

<div class="api-signature" data-lang="csharp">

```csharp
public abstract IEnumerable<OpcResult> GetResults()
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public MustOverride Function GetResults() As IEnumerable(Of OpcResult)
```

</div>

**Returns**

[IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;[OpcResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcresult/)&gt;

A sequence of the [OpcResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcresult/) instances of the operations.
