Skip to content

Commit

Permalink
Added Async calls
Browse files Browse the repository at this point in the history
  • Loading branch information
philipwilford committed Jan 29, 2025
1 parent 7fe2360 commit cf5444d
Show file tree
Hide file tree
Showing 72 changed files with 57,298 additions and 1,146 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
### Change Log/Revision History

1.9.0
-----
* Updated packages to highest compatible version
- AutoMapper 6.2.2 --> 7.0.1
- System.ServiceModel.Http 4.9.0 --> 4.10.3

* Async implemtation added.

1.8.2
-----
* Fix order of elements in IHISearch
Expand Down
11 changes: 8 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ file within this repository.

Issues can be used to:

* Report a defect
* Request a new feature or enhancement
* Ask a question
- Report a defect
- Request a new feature or enhancement
- Ask a question

New issues will be automatically populated with a template that highlights the
information that needs to be submitted with an issue that describes a defect. If
Expand All @@ -34,3 +34,8 @@ situations where people are working at cross-purposes.

Before making a contribution, please read the
[code of conduct](CODE_OF_CONDUCT.md).

## Contact us

You can alo raise a query about this code, by emailing:
[[email protected]](mailto:[email protected])
189 changes: 126 additions & 63 deletions src/HI.Sample/ConsumerCreateVerifiedIHIClientSample.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*
* Copyright 2011 NEHTA
*
* Licensed under the NEHTA Open Source (Apache) License; you may not use this
* file except in compliance with the License. A copy of the License is in the
* 'license.txt' file, which should be provided with this work.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
* Copyright 2011 NEHTA
*
* Licensed under the NEHTA Open Source (Apache) License; you may not use this
* file except in compliance with the License. A copy of the License is in the
* 'license.txt' file, which should be provided with this work.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/

