ORU_R01_OBSERVATION observation = orderObservation.GetOBSERVATION(0);
OBX obx = observation.OBX;
obx.ValueType.Value = "AD";
obx.ObservationIdentifier.Identifier.Value = "Report";
obx.ObservResultStatus.Value = "F";
Here i want to add the OBX-5 Observation Value. How can i add this ?
I know this is a very late answer but I hope it can help someone in future. This is how I set my OBX segment value.
ORU_R01 oru = new ORU_R01();
ORU_R01_ORDER_OBSERVATION orderObservation = oru.GetRESPONSE().GetORDER_OBSERVATION();
OBX obx = orderObservation.GetOBSERVATION(0).OBX;
obx.ValueType.Value = "AD";
obx.ObservationIdentifier.Identifier.Value = "Report";
obx.ObservResultStatus.Value = "F";
CE ce = new CE(oru);
ce.Identifier.Value = obv.ObservationValue;
Varies value = obx.GetObservationValue(0);
value.Data = ce;
Hope this helps.
This is the code that originally pointed to by #hardrada :
this is a late answer because i've been trying to find something like this myself recently, and I feel there aren't enough HL7 examples about
it was found via the wayback machine here :
http://web.archive.org/web/20130318202508/http://www.ecomb.ch/nhapi-example-for-creating-a-hl7-message-with-msh-pid-pv1-obr-and-obx-segment/
private string createHL7()
{
ORU_R01 oruR01 = new ORU_R01();
ORU_R01_ORDER_OBSERVATION orderObservation = oruR01.GetRESPONSE().GetORDER_OBSERVATION();
ORU_R01_PATIENT patient = oruR01.GetRESPONSE().PATIENT;
ORU_R01_VISIT visit = patient.VISIT;
PV1 pv1 = visit.PV1;
OBR obr = orderObservation.OBR;
ORU_R01_OBSERVATION observation = orderObservation.GetOBSERVATION(0);
OBX obx = observation.OBX;
oruR01.MSH.FieldSeparator.Value = "|";
oruR01.MSH.EncodingCharacters.Value = #"^~\&";
oruR01.MSH.SendingApplication.NamespaceID.Value = "SP";
oruR01.MSH.SendingFacility.NamespaceID.Value = "SPZH";
oruR01.MSH.ReceivingApplication.NamespaceID.Value = "MF";
oruR01.MSH.ReceivingFacility.NamespaceID.Value = "INTRA";
oruR01.MSH.DateTimeOfMessage.TimeOfAnEvent.SetLongDate(DateTime.Now);
oruR01.MSH.ProcessingID.ProcessingID.Value = "P";
oruR01.MSH.VersionID.Value = "2.3";
PID pid = oruR01.GetRESPONSE().PATIENT.PID;
pid.SetIDPatientID.Value = "12345";
pid.PatientName.FamilyName.Value = "Joe";
pid.PatientName.GivenName.Value = "Bloggs";
pid.DateOfBirth.TimeOfAnEvent.SetLongDate(DateTime.MinValue);
pid.Sex.Value = "M";
pv1.SetIDPatientVisit.Value = "1";
pv1.VisitNumber.ID.Value = "3333333";
obr.FillerOrderNumber.UniversalID.Value = "123456";
obr.UniversalServiceIdentifier.Text.Value = "Document";
obr.ObservationEndDateTime.TimeOfAnEvent.SetLongDate(DateTime.Now);
obr.ResultStatus.Value = "F";
obx.SetIDOBX.Value = "0";
obx.ValueType.Value = "RP";
obx.ObservationIdentifier.Identifier.Value = "Report";
PipeParser parser = new PipeParser();
string encodedMessage = parser.Encode(oruR01);
return encodedMessage;
}
Related
I'm trying to generate a checkbox from C#.net using google sheets API but I'm encountering the oneof field kind is already set error. I tried combining extendedValue and DataValidation. Please see code snippet below:
ConditionValue conditionValueTrue = new ConditionValue();
conditionValueTrue.UserEnteredValue = "TRUE";
ConditionValue conditionValueFalse = new ConditionValue();
conditionValueFalse.UserEnteredValue = "FALSE";
ConditionValue[] validValues = { conditionValueTrue, conditionValueFalse };
BooleanCondition bc = new BooleanCondition();
bc.Type = "BOOLEAN";
bc.Values = validValues;
DataValidationRule dataValidationRule = new DataValidationRule();
dataValidationRule.Condition = bc;
dataValidationRule.ShowCustomUi = true;
GridRange validationRange = new GridRange();
validationRange.StartColumnIndex = 7;
validationRange.EndColumnIndex = 7;
validationRange.SheetId = 0;
SetDataValidationRequest setDataValidationRequest = new SetDataValidationRequest();
setDataValidationRequest.Rule = dataValidationRule;
setDataValidationRequest.Range = validationRange;
ExtendedValue extendedValue = new ExtendedValue();
extendedValue.BoolValue = true;
BatchUpdateSpreadsheetRequest busr = new BatchUpdateSpreadsheetRequest();
busr.Requests = new List<Request>();
Request r = new Request();
busr.Requests.Add(r);
r.UpdateCells = new UpdateCellsRequest();
r.SetDataValidation = setDataValidationRequest;
var gc = new GridCoordinate();
gc.ColumnIndex = 7;
gc.RowIndex = row;
gc.SheetId = 0;
r.UpdateCells.Start = gc;
r.UpdateCells.Fields = "*";
r.UpdateCells.Rows = new List<RowData>();
var rd = new RowData();
r.UpdateCells.Rows.Add(rd);
rd.Values = new List<CellData>();
var cd = new CellData();
cd.UserEnteredValue = extendedValue;
rd.Values.Add(cd);
SpreadsheetsResource.BatchUpdateRequest bur = _sheetsService.Spreadsheets.BatchUpdate(busr, SpreadsheetId);
bur.Execute();
I am trying to get the UPS Rating API that now supports Time In Transit to work. I have the latest WSDL (UPS API). I keep getting an exception error "An exception has been raised as a result of client data." and I can not figure out what is the problem. Note: The "Rate" requestOption works with no issues - when TimeinTransit and DeliveryInformation data is commented out.
What could be wrong? Any help would be appreciated, thank you.
Here is my C# code:
UPSRateWS.RequestType request = new UPSRateWS.RequestType();
String[] requestOption = { "ratetimeintransit" };
request.RequestOption = requestOption;
request.SubVersion = "1601";
rateRequest.Request = request;
UPSRateWS.ShipmentType shipment = new UPSRateWS.ShipmentType();
UPSRateWS.ShipperType shipper = new UPSRateWS.ShipperType();
UPSRateWS.ShipmentRatingOptionsType shipmentRatingOptions = new
UPSRateWS.ShipmentRatingOptionsType();
shipmentRatingOptions.NegotiatedRatesIndicator = "";
shipmentRatingOptions.RateChartIndicator = "";
shipment.ShipmentRatingOptions = shipmentRatingOptions;
UPSRateWS.TimeInTransitRequestType timeInTransit = new
UPSRateWS.TimeInTransitRequestType();
UPSRateWS.PickupType pickupInTransitType = new UPSRateWS.PickupType();
pickupInTransitType.Date = "20170414";
pickupInTransitType.Time = "1630";
timeInTransit.Pickup = pickupInTransitType;
timeInTransit.PackageBillType = "02";
shipment.NumOfPieces = "1";
shipment.DeliveryTimeInformation = timeInTransit;
UPSRateWS.ShipmentWeightType shipWeightType = new
UPSRateWS.ShipmentWeightType();
shipWeightType.Weight = "10.80";
UPSRateWS.CodeDescriptionType shipWeightUOM = new
UPSRateWS.CodeDescriptionType();
shipWeightUOM.Code = "LBS";
shipWeightUOM.Description = "pounds";
shipWeightType.UnitOfMeasurement = shipWeightUOM;
shipment.ShipmentTotalWeight = shipWeightType;
shipper.ShipperNumber = "XXXXXX";
UPSRateWS.AddressType shipperAddress = new UPSRateWS.AddressType();
string testAddr = "7650 Tyler Blvd";
String[] addressLine = { testAddr };
shipperAddress.AddressLine = addressLine;
shipperAddress.City = "Mentor";
shipperAddress.PostalCode = "44060";
shipperAddress.StateProvinceCode = "OH";
shipperAddress.CountryCode = "US";
shipperAddress.AddressLine = addressLine;
shipper.Address = shipperAddress;
shipment.Shipper = shipper;
UPSRateWS.ShipFromType shipFrom = new UPSRateWS.ShipFromType();
UPSRateWS.ShipAddressType shipFromAddress = new UPSRateWS.ShipAddressType();
string testAddr2 = "";
String[] addressLine1 = { testAddr2 };
shipFromAddress.AddressLine = addressLine1;
shipFromAddress.City = "";
shipFromAddress.PostalCode = "45069";
shipFromAddress.StateProvinceCode = "OH";
shipFromAddress.CountryCode = "US";
shipFrom.Address = shipFromAddress;
shipment.ShipFrom = shipFrom;
UPSRateWS.ShipToType shipTo = new UPSRateWS.ShipToType();
UPSRateWS.ShipToAddressType shipToAddress = new UPSRateWS.ShipToAddressType();
string testAddr3 = "7650 Tyler Blvd";
String[] addressLine2 = { testAddr3 };
shipToAddress.AddressLine = addressLine2;
shipToAddress.City = "Mentor";
shipToAddress.PostalCode = "44060";
shipToAddress.StateProvinceCode = "OH";
shipToAddress.CountryCode = "US";
shipToAddress.ResidentialAddressIndicator = "1";
shipTo.Address = shipToAddress;
shipment.ShipTo = shipTo;
UPSRateWS.CodeDescriptionType service = new UPSRateWS.CodeDescriptionType();
service.Code = "03";
shipment.Service = service;
UPSRateWS.PackageType package = new UPSRateWS.PackageType();
UPSRateWS.PackageWeightType packageWeight = new UPSRateWS.PackageWeightType();
packageWeight.Weight = "10.80";
UPSRateWS.CodeDescriptionType uom = new UPSRateWS.CodeDescriptionType();
uom.Code = "LBS";
uom.Description = "pounds";
packageWeight.UnitOfMeasurement = uom;
package.PackageWeight = packageWeight;
UPSRateWS.CodeDescriptionType packType = new UPSRateWS.CodeDescriptionType();
packType.Code = "02";
package.PackagingType = packType;
UPSRateWS.PackageServiceOptionsType packServType = new
UPSRateWS.PackageServiceOptionsType();
UPSRateWS.InsuredValueType insuredValueType = new UPSRateWS.InsuredValueType();
insuredValueType.CurrencyCode = "USD";
insuredValueType.MonetaryValue = "65.75";
packServType.DeclaredValue = insuredValueType;
UPSRateWS.ShipperDeclaredValueType shipperDeclaredValueType = new
UPSRateWS.ShipperDeclaredValueType();
shipperDeclaredValueType.CurrencyCode = "USD";
shipperDeclaredValueType.MonetaryValue = "65.75";
packServType.ShipperDeclaredValue = shipperDeclaredValueType;
package.PackageServiceOptions = packServType;
UPSRateWS.PackageType[] pkgArray = { package };
shipment.Package = pkgArray;
rateRequest.Shipment = shipment;
UPSRateWS.CodeDescriptionType pickupType = new UPSRateWS.CodeDescriptionType();
pickupType.Code = "01";
pickupType.Description = "Daily Pickup";
rateRequest.PickupType = pickupType;
UPSRateWS.RateResponse rateResponse = myRatePortTypeClient.ProcessRate(upss,
rateRequest);
You need to include both the "rate" option and the "ratetimeintransit" options:
String[] requestOption = { "rate","ratetimeintransit" };
I'm trying to work with the UPS api to create a shipping label. The UPS api uses a webservice to send an XML request to UPS. UPS then sends a response back. Here is my question.
Is there a way to view the XML that is outputted when I call the "shipmentRequest" method?
This is the first time I've used an API and a webservice so if you need me to provide more information just let me know.
Thanks!
EDIT: Here is my C# code
ShipService shpSvc = new ShipService();
ShipmentRequest shipmentRequest = new ShipmentRequest();
UPSSecurity upss = new UPSSecurity();
//shpSvc.Url = "https://onlinetools.ups.com/webservices/Ship";
UPSSecurityServiceAccessToken upssSvcAccessToken = new UPSSecurityServiceAccessToken();
upssSvcAccessToken.AccessLicenseNumber = apiCode;
upss.ServiceAccessToken = upssSvcAccessToken;
UPSSecurityUsernameToken upssUsrNameToken = new UPSSecurityUsernameToken();
upssUsrNameToken.Username = userName;
upssUsrNameToken.Password = password;
upss.UsernameToken = upssUsrNameToken;
shpSvc.UPSSecurityValue = upss;
RequestType request = new RequestType();
String[] requestOption = { "nonvalidate" };
request.RequestOption = requestOption;
shipmentRequest.Request = request;
ShipmentType shipment = new ShipmentType();
shipment.Description = "Ship webservice example";
ShipperType shipper = new ShipperType();
shipper.ShipperNumber = accountNumber;
PaymentInfoType paymentInfo = new PaymentInfoType();
ShipmentChargeType shpmentCharge = new ShipmentChargeType();
BillShipperType billShipper = new BillShipperType();
billShipper.AccountNumber = accountNumber;
shpmentCharge.BillShipper = billShipper;
shpmentCharge.Type = "01";
ShipmentChargeType[] shpmentChargeArray = { shpmentCharge };
paymentInfo.ShipmentCharge = shpmentChargeArray;
shipment.PaymentInformation = paymentInfo;
ShipWSSample.ShipWebReference.ShipAddressType shipperAddress = new ShipWSSample.ShipWebReference.ShipAddressType();
String[] addressLine = { "480 Parkton Plaza" };
shipperAddress.AddressLine = addressLine;
shipperAddress.City = "Timonium";
shipperAddress.PostalCode = "21093";
shipperAddress.StateProvinceCode = "MD";
shipperAddress.CountryCode = "US";
shipperAddress.AddressLine = addressLine;
shipper.Address = shipperAddress;
shipper.Name = "ABC Associates";
shipper.AttentionName = "ABC Associates";
ShipPhoneType shipperPhone = new ShipPhoneType();
shipperPhone.Number = "1234567890";
shipper.Phone = shipperPhone;
shipment.Shipper = shipper;
ShipFromType shipFrom = new ShipFromType();
ShipWSSample.ShipWebReference.ShipAddressType shipFromAddress = new ShipWSSample.ShipWebReference.ShipAddressType();
String[] shipFromAddressLine = { "Ship From Street" };
shipFromAddress.AddressLine = addressLine;
shipFromAddress.City = "Timonium";
shipFromAddress.PostalCode = "21093";
shipFromAddress.StateProvinceCode = "MD";
shipFromAddress.CountryCode = "US";
shipFrom.Address = shipFromAddress;
shipFrom.AttentionName = "Mr.ABC";
shipFrom.Name = "ABC Associates";
shipment.ShipFrom = shipFrom;
ShipToType shipTo = new ShipToType();
ShipToAddressType shipToAddress = new ShipToAddressType();
String[] addressLine1 = { "Some Street" };
shipToAddress.AddressLine = addressLine1;
shipToAddress.City = "Roswell";
shipToAddress.PostalCode = "30076";
shipToAddress.StateProvinceCode = "GA";
shipToAddress.CountryCode = "US";
shipTo.Address = shipToAddress;
shipTo.AttentionName = "DEF";
shipTo.Name = "DEF Associates";
ShipPhoneType shipToPhone = new ShipPhoneType();
shipToPhone.Number = "1234567890";
shipTo.Phone = shipToPhone;
shipment.ShipTo = shipTo;
ServiceType service = new ServiceType();
service.Code = "01";
shipment.Service = service;
PackageType package = new PackageType();
PackageWeightType packageWeight = new PackageWeightType();
packageWeight.Weight = "1";
ShipUnitOfMeasurementType uom = new ShipUnitOfMeasurementType();
uom.Code = "LBS";
packageWeight.UnitOfMeasurement = uom;
package.PackageWeight = packageWeight;
PackagingType packType = new PackagingType();
packType.Code = "02";
package.Packaging = packType;
PackageType[] pkgArray = { package };
shipment.Package = pkgArray;
LabelSpecificationType labelSpec = new LabelSpecificationType();
LabelStockSizeType labelStockSize = new LabelStockSizeType();
labelStockSize.Height = "6";
labelStockSize.Width = "4";
labelSpec.LabelStockSize = labelStockSize;
LabelImageFormatType labelImageFormat = new LabelImageFormatType();
labelImageFormat.Code = "SPL";
labelSpec.LabelImageFormat = labelImageFormat;
shipmentRequest.LabelSpecification = labelSpec;
shipmentRequest.Shipment = shipment;
ShipmentResponse shipmentResponse = shpSvc.ProcessShipment(shipmentRequest);
MessageBox.Show("The transaction was a " + shipmentResponse.Response.ResponseStatus.Description);
MessageBox.Show("The 1Z number of the new shipment is " + shipmentResponse.ShipmentResults.ShipmentIdentificationNumber);
You can inherit from the UPS service and read the response as xml by providing your own XmlWriter by overriding GetWriterForMessage(). You can see a working example here.
i am using this code display xml it may help you.
XDocument mySourceDoc = new XDocument();
mySourceDoc = XDocument.Load(shipmentResponse);
txtxml.Text = mySourceDoc.ToString();
I am working on Expedia hotel API.All the function are working except booking.All the other request using GET method for requesting.But in booking we have to use the POST method with different URL.So i changed the URL for request but still getting the error.
My codes are
HotelServicesImplService client = new HotelServicesImplService();
HotelRoomReservationRequest bookreq = new HotelRoomReservationRequest();
HotelRoomReservationResponse bookres = new HotelRoomReservationResponse();
addressInfo bookad = new addressInfo();
reservationInfo bookinfo = new reservationInfo();
client.Url = "https://book.api.ean.com/ean-services/rs/hotel/v3";
//bookreq.minorRevSpecified = true;
//bookreq.minorRev = 25;
bookreq.hotelId = 106347;
bookreq.apiKey = "api";
bookreq.cid = "cid";
bookreq.arrivalDate = "12/11/2013";
bookreq.departureDate = "12/13/2013";
bookreq.supplierType = SupplierType.E;
bookreq.rateKey = "af00b688-acf4-409e-8bdc-fcfc3d1cb80c";
bookreq.roomTypeCode = "198058";
bookreq.rateCode = "484072";
bookreq.RoomGroup = new[] { new Room
{
numberOfAdults=Convert.ToInt32(2),
numberOfChildren=Convert.ToInt32(0),
childAges=new int[] {} ,
firstName="Test Booking",
lastName="Test Booking",
bedTypeId="23",
smokingPreference=SmokingPreference.NS,
}};
float i = float.Parse("231.18");
bookreq.currencyCode = "USD";
bookreq.chargeableRate = i;
bookinfo.email = "ranaabhi007#yahoo.com";
bookinfo.firstName = "TestBooking";
bookinfo.lastName = "TestBooking";
bookinfo.homePhone = "2145370159";
bookinfo.workPhone = "2145370159";
bookinfo.creditCardType = "CA";
bookinfo.creditCardNumber = "5401999999999999";
bookinfo.creditCardIdentifier = "TestBooking";
bookinfo.creditCardExpirationMonth = "12";
bookinfo.creditCardExpirationYear = "2015";
bookad.city = "Seattle";
bookad.stateProvinceCode = "WA";
bookad.countryCode = "US";
bookad.postalCode = "98004";
bookreq.ReservationInfo = bookinfo;
bookad.address1 = "travelnow";
//bookad.city = txtCity.Text;
//bookad.stateProvinceCode = txtState.Text;
//bookad.countryCode = txtCountry.Text;
//bookad.postalCode = txtPostal.Text;
bookreq.AddressInfo = bookad;
bookres = client.getReservation(bookreq);
// HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(client);
Response.Write(bookres.confirmationNumbers);
Response.Write(bookres.departureDate);
Response.Write(bookres.drivingDirections);
Response.Write(bookres.CouponInformationResponse);
but i am still getting the error
The request failed with HTTP status 404: Not Found.
Are you sure your URL is correct? According to the documentation, it should be
https://book.api.ean.com/ean-services/rs/hotel/v3/res
This function is supposed to add a new defect on HPQC. However it gives an "Value does not fall within the expected range" when null is in the .addItem(). Does anyone know what might be the problem?
public static void addBug()
{
String qcUrl = "LINK TO HPQC";
String qcDomain = "DOMAIN";
String qcProject = "PROJECT";
String qcLoginName = "NAME";
String qcPassword = "PASS";
TDConnection connection = new TDConnection();
connection.InitConnectionEx(qcUrl);
connection.ConnectProjectEx(qcDomain, qcProject, qcLoginName, qcPassword);
BugFactory bugFactory = connection.BugFactory;
Bug bug = bugFactory.AddItem(null);
bug.Status = "New";
bug.Project = "QCIntegration";
bug.Summary = "Short description of the bug";
bug.DetectedBy = "Aaron Evans";
bug.AssignedTo = "Nobody";
bug.Priority = "Low";
bug.Post();
}