Page 1 of 1

XML-RPC

Posted: Mon Nov 16, 2009 8:55 am
by Enrico Maria Giordano
I need to use XML-RPC protocol from FWH/xHarbour.

Any ideas?

EMG

Re: XML-RPC

Posted: Mon Nov 16, 2009 10:52 am
by Antonio Linares
Enrico,

This may help:
http://www.tutorialspoint.com/xml-rpc/index.htm

This is a small example of the XML to send to the server to invoque the remote procedure call:

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1"?>
<methodCall>
   <methodName>sample.sum</methodName>
   <params>
       <param>
            <value><int>17</int></value>
       </param>
       <param>
        <value><int>13</int></value>
       </param>
   </params>
</methodCall>
 
Copied from the above url :-)

Re: XML-RPC

Posted: Mon Nov 16, 2009 10:54 am
by Antonio Linares
The server response:

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1"?>
<methodResponse>
    <params>
    <param>
        <value><int>30</int></value>
    </param>
    </params>
</methodResponse>
 

Re: XML-RPC

Posted: Mon Nov 16, 2009 11:13 am
by Enrico Maria Giordano
Thank you.

EMG

Re: XML-RPC

Posted: Fri Nov 20, 2009 8:46 am
by Silvio
Someone created a class to read/write xml
I not remember but If you search you found

Re: XML-RPC

Posted: Fri Nov 27, 2009 7:10 am
by Rochinha
Friends,

This simple sample show the PocketSOAP Activex use:

Code: Select all

// FiveWin ActiveX support demo - Using PocketSOAP Activex
// José Carlos da Rocha

#include "FiveWin.ch"

function Main(nSkin)
   local oWnd, oActiveX
   local cXML := "" + ;
                 "<S:Envelope" + ;
                 "  S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'" + ;
                 "  xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'" + ;
                 "  xmlns:E='http://schemas.xmlsoap.org/soap/encoding/'" + ;
                 "  xmlns:a='http://soap.address.org/'" + ;
                 "  xmlns:b='http://www.w3.org/2001/XMLSchema-instance'" + ;
                 "  xmlns:c='http://www.w3.org/2001/XMLSchema'>" + ;
                 "<clientes>" + ;
                 "  <numero>123</numero>" + ;
                 "  <rua>R Dr M.M.Mattoso,50</rua>" + ;
                 "  <cidade>Sao Paulo</cidade>" + ;
                 "  <estado>SP</estado>" + ;
                 "  <cep>05171-340</cep>" + ;
                 "  <telefone>" + ;
                 "      <ddd>011</ddd>" + ;
                 "      <numero>3534-3099</numero>" + ;
                 "  </telefone>" + ;
                 "</clientes>" + ;
                 "</S:Envelope>"

   DEFINE WINDOW oWnd //TITLE "FiveWin ActiveX Support"

          oNFe := TOLEAuto():New( "PocketSOAP.Envelope.2" )

          oNFe:SetMethod( "NFe", "http://www.portalfiscal.inf.br/nfe" )

          oddress := oNFe:Parameters:Create( "clientes", "" )
          oddress:Nodes:Create( "numero", "123" )
          oddress:Nodes:Create( "rua", "R Dr M.M.Mattoso,50" )
          oddress:Nodes:Create( "cidade", "Sao Paulo" )
          oddress:Nodes:Create( "estado", "SP" )
          oddress:Nodes:Create( "cep",  "05171-340" )

          oPhone := oddress:Nodes:Create( "telefone", "" )
          oPhone:Nodes:Create( "ddd", "011" )
          oPhone:Nodes:Create( "numero", "3534-3099" )

          esr := oNFe:serialize() // Create a XML source

          ? "Result:",,esr
 
          adr := oNFe:Parameters:Item(0):Value

          ? "Variable Cidade:",,adr:Nodes:ItemByName("cidade"):Value

   ACTIVATE WINDOW oWnd //ON INIT CodeJockSkin_InitDlg( oDlg, nSkin ) 
   return nil
 
Download and install for http://www.pocketsoap.com