Does anyone have an example on how to use the ups xml api for rating package shipments? [closed] - python-3.2

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I saw a few examples when using php or python 2.7 but not python 3.2.
Thanks in advance!

Came up with this...
import urllib.request, urllib.error
data ="""
<?xml version="1.0" ?>
<AccessRequest xml:lang="en-US">
<AccessLicenseNumber>XXXXX</AccessLicenseNumber>
<UserId>XXXX</UserId>
<Password>XXXXX</Password>
</AccessRequest>
<?xml version="1.0" ?>
<RatingServiceSelectionRequest xml:lang="en-US">
<Request>
<TransactionReference>
<CustomerContext>Bare Bones Rate Request</CustomerContext>
<XpciVersion>1.0</XpciVersion>
</TransactionReference>
<RequestAction>Rate</RequestAction>
<RequestOption>Rate</RequestOption>
</Request>
<PickupType>
<Code>01</Code>
</PickupType>
<Shipment>
<Shipper>
<Address>
<PostalCode>44111</PostalCode>
<StateProvinceCode>OH</StateProvinceCode>
<CountryCode>US</CountryCode>
</Address>
</Shipper>
<ShipTo>
<Address>
<PostalCode>74403</PostalCode>
<StateProvinceCode>OK</StateProvinceCode>
<CountryCode>US</CountryCode>
<ResidentialAddressIndicator/>
</Address>
</ShipTo>
<ShipFrom>
<Address>
<PostalCode>44023</PostalCode>
<StateProvinceCode>OH</StateProvinceCode>
<City>Chagrin Falls</City>
<CountryCode>US</CountryCode>
</Address>
</ShipFrom>
<Service>
<Code>03</Code>
</Service>
<Package>
<PackagingType>
<Code>02</Code>
</PackagingType>
<Dimensions>
<UnitOfMeasurement>
<Code>IN</Code>
</UnitOfMeasurement>
<Length>8.0</Length>
<Width>8.0</Width>
<Height>8.0</Height>
</Dimensions>
<PackageWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>12.0</Weight>
</PackageWeight>
</Package>
</Shipment>
</RatingServiceSelectionRequest>
"""
try:
httpresq = urllib.request.Request(url="https://wwwcie.ups.com/ups.app/xml/Rate", data=data.encode('utf_8'), headers={'Content-Type': 'application/x-www-form-urlencoded'})
response = urllib.request.urlopen(httpresq)
return_values = response.read()
print(return_values)
except urllib.error.URLError as e:
error = "urllib.error.URLError exception was raised: %s" % e
print(error)

Related

How do i get the TFS workitem(Task or Bug) Icon in Rest api? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I need to get the icon url for differntiating workItem types(task,bug,user stroy or Product Backlog) in Rest call
To get workitem Icon in Rest API, it's impossible for now.
To change the color, you could try below steps:
Open the Command Prompt
CD cd %programfiles(x86)%\Microsoft Visual Studio 14.0\Common7\IDE
witadmin exportprocessconfig /collection:your col. /p:project /f:file
Edit the exported file, see below
witadmin importprocessconfig /collection:your col. /p:project /f:file
The process config should contain a section work item colors, if the section is missing just add it (e.g. at the end just before the end of ProjectProcessConfiguration)
<WorkItemColors>
<WorkItemColor primary="FF009CCC" secondary="FFD6ECF2" name="Product Backlog Item" />
<WorkItemColor primary="FFF2CB1D" secondary="FFF6F5D2" name="Task" />
<WorkItemColor primary="FFCC293D" secondary="FFFAEAE5" name="Bug" />
</WorkItemColors>
The primary color is used in lists and the secondary color in boards.

Cordys BPM - Create an E-mail Model based on an XML Schema Document

