Creating FedEx Shipping Documnents using FedEx ship service WSDL - c#

I am in the process of integrating with the FedEx international Ship Service. But I am really stuck on one part. I am trying to create a certificate of origin using their test environment. I have followed the xml schema and have come up with the code below
private static void SetCustomInvoice(ProcessShipmentRequest request)
{
request.RequestedShipment.ShippingDocumentSpecification = new ShippingDocumentSpecification();
request.RequestedShipment.ShippingDocumentSpecification.ShippingDocumentTypes = new RequestedShippingDocumentType[1] { new RequestedShippingDocumentType() };
request.RequestedShipment.ShippingDocumentSpecification.ShippingDocumentTypes[0] = RequestedShippingDocumentType.CERTIFICATE_OF_ORIGIN;
request.RequestedShipment.ShippingDocumentSpecification.CertificateOfOrigin = new CertificateOfOriginDetail();
request.RequestedShipment.ShippingDocumentSpecification.CertificateOfOrigin.DocumentFormat = new ShippingDocumentFormat { StockType = ShippingDocumentStockType.STOCK_4X6, ImageType = ShippingDocumentImageType.PDF, ImageTypeSpecified = true, StockTypeSpecified = true };
request.RequestedShipment.SpecialServicesRequested = new ShipmentSpecialServicesRequested();
request.RequestedShipment.SpecialServicesRequested.SpecialServiceTypes = new ShipmentSpecialServiceType[1] { new ShipmentSpecialServiceType() };
request.RequestedShipment.SpecialServicesRequested.SpecialServiceTypes[0] = ShipmentSpecialServiceType.ELECTRONIC_TRADE_DOCUMENTS;
request.RequestedShipment.SpecialServicesRequested.EtdDetail = new EtdDetail();
request.RequestedShipment.SpecialServicesRequested.EtdDetail.RequestedDocumentCopies = new RequestedShippingDocumentType[1] { RequestedShippingDocumentType.CERTIFICATE_OF_ORIGIN };
request.RequestedShipment.SpecialServicesRequested.EtdDetail.DocumentReferences = new UploadDocumentReferenceDetail[1] { new UploadDocumentReferenceDetail() };
request.RequestedShipment.SpecialServicesRequested.EtdDetail.RequestedDocumentCopies[0] = RequestedShippingDocumentType.CERTIFICATE_OF_ORIGIN;
}
But I keep getting an error message back from the web service stating “Invalid Stock Type”. Even though the shipmentDocumentStockType is an enum and I am using one of the values from it. I am still getting this error. Any ideas where I might be going wrong?
Any information will be a great help. I have tried getting in touch with FedEx technical support and they were not really a great help.

This might be a little late for you but just wanted to provide an answer in case someone else might be looking for it.
I was having a similar problem but instead of the Certificate of Origin it was with the Commercial Invoice. Turns out these forms need to be printed on a full 8.5 x 11 page in PDF format, so changing the StockType from STOCK_4x6 to PAPER_LETTER fixed it for me:
From:
request.RequestedShipment.ShippingDocumentSpecification.CertificateOfOrigin.DocumentFormat = new ShippingDocumentFormat { StockType = ShippingDocumentStockType.STOCK_4X6, ImageType = ShippingDocumentImageType.PDF, ImageTypeSpecified = true, StockTypeSpecified = true };
To:
request.RequestedShipment.ShippingDocumentSpecification.CertificateOfOrigin.DocumentFormat = new ShippingDocumentFormat { StockType = ShippingDocumentStockType.PAPER_LETTER, ImageType = ShippingDocumentImageType.PDF, ImageTypeSpecified = true, StockTypeSpecified = true };
Hope this helps

Related

can we set activity type in c#