using System;
using System.Net;
Expand All @@ -34,6 +34,116 @@ namespace Nehta.VendorLibrary.HI.Sample
class ConsumerCreateVerifiedIHIClientSample
{
public void Sample()
{
// Set up the request
ConsumerCreateVerifiedIHIClient client = CreateClient();

// Set up the request
createVerifiedIHI request = new createVerifiedIHI();
request.dateOfBirth = DateTime.Parse("01 Dec 2014");
request.dateOfBirthAccuracyIndicator = DateAccuracyIndicatorType.AAA;
request.familyName = "Wood";
request.givenName = new[] { "Jessica" };
request.sex = SexType.F;
request.usage = IndividualNameUsageType.L;
request.address = new AddressType();
request.address.australianStreetAddress = new AustralianStreetAddressType();
request.address.australianStreetAddress.streetNumber = "10";
request.address.australianStreetAddress.streetName = "Browning Street";
request.address.australianStreetAddress.streetType = StreetType.ST;
request.address.australianStreetAddress.streetTypeSpecified = true;
request.address.australianStreetAddress.suburb = "West End";
request.address.australianStreetAddress.postcode = "4101";
request.address.australianStreetAddress.state = StateType.QLD;
request.address.purpose = AddressPurposeType.R;
request.address.preferred = TrueFalseType.T;
request.privacyNotification = true;

try
{
// Invokes a basic search
createVerifiedIHIResponse ihiResponse = client.CreateVerifiedIhi(request);
}
catch (FaultException fex)
{
string returnError = "";
MessageFault fault = fex.CreateMessageFault();
if (fault.HasDetail)
{
ServiceMessagesType error = fault.GetDetail<ServiceMessagesType>();
// Look at error details in here
if (error.serviceMessage.Length > 0)
returnError = error.serviceMessage[0].code + ": " + error.serviceMessage[0].reason;
}

// If an error is encountered, client.LastSoapResponse often provides a more
// detailed description of the error.
string soapResponse = client.SoapMessages.SoapResponse;
}
catch (Exception ex)
{
// If an error is encountered, client.LastSoapResponse often provides a more
// detailed description of the error.
string soapResponse = client.SoapMessages.SoapResponse;
}
}

public async void SampleAsync()
{
// Set up the request
ConsumerCreateVerifiedIHIClient client = CreateClient();

// Set up the request
createVerifiedIHI request = new createVerifiedIHI();
request.dateOfBirth = DateTime.Parse("01 Dec 2014");
request.dateOfBirthAccuracyIndicator = DateAccuracyIndicatorType.AAA;
request.familyName = "Wood";
request.givenName = new[] { "Jessica" };
request.sex = SexType.F;
request.usage = IndividualNameUsageType.L;
request.address = new AddressType();
request.address.australianStreetAddress = new AustralianStreetAddressType();
request.address.australianStreetAddress.streetNumber = "10";
request.address.australianStreetAddress.streetName = "Browning Street";
request.address.australianStreetAddress.streetType = StreetType.ST;
request.address.australianStreetAddress.streetTypeSpecified = true;
request.address.australianStreetAddress.suburb = "West End";
request.address.australianStreetAddress.postcode = "4101";
request.address.australianStreetAddress.state = StateType.QLD;
request.address.purpose = AddressPurposeType.R;
request.address.preferred = TrueFalseType.T;
request.privacyNotification = true;

try
{
// Invokes a basic search
createVerifiedIHIResponse ihiResponse = await client.CreateVerifiedIhiAsync(request);
}
catch (FaultException fex)
{
string returnError = "";
MessageFault fault = fex.CreateMessageFault();
if (fault.HasDetail)
{
ServiceMessagesType error = fault.GetDetail<ServiceMessagesType>();
// Look at error details in here
if (error.serviceMessage.Length > 0)
returnError = error.serviceMessage[0].code + ": " + error.serviceMessage[0].reason;
}

// If an error is encountered, client.LastSoapResponse often provides a more
// detailed description of the error.
string soapResponse = client.SoapMessages.SoapResponse;
}
catch (Exception ex)
{
// If an error is encountered, client.LastSoapResponse often provides a more
// detailed description of the error.
string soapResponse = client.SoapMessages.SoapResponse;
}
}

public ConsumerCreateVerifiedIHIClient CreateClient()
{
// ------------------------------------------------------------------------------
// Set up
Expand Down Expand Up @@ -85,64 +195,17 @@ public void Sample()
// ------------------------------------------------------------------------------
// Client instantiation and invocation
// ------------------------------------------------------------------------------

// Instantiate the client
ConsumerCreateVerifiedIHIClient client = new ConsumerCreateVerifiedIHIClient(
var client = new ConsumerCreateVerifiedIHIClient(
new Uri("https://HIServiceEndpoint"),
product,
user,
hpio,
signingCert,
tlsCert);

// Set up the request
createVerifiedIHI request = new createVerifiedIHI();
request.dateOfBirth = DateTime.Parse("01 Dec 2014");
request.dateOfBirthAccuracyIndicator = DateAccuracyIndicatorType.AAA;
request.familyName = "Wood";
request.givenName = new [] {"Jessica"};
request.sex = SexType.F;
request.usage = IndividualNameUsageType.L;
request.address = new AddressType();
request.address.australianStreetAddress = new AustralianStreetAddressType();
request.address.australianStreetAddress.streetNumber = "10";
request.address.australianStreetAddress.streetName = "Browning Street";
request.address.australianStreetAddress.streetType = StreetType.ST;
request.address.australianStreetAddress.streetTypeSpecified = true;
request.address.australianStreetAddress.suburb = "West End";
request.address.australianStreetAddress.postcode = "4101";
request.address.australianStreetAddress.state = StateType.QLD;
request.address.purpose = AddressPurposeType.R;
request.address.preferred = TrueFalseType.T;
request.privacyNotification = true;

try
{
// Invokes a basic search
createVerifiedIHIResponse ihiResponse = client.CreateVerifiedIhi(request);
}
catch (FaultException fex)
{
string returnError = "";
MessageFault fault = fex.CreateMessageFault();
if (fault.HasDetail)
{
ServiceMessagesType error = fault.GetDetail<ServiceMessagesType>();
// Look at error details in here
if (error.serviceMessage.Length > 0)
returnError = error.serviceMessage[0].code + ": " + error.serviceMessage[0].reason;
}

// If an error is encountered, client.LastSoapResponse often provides a more
// detailed description of the error.
string soapResponse = client.SoapMessages.SoapResponse;
}
catch (Exception ex)
{
// If an error is encountered, client.LastSoapResponse often provides a more
// detailed description of the error.
string soapResponse = client.SoapMessages.SoapResponse;
}
return client;
}
}
}
}
Loading

0 comments on commit cf5444d

Please sign in to comment.