Basirudin Rachman

See also: Other Geeks@INDC

November 2009 - Posts

(500) Internal Server Error on IronPython

I tried to use IronPython to create a SOAP request to a Web Service but got an Internal Server Error.

The same script has been tested from C# withouth error. Anyone got a clue?

Following is the ironpython command:

  1: IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.4927
  2: Type "help", "copyright", "credits" or "license" for more information.
  3: >>> from System.Net import *
  4: >>> from System.Text import *
  5: >>> from System.IO import *
  6: >>> query = Encoding.UTF8.GetBytes('''<?xml version="1.0" encoding="utf-8"?>
  7: ... <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns
  8: :xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://www.w3.org/2003/05
  9: /soap-encoding" xmlns:tns="http://www.witsml.org/wsdl/120" xmlns:types="http://w
 10: ww.witsml.org/wsdl
 11: ...   <soap12:Body soap12:encodingStyle="http://www.w3.org/2003/05/soap-encoding
 12: ">
 13: ...     <q3:WMLS_GetVersion xmlns:q3="http://www.witsml.org/message/120" />
 14: ...   </soap12:Body>
 15: ... </soap12:Envelope>''')
 16: >>> req = WebRequest.Create("http://localhost:81/Petrolink.Powerstore.Webservice
 17: /wmls.asmx")
 18: >>> req.Headers.Add("SOAPAction", "\"\"")
 19: >>> req.Credentials = NetworkCredential("fred", "derf");
 20: >>> req.ContentType = "application/soap+xml; charset=utf-8"
 21: >>> req.Accept = "text/xml"
 22: >>> req.Method = "POST"
 23: >>> requestStream = req.GetRequestStream()
 24: >>> requestStream.Write(query,0,query.Length)
 25: >>> requestStream.Close()
 26: >>> response = req.GetResponse()
 27: Traceback (most recent call last):
 28:   File "<stdin>", line 1, in <module>
 29: SystemError: The remote server returned an error: (500) Internal Server Error.
 30: 

And below is the C# code with the screenshot of the result:

  1: byte[] query = Encoding.UTF8.GetBytes("<?xml version=\"1.0\" encoding=\"utf-8\"?><soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://www.w3.org/2003/05/soap-encoding\" xmlns:tns=\"http://www.witsml.org/wsdl/120\" xmlns:types=\"http://www.witsml.org/wsdl/120/encodedTypes\" xmlns:rpc=\"http://www.w3.org/2003/05/soap-rpc\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\"><soap12:Body soap12:encodingStyle=\"http://www.w3.org/2003/05/soap-encoding\"><q3:WMLS_GetVersion xmlns:q3=\"http://www.witsml.org/message/120\" /></soap12:Body></soap12:Envelope>");
  2: 
  3: HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://localhost:81/Petrolink.Powerstore.Webservice/wmls.asmx");
  4: // if SOAPAction header is required, add it here...
  5: req.Headers.Add("SOAPAction", "\"\"");
  6: 
  7: req.Credentials = new NetworkCredential("fred", "derf");
  8: req.ContentType = "application/soap+xml; charset=utf-8";
  9: req.Accept = "text/xml";
 10: req.Method = "POST";
 11: 
 12: Stream requestStream = req.GetRequestStream();
 13: requestStream.Write(query,0,query.Length);
 14: requestStream.Close();
 15: WebResponse response = req.GetResponse();
 16: 
 17: StreamReader sr = new StreamReader(response.GetResponseStream());
 18: 
 19: Console.WriteLine(sr.ReadToEnd());
.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

image

Share this post: | | | |
Problem With Port 80 – Skype Took It

I tried to start my default web site from IIS Manager this morning, but it gave me an error – inform that the port 80 is already used.

Investigation using netstat –ao command, I got this:

image

Lookup to Task List, got the application which use the port 80. It was Skype. Does anyone know what does Skype use port 80 for?

No worry, you don’t have to tell me now because I’m going back to the code :)

See this:

image

Happily ever after…

Share this post: | | | |
Silverlight Week

It was on two weeks a go I got invitation to talk and discuss about Silverlight.

The first one was in Computer Science IPB, .NET Community arranged by Ecko (one of MSP from IPB). Since there’s some new students in the audiences, so I tried to explain from the beginning, introduction to .NET Framework, then went to Silverlight things – of course this also an introduction.

Following pictures taken from the event (not many students came to the event, since they have some assignment from the lecturer):

Class 1 - a  Class 1

The 2nd event was conducted in the next Sunday  (Oct 18th 2009). This event was conducted by Informatic Diploma Department of IPB. I did not expected this event as formal as I though, but it was. There was speech from the lecturer, head of student group and then me.

Following pictures taken from the event:

Class 2 - a  Class 2

Share this post: | | | |
Petrolink Is (Still) Hiring

If you are a good .NET Developer with following criteria:

  • Experience in C# for 3 years or more.
  • Love to code any kind of application – web, network, communication, messaging, real time data transfer, etc.
  • Good Attitude (Done is the target).
  • Able to work together in a team or alone.
  • It would be an additional value if you have experience with WPF/WCF.
  • Graduated from University with Background in Computer Science or Mathematics or Physics or Electrical Engineering.
  • Interesting in create application for Oil and Gas industry and standard such as WITSML, PRODML.

If you are interested to join us, please send your cv to jakarta.vacancies@petrolink.com

Petrolink is a well established information and communications technology service company specializing in the oil and gas exploration and production sector. If you interest to know more about Petrolink, pelase visit our website: http://www.petrolink.com

Share this post: | | | |
Never Underestimate readme.txt

Have you been in the situation where you got an error that you have previously encountered?

I got this error after installing Oracle Data Access Component (ODAC) 11.1.0.6.21 in my machine (Windows 7 Ultimate x64):

Unable to load DLL 'OraOps11w.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

What have I done? Let’s figure out what steps that drove me to this situation:

  1. I opened the “readme.txt”, it just to remind me the command for installation, and got this: install.bat odp.net20 c:\oracle odac. Yes, I only need this component to be used by at least .NET 2.0.
  2. Finish – I thought that was enough. And then running the application then got the error.

Hmm, figure out, I remember that I need to put the binary path of C:\oracle into environment system path, then I put the C:\oracle\bin. Run the application? Still got the error.

Ok, now, I’m going to read each item in readme.txt carefully, and then in the point 4 in that readme.txt file I got this: Add the install directory and install directory's bin subdirectory… add c:\oracle and c:\oracle\bin to the system PATH. Yes, you’re right I forgot to put c:\oracle in the system PATH.

So, never underestimate readme.txt, at least for my self :)

Now I got my application log:

2009-11-01 17:50:11.096, GET, P,………. Do you know what does the caracter P mean? Yes it means the applicatin runs smoothly (PASSED).

Share this post: | | | |
Windows XP Mode

I’m installing Windows XP Mode now.

It is required because I need to instal Oracle 10g because it cannot be installed on Windows 7.

image

Automatically detect Active Drives:

image

Instal AVG Anti Virus:

image

Instal Oracle 10g:

image

image

Share this post: | | | |