New! Find MP3 Files from your program using SOAP!
Agni Software is happy to release the Agni Find MP3 Service which helps you find MP3 files over the Internet. This SOAP service is built with Borland Delphi, and is deployed with special permission from Borland.

Here's the information you need to access the web service.
Service Name: Agni Find MP3
Service Owner: Agni Software Private Limited
Contact Email: shenoy@agnisoft.com
Service Home Page: http://www.agnisoft.com/soap/findmp3service.htm
Description: Finds MP3 files on the Internet.
Method takes a search string and the maximum no. of results to return, and returns the URL, Filename, Size and Downloadable Speed of each file found.
SOAP Endpoint URL: http://www.agnisoft.com/cgi-bin/soapmp3search.exe/soap/ISoapFindMP3
Soap Action: urn:SoapFindMP3Intf-ISoapFindMP3#SearchMP3
Method Namespace URI: urn:SoapFindMP3Intf-ISoapFindMP3
Method Name: SearchMP3
WSDL URL: 1. http://www.agnisoft.com/cgi-bin/soapmp3search.exe/wsdl/ISoapFindMP3
2. (MS Soap Toolkit 2.0 compatible version)
Instructions:
Method: SearchMP3
Parameters: 
    1. SearchString  (xsd:string)
    2. NumResults  (xsd:int) 
Returns: unbound Array of TMP3Result TMP3Result members: 1. URL (xsd: string) 2. Filename (xsd: string) 3. Size (xsd: string) 4. Speed (xsd: string)
Server Implementation: Delphi

Sample SOAP Clients :


You can access this service using any SOAP client using the WSDL URL above. The Service Name is ISoapFindMp3service and the port is ISoapFindMP3Port. You can also directly link to the SOAP endpoint URL given above.

In order to present to you how the SOAP service behaves, we have built different SOAP clients. Some of these clients are built with the Microsoft SOAP Toolkit 2.0, available at http://download.microsoft.com/download/xml/soap/2.0/W98NT42KMe/EN-US/SoapToolkit20.EXE. (More Information). You will need to install this toolkit before using or compiling sample client no. 1.

1. Delphi 6 Client: (needs Delphi 6 Enterprise, Update Pack 1) This client uses the new THTTPRio component. All you need to do is import the references and write this code:
var Results : TMP3Results;
    MP3REsult : TMp3Result;
    i : integer;
begin
  lstResults.Clear;
  HttpRIO1.URL := edtUrl.Text;
  HttpRIO1.Service := 'ISoapFindMP3Service';
  HTTPRIO1.Port := 'ISoapFindMP3Port';
  Results :=
      (HTTPRIO1 as ISoapFindMP3).SearchMP3(edtSearch.Text, 
	                                  StrToInt(edtResults.Text));

  StatusBar.SimpleText := IntToStr(Length(Results)) + ' results found.';
  for i := 0 to Length(Results)-1 do
  begin
    MP3Result := REsults[i];
    with lstResults.Items.Add do
    begin
      Caption := IntToStr(i+1);
      SubItems.Add( MP3REsult.URL);
      SubItems.Add( MP3REsult.Size);
      SubItems.Add( MP3REsult.FileName);
      SubItems.Add( MP3REsult.Speed);
    end;
  end;
end;
Downloads:
D6 Client Application Source Code (3K)

2. Delphi 5 Client: (needs the MS Soap Toolkit)
This client is very simple to write. Here's the code needed to search using the MP3 Soap service.


var
  Test , Obj, Ret : Variant;
  i : integer;
begin
  ListView1.Items.Clear;
  Obj := CreateOleObject('MSSOAP.SoapClient');
  Obj.mssoapinit('http://www.agnisoft.com/soap/mssoapmp3search.xml');
  Ret := obj.SearchMP3(edtSearch.Text, 20);
  if Ret.Length>0 then
  begin
    StatusBar1.SimpleText := IntToStr(Ret.Length) + ' results found.';
    for i:= 0 to Ret.Length-1 do
      begin
        Test := Ret.Item[i].childNodes ;
        with ListView1.Items.Add do
        begin
          Caption := IntToStr(I);
          SubItems.Add( Test.Item[0].Text );
          SubItems.Add( Test.Item[2].Text );
          SubItems.Add( Test.Item[1].Text );
          SubItems.Add( Test.Item[3].Text );
        end;

        Test := NULL;
      end;
    end
    else
      StatusBar1.SimpleText := 'No files found.';

  Ret := NULL;
  Obj := nULL;
end;

Downloads:
D5 Client Application (195K)
D5 Client Application Source Code (20K)

Screenshot: (Delphi 5 and Delphi 6 clients have the same user interface)

(click to view larger image)
2. Pocket SOAP Client:
We have also produced a SOAP client using the Pocket SOAP toolkit available at http://www.4s4c.com/pocketsoap/. The source code is a bit complicated in Delphi, we'll have some VB clients available soon. Here's the procedure :
 var
  Env: ISoapEnvelope;
  SubParams, RetParams, Params : ISoapNodes;
  NewParam, Param : ISoapNode;
  soapRecv, soapMsg : WideString;
  Trans : IHttpTransport;
  Val : OleVariant;
  Count, i, j : integer;
  li : TListItem;
  Envelope : PSafeArray;
  ParseEnv : Variant;
begin
  Env := CoCoEnvelope.Create;
  Env.Set_MethodName('SearchMP3');
  Env.Set_URI('urn:SoapFindMP3Intf-ISoapFindMP3');

  Env.Get_Parameters(Params);
  Params.Create( 'SearchString', 
                 edtSearchFor.Text, 
                 '', 
                 'xsd:string', 
                 'http://www.w3.org/2001/XMLSchema', 
                 Param);
  Params.Create( 'NumResults', 
                 10, 
                 '', 
                 'xsd:int', 
                 'http://www.w3.org/2001/XMLSchema', 
                 Param);

  Env.serialize(soapMsg);

  Trans := CoHTTPTransport.Create;
  Trans.Send( 
    'http://www.agnisoft.com/cgi-bin/soapmp3search.exe/soap/ISoapFindMP3', 
	soapMsg);

  Env.Parse( Trans, 'utf-8');

  Env.Get_Parameters( RetParams );
  RetParams.Get_Count( Count );

  for i := 1 to Count-1 do
  begin
    VarType(val);
    RetParams.Get_Item(i, Param);
    Param.Get_Nodes(SubParams);
    li := ListView1.Items.Add;
    for j := 0 to 3 do
    begin
      SubParams.Get_Item(j, newparam);
      NewParam.Get_Value(Val);
      if j = 0 then
        li.Caption := Val
      else
        li.SubItems.Add(Val);
    end;
  end;
end;

Downloads:
D5 PocketSoap Client Application (191K)
D5 PocketSoap Client Application Source Code (7K)

Screenshot:

(click to view larger image)
3.NEW!.NET Client in C#!
Ha! We did it! It's right here and actually works. The .NET client in C# is at ISoapFindMP3service.cs.src. It was quite simple to do , I only ran the "wsdl.exe" on the WSDL url and things just worked! Ok, a little tweak I must admit to. See if you can figure it out. (You will need to remove the .src extension)
4. Web Client: Will be available even sooner.


Feel free to mail Deepak Shenoy (shenoy@agnisoft.com) any of your questions. We'll try and answer to the best of our abilities. Note: Please do not ask us questions about Delphi 6.

Agni Software also provides consulting and software development services on SOAP. Talk to Deepak Shenoy for more information.

Has this page been helpful to you? Suggestions? Comments? Let us know!