Tuesday, June 15, 2010

Testing Webservices outside Siebel / Testing Inbound Siebel Webservices - using WGET

I am a Siebel EAI developer. But sometimes I feel that Siebel does not provide the freedom to properly play around with webservice settings, or to test them properly. In most projects, we use a third party tool like SOAP UI or XML SPY to test inbound Siebel webservices. Sometimes when an outbound webservice call from Siebel fails, we try to reproduce the error from SOAP UI to try and find out if there is something wrong in the Siebel configuration. While most developers love the fact that SOAP UI is free and can consume  WSDLS and generate SOAP files, I find it terribly slow. Also, when working on client machines via an RDP/MSTSC connection, I need quick results and cannot wait for SOAP UIs resource hungry interface to load up. Altova XML Spy is faster, but its not free.

 

I set out to find another way to test webservices without using and costly or resource hungry tool. And I found a solution on Unix.

 

Unix developers are well aware of and have been using a command called wget to test http and soap interfaces. Wget is a powerful unix command which can be used to download content, post Http requests, and now even SOAP requests, as I found out. If you have a valid SOAP request, all you need is to send it across to a webservice/url, you can use Wget to do this.  This command has been ported to windows here.I have been using this trick for months now, and it has saved me looaadss of time.

 

Essentially, a SOAP request contains 3 parts

 

·         SOAP Header

·         SOAP Body

·         RAW Parameters / SOAP Parameters

 

The  SOAP Header and Body is as name suggests, contains schema information and data. The SOAP parameters contains additional info as to which url is to be hit and what is the format. Also there is one parameter for length, which contains the length of the soap message (header + body) in char counts. So, the length of the soap message has to be sent.

 

At Siebelunleashed, Neel explains how to trigger outbound webservice from Siebel. I will explain how to do the same thing from outside Siebel.  The example here again uses the GeoIPservice.

 

If you go this link, you will see the actual SOAP request for the service.

 

POST /geoipservice.asmx HTTP/1.1

Host: www.webservicex.net

Content-Type: text/xml; charset=utf-8

Content-Length: length

SOAPAction: "http://www.webservicex.net/GetGeoIP"

 

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

  <soap:Body>

    <GetGeoIP xmlns="http://www.webservicex.net">

      <IPAddress>string</IPAddress>

    </GetGeoIP>

  </soap:Body>

</soap:Envelope>

 

Here, the section in blue is the SOAP/RAW parameter section. And the length highlighted in bold has to contain the length of the soap request. After we frame this entire request, we have to send it across as an HTTP request.

 

Here is what we do.

 

1.     Create a folder on your desktop. Download wget for windows. Don’t worry, its free and safe J

2.     Create three files in your folder

·         Req.xml -  this will contain the soap message

·         url.txt – this will contain the url

·         send.bat – we will automate this in a bat file.

3.     Open up req.xml in notepad and enter this.

 

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

  <soap:Body>

    <GetGeoIP xmlns="http://www.webservicex.net">

      <IPAddress>216.239.51.99</IPAddress>

    </GetGeoIP>

  </soap:Body>

</soap:Envelope>

 

The ip here is that of Google. We shall see where google’s servers are located.

 

4.      Open up url.txt and enter this

 

http://www.webservicex.net/geoipservice.asmx

 

You will get this address from the WSDL. Open up the WSDL and look for a section called http:address

 

<wsdl:port name="GeoIPServiceHttpPost" binding="tns:GeoIPServiceHttpPost">

  <http:address location="http://www.webservicex.net/geoipservice.asmx" />

 

 

5.     Open up the send.bat file in notepad and enter this

wget  --input-file=url.txt   -nv --post-file=req.xml  --output-document=resp.xml   --header="Content-Type: text/xml" --header="SOAPAction: "http://www.webservicex.net/GetGeoIP"

 

notepad resp.xml

 