I want to change the "Playing a game" to "Listening music" or some other stuff, I tried to google it but didnt got any results
so if yall could help it would be great thank you
client = new DiscordRpcClient("961726309740970065");
client.Logger = new ConsoleLogger() { Level = LogLevel.Warning };
client.Initialize();
client.SetPresence(new RichPresence()
{
Details = "Using the greatest exploit available in the whole galaxy",
Timestamps = Timestamps.Now,
State = "Slobby ",
Assets = new Assets()
{
LargeImageText = "Download the god of exploits(Slobby Xploits)",
LargeImageKey = "slxp"
},
Buttons = new DiscordRPC.Button[]
{
new DiscordRPC.Button() { Label = "Download Slobby Xploits", Url = "https://direct-link.net/414115/gateway-to-heaven" },
new DiscordRPC.Button() { Label = "Join our Discord", Url = "https://discord.gg/WaTuKge4kC" }
}
});
I don't know if you've already fixed that, but it's actually very easy to do:
Type = ActivityType.Playing // Changes the activity to 'Listening to music'
The enum contains all activity types for the discord rich presence.
Hope it helps :)

QlikView Management API erroring when including distribute

Hi I have created a task using the QMS API and have had success populating all general, reload, and reduce tabs but I am now having trouble when working with the distribute category. I'm trying to "Distribute to QlikView Server " and add a view users to distribute to. Except whenever I include distribute in the DocumentTaskScope (DocumentTaskScope.Distribute), the task seems to lose reference to the SourceDocument and the reduce category gets wiped, along with options from general and reload being lost. This is indicated by this dialog appearing when I click manage users when on the distribute tab.
Also here is what my distribute panel actually looks like, as you can see it is missing the "Distribute to QlikView Server" area that should normally be there:
Here is my code for the distribute section, I am writing this program in c# and the program builds and executes with no errors, it just doesn't produce the intended result.
I was thinking if it had something to do with the server name syntax or if the ID member. The documentation indicated that this is meant to be the "The ID of the QlikView Server. ", so I used the id of the qlikview service but I am not certain this is what it is looking for.
//Distribute static ("Manually" in QV Management Console)
DocumentTask.TaskDistribute.TaskDistributeStatic tds = new DocumentTask.TaskDistribute.TaskDistributeStatic();
TaskDistributionDestination.TaskDistributionDestinationQlikViewServer tddqvs = new TaskDistributionDestination.TaskDistributionDestinationQlikViewServer();
tddqvs.Name = "QVS#qlikviewdev";
tddqvs.Mount = "Root Folder";
tddqvs.ID = qvsGuid;
TaskDistributionEntry newEntry = new TaskDistributionEntry();
newEntry.Destination = new TaskDistributionDestination();
TaskDistributionDestination tdd = new TaskDistributionDestination();
TaskDistributionDestinationType tddt = new TaskDistributionDestinationType();
tddt = TaskDistributionDestinationType.QlikViewServer;
newEntry.Destination.Type = tddt;
newEntry.Destination.QlikViewServer = tddqvs;
TaskDistributionDestination.TaskDistributionDestinationFolder tddf = new TaskDistributionDestination.TaskDistributionDestinationFolder();
tddf.Name = "N/A";
newEntry.Destination.Folder = tddf;
DirectoryServiceObject[] serviceObject = new DirectoryServiceObject[2];
DirectoryServiceObject dso1 = new DirectoryServiceObject();
DirectoryServiceObject dso2 = new DirectoryServiceObject();
dso1.Name = "QlikView_Admin";
dso1.Type = DirectoryServiceObjectType.Named;
dso1.OtherProperty = "N/A";
dso2.Name = "Qlikview_PowerUser";
dso2.Type = DirectoryServiceObjectType.Named;
dso2.OtherProperty = "N/A";
serviceObject[0] = dso1;
serviceObject[1] = dso2;
newEntry.Recipients = serviceObject;
TaskDistributionEntry[] tdeArray = new TaskDistributionEntry[1];
tdeArray[0] = newEntry;
tds.DistributionEntries = tdeArray;
docTask.Distribute = new DocumentTask.TaskDistribute();
docTask.Distribute.Static = tds;
DocumentTask.TaskDistribute.TaskDistributeDynamic taskDistributeDynamic = new DocumentTask.TaskDistribute.TaskDistributeDynamic();
taskDistributeDynamic.Destinations = new List<TaskDistributionDestination>().ToArray();
taskDistributeDynamic.FieldName = string.Empty;
taskDistributeDynamic.IdentityType = UserIdentityValueType.DisplayName;
docTask.Distribute.Dynamic = taskDistributeDynamic;
DocumentTask.TaskDistribute.TaskDistributeNotification tdn = new DocumentTask.TaskDistribute.TaskDistributeNotification();
tdn.SendNotificationEmail = false;
docTask.Distribute.Notification = tdn;
DocumentTask.TaskDistribute.TaskDistributeOutput tdo = new DocumentTask.TaskDistribute.TaskDistributeOutput();
tdo.Type = TaskDistributionOutputType.QlikViewDocument;
docTask.Distribute.Output = tdo;
Turns out I was using the wrong GUID for the TaskDistributionDestinationQlikViewServer Objects' ID field. Once I set it to be the ID of the QVS#(servername) service, it worked.