I have created a standalone email model and generated a web service based on the email model. I followed the same steps as described in the Cordys documentation ( https://wiki.cordys.com/display/bop41/Creating+an+E-mail+Model ) but when I try to invoke the web service I am getting a fault like "Do not understand method TAT_Email_Model_WebserviceOperation of type NSCUST".
I have linked my WebServiceInterface to an Email service container ( correct me if I am done wrong over here).
The complete description of the fault is as below. Any suggestions.
<ErrorDetails>
<Request>
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Header xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<header xmlns="http://schemas.cordys.com/General/1.0/">
<Logger xmlns="http://schemas.cordys.com/General/1.0/" />
</header>
<i18n:international xmlns:i18n="http://www.w3.org/2005/09/ws-i18n">
<locale xmlns="http://www.w3.org/2005/09/ws-i18n">en-US</locale>
</i18n:international>
</SOAP:Header>
<SOAP:Body>
<TAT_Email_Model_WebserviceOperation xmlns="http://schemas.cordys.com/1.0/email">
<SOURCE>Notification Custom Method</SOURCE>
<MESSAGE_DATA>
<Application>
<data>
<message_data />
<message_metadata />
</data>
</Application>
</MESSAGE_DATA>
<SUBJECT>PARAMETER</SUBJECT>
<attachments>
<attachment name="" encoded="false">PARAMETER</attachment>
</attachments>
<SENDER_ADDRESS>
<MAIL_ID>PARAMETER</MAIL_ID>
<DISPLAY_NAME>PARAMETER</DISPLAY_NAME>
</SENDER_ADDRESS>
<RECEIVERS>
<MAILING_LIST>
<to>
<address>
<displayName>PARAMETER</displayName>
<emailAddress>PARAMETER</emailAddress>
</address>
</to>
<cc>
<address>
<displayName>PARAMETER</displayName>
<emailAddress>PARAMETER</emailAddress>
</address>
</cc>
<bcc>
<address>
<displayName>PARAMETER</displayName>
<emailAddress>PARAMETER</emailAddress>
</address>
</bcc>
</MAILING_LIST>
</RECEIVERS>
</TAT_Email_Model_WebserviceOperation>
</SOAP:Body>
</SOAP:Envelope>
</Request>
<Response>
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Header xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<header xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://schemas.cordys.com/General/1.0/">
<msg-id>000C297F-0536-11E3-E944-DF0951D0118E</msg-id>
<license>License has expired since 138 day(s)</license>
</header>
</SOAP:Header>
<SOAP:Body>
<SOAP:Fault>
<faultcode>MustUnderstand</faultcode>
<faultstring xml:lang="en-US">Do not understand method TAT_Email_Model_WebserviceOperation of type NSCUST</faultstring>
<faultactor>http://schemas.cordys.com/1.0/email</faultactor>
<detail>
<cordys:FaultDetails xmlns:cordys="http://schemas.cordys.com/General/1.0/">
<cordys:LocalizableMessage xmlns:cordys="http://schemas.cordys.com/General/1.0/">
<cordys:MessageCode xmlns:cordys="http://schemas.cordys.com/General/1.0/" />
</cordys:LocalizableMessage>
</cordys:FaultDetails>
</detail>
</SOAP:Fault>
</SOAP:Body>
</SOAP:Envelope>
</Response>
</ErrorDetails>
You have bound it to the wrong service container, you have to attach it to the Notification Service Container.
The error tells you that the current handling service container cannot handle requests of type NSCUST. This is available in the implementation of the webservice.
NOTE: you license has been expired on that server. With the License Manager in Cordys you can update it.

How to apply sorting in ObjectDataSource [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have asp.net grid view which is bind with ObjectDataSource1 & this ObjectdataSource1 is bind with WCF service method. I am new to asp.net.
Problem is I have to apply column wise sorting in it. But unable to do that.
Enable Sorting checkbox is not visible using C# VS2010
I use sorting like this:
<asp:GridView ID="GridView1" DataSourceID="ObjectDataSource1" runat="server" AutoGenerateColumns="False" AllowSorting="true" >
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" />
<asp:BoundField DataField="TelephoneNo" HeaderText=" Phone" SortExpression="TelephoneNo" />
<asp:BoundField DataField="RequestTypeName" HeaderText="Type" SortExpression="RequestTypeName" />
<asp:BoundField DataField="CenterName" HeaderText="Center" SortExpression="CenterName" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="Data.RequestDB" SelectMethod="SearchRequests" SelectCountMethod="SearchRequestsCount" OnSelecting="ObjectDataSource1_Selecting" SortParameterName="sortParameter" >
<SelectParameters>
<asp:Parameter Name="id" Type="String" />
<asp:Parameter Name="telephoneNo" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
and db method:
public static List<Request> SearchRequests(string id, string telephoneNo, string sortParameter = null)
{
using (MainDataContext context = new MainDataContext())
{
var query = context.Requests
.Where(t => (string.IsNullOrWhiteSpace(id) || t.ID.ToString().Contains(id)) &&
(string.IsNullOrWhiteSpace(telephoneNo) || t.TelephoneNo.ToString().Contains(telephoneNo))));
if (string.IsNullOrEmpty(sortParameter))
return query.OrderByDescending(t => t.ID).ThenByDescending(t => t.StatusName)
.ToList();
return query.OrderBy(sortParameter)
.ToList();
}
}
I hope it helps you

Using QBWeb Connector to Sync Customers

I am facing this issue, when i am trying to create new customer in Quick Books.
I was having actual name of Customer at my php side was "IbáñezOmar" and when it converts to UTF-8 encoding, it becomes "IbáñezOmar".
But when this customer created in Quick Books the name totally changes to "Ib????ezOmar"
Please can anyone help how can i fix this issue?
<?xml version="1.0" encoding="utf-8"?><?qbxml version="11.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<CustomerAddRq>
<CustomerAdd>
<Name >IbáñezOmar</Name>
<IsActive >1</IsActive>
<CompanyName >IbáñezOmar</CompanyName>
<Salutation ></Salutation>
<FirstName >Omar</FirstName>
<LastName >Ibáñez</LastName>
<Contact >Omar Ibáñez</Contact>
</CustomerAdd>
</CustomerAddRq>
</QBXMLMsgsRq>
</QBXML>

Extracting from feedburner feeds?

I want to extract title and image for each item mentioned in http://rss.cnn.com/rss/edition.rss feed using PHP ,could anyone please help me out ?
Thanx
you can try simplexml_load_string():
Exemple:
<?php
$string = <<<XML
<?xml version='1.0'?>
<document>
<title>Forty What?</title>
<from>Joe</from>
<to>Jane</to>
<body>
I know that's the answer -- but what's the question?
</body>
</document>
XML;
$xml = simplexml_load_string($string);
var_dump($xml);
?>

Resources