FedEx SOAP error : Schema validation failed for request Thursday, July 2, 2009

This issue is a bit tricky ! why does FedEx SOAP raises a Schema validation error ?

It seams that FedEx service is expecting you to perform a complete SOAP message including all elements even if you don't need on your service call.

Have a look on this C# code which performs a "valid" SOAP call :


PackageMovementInformationService svc = new PackageMovementInformationService();
var request = new PostalCodeInquiryRequest();
request.CarrierCode = CarrierCodeType.FDXE;
request.ClientDetail = new ClientDetail
{
AccountNumber = "ACCOUNT_NO",
Localization = new Localization
{
LanguageCode = "EN",
LocaleCode = "US-EN"
},
MeterNumber = "METER_NO"
};
request.CountryCode = "US";
request.PostalCode = "38017";
request.WebAuthenticationDetail = new WebAuthenticationDetail
{
UserCredential = new WebAuthenticationCredential
{
Key = "__KEY__",
Password = "_Password_"
}
};
request.Version = new VersionId ();
request.TransactionDetail = new TransactionDetail
{
CustomerTransactionId = "23",
Localization = new Localization { LocaleCode="US-EN", LanguageCode="EN" }
};

PostalCodeInquiryReply reply = svc.postalCodeInquiry(request);



This code didn't generate any validation errors because i simply did not leave any of PostalCodeInquiryRequest class members not instantiated.

if are using Ruby,Python or PHP just check you fill all the SOAP request elements.


UPDATE : for a comprehensive details of what elements are missing check an element named "detail" of the SOAP exception response.

runway or a road ? Monday, May 4, 2009



seems like Gibraltar people wanted an Airport so bad !














Windows, Python and Eric4 IDE Tuesday, February 10, 2009

Python is really fun ! mixing OOP with procedural programming is powerful and not a flaw in Python as always Ruby guys wanted to convince you ;)

Almost all Linux flavors include python but for windows you may want stuck with ActiveState ActivePython package which will setup python for you (PATH variable and registry entries) as will as a rich set of windows APIs backing your Python scripting for windows.

The IDE

The are plenty of Python Editors and IDEs. WingIDE is the Python's IntelliJ , the best but costs, so i picked Eric4. regardless the 90's web design of the project website Eric4 has numerous features including Integrated Python Debugger, coding folding, Auto-completion,error highlighting and much much more.

assuming you have already install ActivePython, getting Eric4 to work is straight-forward :

  1. Download the latest package from SourceForge project page.
  2. for compiling Eric4 you will need Microsoft VC++ redistributable from here.
  3. finally you'll need PyQt (Python binding for Qt Framework). simply install Riverbank preconfigured PyQt package which includes Qt runtime from here.

After downloading Eric4 archive go forward and extract it in you preferred location , lets pick c:/program files as the windows De facto. Install Microsoft VC++ and PyQt mentioned in step 1 & 2 and finally browse to Eric4 directory and type the following on you Command Line:

C:\Program Files\eric4-x.x.x> python install.py

That's it ! a batch file eric4.bat will be generated. feel free to to add a shortcut into your desktop or whatever place.


on the upcoming post i will show you how to set up a productive Django Development Environment using Eric4 and their django plugin, Till then :)

Intellij , increase Java's Memory Friday, February 6, 2009






It's common to get Out Of Memory exception when you run application or Debug application on Inellij, However that's not a bug ! you only need to increase JAVA memory settings.

The steps are as follows :

  1. go to "Run" menu the select "Edit Configurations"
  2. increase the memory of Java VM passing -Xmx512M parameter, see the screen shot below.




Enlight your blogger with SyntaxHighlighter 2.0 ! Wednesday, February 4, 2009






Syntax highlighting is essential for your blog posts with code snippets. The Just released SyntaxHighlighter 2.0 is a breeze to use and work with.
I will follow you on this post to successfully integrated SyntaxHighlighter 2.0 into your blogger without having to setup an external hosting.

Step 1:
Login into your Blogger go to the Layout tab and then to Edit HTML

Step 2:


browse your template and locate the <head> Tag

add the following javascript includes:



<script src='http://alexgorbatchev.com/pub/sh/2.0.278/scripts/shCore.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.278/scripts/shBrushPlain.js' type='text/javascript' />
<script src='http://alexgorbatchev.com/pub/sh/2.0.278/scripts/shBrushXml.js' type='text/javascript' />
<script src='http://alexgorbatchev.com/pub/sh/2.0.278/scripts/shBrushCss.js' type='text/javascript' />
<script src='http://alexgorbatchev.com/pub/sh/2.0.278/scripts/shBrushJScript.js' type='text/javascript' />




Step 3:

Blogger does not accept <link> tags within the <head> , you need to manually copy&paste css to the <head> tag:
the css required are
http://alexgorbatchev.com/pub/sh/2.0.278/styles/shCore.css
and
http://alexgorbatchev.com/pub/sh/2.0.278/styles/shThemeDefault.css

Step 4:
add the following javascript into the head tag :

SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/2.0.278/scripts/clipboard.swf';
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.gutter = false;
SyntaxHighlighter.all();



Step 5:

You now need to wrap the text inside your pre tags which will later include the code snippets. unwakeable provide an excellent css snippet which resolves such issue in almost all modern browsers.

ok, back to the <head> tag , add the following style:

pre {
overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not needed in Firefox 3 */
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
/* width: 99%; */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}


That's it ! save you template and Start blogging with code snippets inside <pre> tags.



if you like it please consider donating , it's DonationWare anyways :)


Reflection in .NET vs JAVAs ServiceLoader (code snippet) Friday, January 9, 2009


That's an opinion, not a complete article discussing reflection




I'm diving into JAVA lately ,well it's tasty so far !

If you are a .NETer you can perform reflection simply using the following code:


Assembly asm = Assembly.LoadFrom(@"c:\myapp\plugins\myAssembly.dll");
MyInterface IMy = null;
foreach (Type t in asm.GetTypes()) {
if (t.GetInterface("MyInterface") != null) {
IMy = (MyInterface)Activator.CreateInstance(t);
break;
}
}





JAVA's approach :


ServiceLoader<MyInterface> myImps= ServiceLoader.load(MyInterface.class);
for (Myinterface myImp: myImps) {
System.out.println(" * " + myImp.getName());
}

where you interface found in META-INF


JAVA's reflection looks straight-forward. If you're recently code using C# i guarantee you a quick start on JAVA and if you are always confused with dramastic changes every C# release have please start learning JAVA !.

Python 3000 is finally here Thursday, December 4, 2008

Python 3000 final is out !
for lazy ones , here are some slides from the PyCon to get a preview and the official what's new.

here are recent slides !

Python 3000
View SlideShare presentation or Upload your own. (tags: coscup2008 coscup)