Running a TuesPechkin converter more than once

I'm using TuesPechkin for my web application, which I'm testing locally on IIS with VS2013. The user clicks a button and the page's current HTML is saved to a PDF file, which is then emailed out. This process is going to be run regularly as the site's data changes.
When converter.Convert(document) first runs, it converts without problem. Every subsequent attempt, however, results in the process hanging and me needing to restart VS.
Below is some default code I've been using to test.
public void MakePDF()
{
var document = new HtmlToPdfDocument
{
GlobalSettings =
{
ProduceOutline = true,
DocumentTitle = "Pretty Websites",
PaperSize = PaperKind.A4, // Implicit conversion to PechkinPaperSize
Margins =
{
All = 1.375,
Unit = TuesPechkin.Unit.Centimeters
}
},
Objects = {
new ObjectSettings { HtmlText = "<h1>Pretty Websites</h1><p>This might take a bit to convert!</p>" }
}
};
IConverter converter =
new ThreadSafeConverter(
new PdfToolset(
new Win32EmbeddedDeployment(
new TempFolderDeployment())));
byte[] result = converter.Convert(document);
}
Can anyone point me in the right direction on this? Most of my troubleshooting so far has led to some discussions on threading and pooling, but no concrete code solutions for running TuesPechkin more than once.
Have you tried the ThreadSafeConverter? The StandardConverter is only suitable for small console apps.
IConverter converter =
new ThreadSafeConverter(
new RemotingToolset<PdfToolset>(
new Win32EmbeddedDeployment(
new TempFolderDeployment())));
byte[] result = converter.Convert(document);
Note that you should keep the converter somewhere static, or as a singleton instance (as mentioned here).
Since this app on IIS, could get singleton converter, and use RemotingToolset
var toolSet = new RemotingToolset<PdfToolset>(winAnyCpuEmbeddedDeployment);
// Then
using TuesPechkin.Wkhtmltox.AnyCPU;
...
var converter = PDFHelper.Factory.GetConverter();
var result = converter.Convert(This.Document);
Reference : https://github.com/tloy1966/TuesPechkin

exacttarget preform automation