6.     Your folder should now contain 4 files. Execute send.bat, either by double clicking or from run command.

 

In a moment, the SOAP request will be sent across and the response should open up in notepad.

 

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetGeoIPResponse xmlns="http://www.webservicex.net"><GetGeoIPResult><ReturnCode>1</ReturnCode><IP>216.239.51.99</IP><ReturnCodeDetails>Record Found</ReturnCodeDetails><CountryName>UNITED STATES</CountryName><CountryCode>US</CountryCode></GetGeoIPResult></GetGeoIPResponse></soap:Body></soap:Envelope>

 

 

The response shows us that the 216.239.51.99  is in UNITED STATES.

 

When we run the bat file, wget takes the req.xml file and adds the header parameters we specified.

 

wget  --input-file=url.txt   -nv --post-file=req.xml  --output-document=resp.xml   --header="Content-Type: text/xml" --header="SOAPAction: "http://www.webservicex.net/GetGeoIP"

 

Here the parameters are Content-Type and SOAPAction. Inaddition, WGET also adds the content length required for the request.  WGET provides a debug option to see the complete request going out. Just add –debug in the beginning like this

 

wget  --debug --input-file=url.txt   -nv --post-file=req.xml  --output-document=resp.xml   --header="Content-Type: text/xml" --header="SOAPAction: "http://www.webservicex.net/GetGeoIP"

 

You will see the response with debug information like this.

 

C:\test>wget  --debug --input-file=url.

txt   -nv --post-file=req.xml  --output-document=resp.xml   --header="Content-Ty

pe: text/xml" --header="SOAPAction: "http://www.webservicex.net/GetGeoIP"

Setting --input-file (input) to url.txt

Setting --no (verbose) to 0

Setting --post-file (postfile) to req.xml

Setting --output-document (outputdocument) to resp.xml

Setting --header (header) to Content-Type: text/xml

Setting --header (header) to SOAPAction: http://www.webservicex.net/GetGeoIP

DEBUG output created by Wget 1.11.4 on Windows-MSVC.

 

Loaded url.txt (size 44).

seconds 0.00, Caching www.webservicex.net => 209.162.186.60

seconds 0.00, Created socket 1932.

Releasing 0x00985058 (new refcount 1).

 

---request begin---

POST /geoipservice.asmx HTTP/1.0

User-Agent: Wget/1.11.4