I'm trying to trigger an automation on ExactTarget using SOAP in .net in C#
so far i have found the examples page help.exacttarget.com/en-GB/technical_library/web_service_guide/technical_articles/interacting_with_automation_studio_via_the_web_service_soap_api/
which says var performResponse = soapClient.Perform(performRequest);
however soapClient.Perform dose not take a singe agument.
what i have so far is this
Automation automation = new Automation();
PerformOptions options = new PerformOptions();
automation.CustomerKey = "53ba121d-2934-90d6-d86d-e0662c656165";
automation.ScheduledTime = DateTime.Now;
automation.ScheduledTimeSpecified = true;
automation.IsActive = true;
automation.AutomationSource = new AutomationSource()
{
AutomationSourceID = Guid.NewGuid().ToString(),
AutomationSourceType = "RestAPI"
};
automation.Notifications = new AutomationNotification[0];
// automation.ObjectID = "7d88eb5b-80ea-43bb-97b2-4067aaa19c35";
automation.PartnerProperties = new APIProperty[0] { };
// automation.PartnerKey = "53ba121d-2934-90d6-d86d-e0662c656165";
string sA;
string sB;
string sC;
PerformResult[] steve = soapClient.Perform(new PerformOptions(),
"start", new APIObject[] { automation }, out sA, out sB, out sC);
can anyone give me a hand or show me a simple example
thanks.
I'm using mainly Java to interact with ET but I can provide you some hints:
try to create automation first
if automation already exists try to find it/retrieve it
you can pass this retrieved object to Perform method
I think that if object already exists then CustomerKey should be sufficient for your needs, you don't need to specify nothing more.

The format of the URI could not be determined - c#

I'm having following code which runs perfectly on dev server but gives error on live server.
It gives me following error
System.UriFormatException: Invalid URI: The format of the URI could not be determined.
Please guide me how to resolve this issue.
<-----------------Code Started--------------------->
private void InsertThrAPI(clsProductProp objProductProp)
{
xmldata data = new xmldata();
data.Items = new xmldataProducts[1];
data.Items[0] = new xmldataProducts();
objProduct.stockstatus = Convert.ToString(objProductProp.stockstatus);
objProduct.price = Convert.ToString(objProductProp.price);
objProduct.productname = Convert.ToString(objProductProp.productname);
objProduct.productshortname = Convert.ToString(objProductProp.productshortname);
objProduct.productcode = Convert.ToString(objProductProp.productcode);
objProduct.description = Convert.ToString(objProductProp.description);
objProduct.technicalspecs = Convert.ToString(objProductProp.technicalspecs);
objProduct.shippingcost = Convert.ToString(objProductProp.shippingcost);
objProduct.productweight = Convert.ToString(objProductProp.productweight);
objProduct.vendorprice = Convert.ToString(objProductProp.vendorprice);
if (objProductProp.shipping == true || objProductProp.shipping == Convert.ToBoolean(1))
{
objProduct.shipping = "Y";
}
else
{
objProduct.shipping = "N";
}
//Populate the product fields here
data.Items[0].StockStatus = objProduct.stockstatus;
data.Items[0].ProductPrice = objProduct.price;
data.Items[0].ProductName = objProduct.productname;
data.Items[0].ProductNameShort = objProduct.productshortname;
data.Items[0].ProductCode = objProduct.productcode;
data.Items[0].ProductDescription = objProduct.description;
data.Items[0].TechSpecs = objProduct.technicalspecs;
data.Items[0].FreeShippingItem = objProduct.shipping;
data.Items[0].Fixed_ShippingCost = objProduct.shippingcost;
data.Items[0].ProductWeight = objProduct.productweight;
data.Items[0].Vendor_Price = objProduct.vendorprice;
string productXML = Utils.GetProductXML(data);
string APIURL = Utils.GetAPIPostURL(ImportMode.Insert);
XMLPostManager manager = new XMLPostManager();
string response = manager.SendXMLToURL(APIURL, productXML);
//Response.Write(response);
}
We would need to see the URL to tell you what's wrong with it, but you can check to make sure that the URL is valid like this:
if (Uri.IsWellFormedUriString(APIURL, UriKind.RelativeOrAbsolute))
{
//url is valid
}
Please guide me how to resolve this issue.
I guess you main problem is that this only happens in live and not in your dev system, so debugging is hard?
A couple of suggestion:
Look in to adding logging code - there's a lot of info out there, but
something like Log4Net would be a good start. Add logging code
to this method and you should hopefully see the data that is causing
issues.
See if you can add more realistic data to your unit tests or
other internal tests and see if you can spot this.

Categories

Resources