Accept: */*

Host: www.webservicex.net

Connection: Keep-Alive

Content-Type: text/xml

Content-Length: 370

SOAPAction: http://www.webservicex.net/GetGeoIP

 

---request end---

[writing POST file req.xml ... done]

 

---response begin---

HTTP/1.1 200 OK

Connection: keep-alive

Date: Tue, 15 Jun 2010 08:12:10 GMT

Server: Microsoft-IIS/6.0

X-Powered-By: ASP.NET

X-AspNet-Version: 2.0.50727

Cache-Control: private, max-age=0

Content-Type: text/xml; charset=utf-8

Content-Length: 519

 

---response end---

Registered socket 1932 for persistent reuse.

2010-06-15 01:12:10 URL:http://www.webservicex.net/geoipservice.asmx [519/519] -

> "resp.xml" [1]

FINISHED --2010-06-15 01:12:10--

Downloaded: 1 files, 519 in 0s (2320 GB/s)

 

C:\test>notepad resp.xml

           

      Notice the content length (370) added by WGET.

 

 

 

Conclusion : WGET is a powerful tool which can be used to test webservices without using tools like SOAP UI or XML SPY. In fact, this is exactly what SOAP UI does, but in a more fancy way. Similarily, WGET can also be used to test inbound Siebel webservices.

 

 

I discovered WGET it only because I wanted a quick and efficient way to testing webservices on windows as well as unix. Now I can test webservices without installing shareware or when I don’t have admin rights to install them. Hope this helps Siebel and non Siebel developers in their work.

 

 

May the source be with you.

Friday, June 11, 2010

You cannot execute a query using the % field.(SBL-DAT-00401)

Found a really annoying oracle limitation today. One requirement involved querying in a BC Field which had a column of type long behind it. I didn’t think twice and implemented this with a little bit of scripting. The script compile and ran fine on my local machine. But once I checked in and got it compiled, it got this error

 

You cannot execute a query using the %1 field.(SBL-DAT-00401)

 

And I found this from supportweb:

 

https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=539572.1&h=Y

 

The Oracle RDBMS does not support queries on LONG columns - Siebel Technical Support testing just confirmed that this restriction that is documented for Oracle 8 already still exists in Oracle 10.

http://download-east.oracle.com/docs/cd/A58617_01/server.804/a58241/ch5.htm

Restrictions on LONG and LONG RAW Data
Although LONG (and LONG RAW; see below) columns have many uses, their use has some restrictions:
- Only one LONG column is allowed per table.
- LONG columns cannot be indexed.
- LONG columns cannot appear in integrity constraints.
- LONG columns cannot be used in WHERE, GROUP BY, ORDER BY, or CONNECT BY clauses or with the DISTINCT operator in SELECT statements. ...

 

But I had a perfect working code on my local db. How could that be ? The next line in supportweb explained this.

 

The SQLAnywhere Database Engine that is used for the Siebel local database does not have this restrition, so the query is working there.

 

Great !! Now I have to find another way out. Any suggestions ?

 

How deep was deepwater horizon drilling ?

This infographic shows how deep Deepware Horizon was drilling for oil.

Tuesday, June 8, 2010

Finally, I created an artwork - with IOgraph

IOGraphica is a small application which creates a graph map of your mouse movements. You just have to start the app and let it run, and its ouput is  PNG file. Here is mine after one day of running.

Friday, June 4, 2010

See all developer logins in Siebel

I wanted to see all users who had localdbs on our server.

 

select * from user_role_privs

 

..will list all the users roles. The user with SSE_ROLE permissions are registered developers, and they could have local dbs.

Tuesday, June 1, 2010

'Transaction Updated' is a required field. Please enter a value for the field.(SBL-DAT-00498)(SBL-EAI-04389)

 

'Transaction Updated' is a required field.  Please enter a value for the field.(SBL-DAT-00498)(SBL-EAI-04389)

 

This error occurs if there are system fields explicitly specified in the Business Component used to insert data into Siebel tables. Find the BC behind the integration object, and check if fields like Created or Updated are mentioned there. Inactivate them and it should work fine.

 

Lost....last season...watching it now on Star World

Many years ago, while still in college, I got to know about the television series LOST. Apparently, the first season had finished airing in the US and he had downloaded the episodes. And I got hooked. It gave a whole new interpretation of the phrase:stranded on an island. I loved the fact that the story was happening in present time, and despite all the advancements in technology, the survivors were stuck with no outside help. I guessed that the whole saga would last 2 seasons at most, because soon they would run out of ideas, and help would come from outside.

 

 

Now I am watching the last season of the saga on star world. Somewhere in between , the show lost its focus. There are more questions still waiting to be answered. Looots of extra characters came in from nowhere . And loads of them disappeared. Its not as hooking as the first season was. My favorite character was Charlie, the character played by Dominic Monaghan. I loved his background and how he came to the island. And till date, the story of his death is the one that hurt me most on the show. The episode “Greatest Hits” is my favourite. Charlie writes down the greatest moments of his life, when he realizes that his death is near. There are moments which seem trivial to others, but for Charlie, it has changed something in his life.

 

If I make a list of my top 5 greatest moments..I dunno what would turn up. Maybe the first time I rode my cycle ? When my sister was born ? When I landed and lost my first job ? Definitely the day I finally got rid of college.

 

 

Anyway, I don’t think I will take anything else from LOST except this idea of Greatest Hits.