Page 2 of 2

Posted: Fri Sep 05, 2008 8:49 pm
by Antonio Linares
Rafa,

Muchas gracias! :-)

Posted: Fri Sep 05, 2008 9:15 pm
by thefull
Antonio Linares wrote:Rafa,

Muchas gracias! :-)

Un placer.
Respecto a lo que quedaba en el tintero, sobre si era posible o no llamar
a un method pasando parámetros que no fueran XML, si es posible,
lo que pasa es que como los XML que yo manejo tienen muchos campos, es preferible pasa un XML que pasar 300 parámetros.

Si queréis experimentar aquí tenéis un ejemplo muy simple;
( De los que gustan a Antonio ;-) )

oSoapClient := CreateObject( "MSSOAP.SoapClient30" )
oSoapClient:msSoapInit( "http://www.dataaccess.com/webservicesserver/textcasing.wso?WSDL" )
? oSoapClient:InvertStringCase( "lower UPPER" )

Esto funciona, si lo ejecutáis tenéis que ver LOWER upper.
COJONUT!! :-)

Nota;
Segun el SDK , en este caso el 3.0, el objeto es MSSOAP.SoapClient30.

Posted: Sat Sep 06, 2008 8:09 pm
by Joel Andujo
Hola a todos, después de goglear dos días con gusto les comparto este código para consumir WebServices desde nuestro querido xHFW.

Code: Select all | Expand

*--// Para WebService Saludar (Regresa el clásico Hola Mundo)
cLink:='http://localhost/saludar.asmx/Saludar?WSDL'

*--// Para WebService CaF (Convierte de Celsius a Fahrenheit, devuelve un valor Double)
cLink:='http://localhost/saludar.asmx/CaF?valor=45'

*--// Para WebService FaC (Convierte de Fahrenheit a Celsius, devuelve un valor Double)
cLink:='http://localhost/saludar.asmx/FaC?valor=120'

cTipVar:='string'
 do case
    case 'WSDL'$cLink; cTipVar:='string'
    case 'CaF'   $cLink; cTipVar:='double'
    case 'FaC'   $cLink; cTipVar:='double'
 endc

 *--// Consumiendo Web Service a traves del metodo HTTP GET
 objXML:=CreateObject("Microsoft.XMLDOM")
 objXML:async:=.F.    // El analizador no devolverá el control a su código hasta que el documento se haya cargado
 if objXML:Load( cLink )
    ? objXML:getElementsByTagName( cTipVar ):item(0):text
 else
    ? 'Error '      +str(oBjXML:ParseError:ErrorCode)+CRLF+;
      'Descripción '+oBjXML:ParseError:Reason        +CRLF+;
      'Línea '      +str(oBjXML:ParseError:Line)     +CRLF+;
      'URL '        +oBjXML:ParseError:Url           +CRLF+;
      'Fuente '     +oBjXML:ParseError:srcText
 endi


Les paso el .asmx (Servicio Web) y el web.Config, este último archivo trae una configuración para activar el protocolo HTTP GET
(entre otras cosas)

saludar.asmx

Code: Select all | Expand

<%@ WebService Language="C#" Class="HolaMundoWebS" %>

using System.Web.Services;

[WebService(
    Namespace="http://localhost/",
    Description="Hola, Mundo al estilo Web Service")]
public class HolaMundoWebS {

     [WebMethod(Description="Devuelve la cadena Hola, Mundo")]
     public string Saludar() {
        return "Hola, Mundo";
     }

     [WebMethod(Description="Convierte de Fahrenheit a Celsius, devuelve un valor Double")]
     public double FaC(double valor)
     {   const double fc = (5.0 / 9.0);
         return ((valor - 32) * fc);
     }
     [WebMethod(Description="Convierte de Celsius a Fahrenheit, devuelve un valor Double")]
     public double CaF(double valor)
     {   const double fc = (5.0 / 9.0);
         return (valor / fc + 32);
     }
}


web.config

Code: Select all | Expand

<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    Web Site Administration Tool to configure settings for your application. Use
    the Web site->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    <appSettings/>
    <connectionStrings/>
    <system.web>
        <customErrors mode="Off"/>
        <webServices>
           <protocols>
               <add name="HttpGet"/>
               <remove name="HttpPost"/>
               <add name="HttpSoap"/>
               <add name="Documentation"/>
           </protocols>
        </webServices>
        <!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.
        -->
        <compilation debug="false"/>
        <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
            <authentication mode="Windows"/>
        -->
        <!--
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm"/>
            <error statusCode="404" redirect="FileNotFound.htm"/>
        </customErrors>
        -->
    </system.web>
</configuration>


Se utiliza el objeto "Microsoft.XMLDOM", este según google ya viene incluido en el Internet Explorer, en mi PC de escritorio
con XP no ocupe instalar nada y en mi laptop con WinVista tampoco.

Saludos y que se diviertan
Joel Andujo

PD el .asmx y el web config van juntos en el localhost o bien si tienen un
servidor web, para este ejemplo deben estar ubucados en su localhost.

Posted: Sat Sep 06, 2008 11:30 pm
by Antonio Linares
Rafa, Joel,

Muchas gracias a ambos! :-)

Re: FWHX y Webservers

Posted: Mon Aug 30, 2010 10:53 pm
by elmoiquique
ALguien sabe como usar el <![CDATA[]] para crear archivos xml, agradeceria su ayuda

Re: FWHX y Webservers

Posted: Tue Jul 31, 2012 7:18 pm
by elmoiquique
Rafa, tengo una consulta de soap,
tengo un xml de respuesta que que trae un archivo adjunto, en SOAPUI lo puedo ver pero como puedo extraerlo mediante fivewin, este es el xml de respuesta y que tiene un adjunto.. a ver si me puedes orientar,, gracias


<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header xmlns:work="http://bea.com/2004/06/soap/workarea/">
<cl:token xmlns:cl="cl.zofri.sve">0e2099080517762c4--3bc04e97-f4-c-1303-0a88 a2d1-7f43-7:6434ab958b9:a6545-e40b9280507561c6-23-c-4090-147cc1-04-3ab80acd -3f13274673:af948495a95:5</cl:token>
<cl:respuesta xmlns:cl="cl.zofri.sve">
<java:resCodigo xmlns:java="java:cl.zofri.sve.utl.bo">0</java:resCodigo>
<java:resMensaje xmlns:java="java:cl.zofri.sve.utl.bo">Se ejecuto correctamente el servicio.</java:resMensaje>
<java:resSeveridad xmlns:java="java:cl.zofri.sve.utl.bo">O</java:resSeveridad>
</cl:respuesta>
<work:WorkContext xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility">
<java class="java.beans.XMLDecoder">
<string>weblogic.app.sveProcDocEAR</string>
<int>214</int>
<string>weblogic.workarea.StringWorkContext</string>
<string>r43.3</string>
<string>weblogic.app.KNAEar</string>
<int>214</int>
<string>weblogic.workarea.StringWorkContext</string>
<string>r43.2</string>
<string/>
</java>
</work:WorkContext>
</env:Header>
<env:Body>
<m:exportarBorradoresResponse xmlns:m="http://cl/zofri/sve/prd/wsn">
<m:return>
<Include href="cid:return=216af389-dcc9-4770-80fb-610304b481e0@http://cl/zofri/sve/prd/wsn" xmlns="http://www.w3.org/2004/08/xop/include"/>
</m:return>
</m:exportarBorradoresResponse>
</env:Body>
</env:Envelope>

Re: FWHX y Webservers

Posted: Tue Jul 31, 2012 10:38 pm
by xmanuel
<![CDATA[]] se utiliza para incrustar JavaScript en HTML :D

Re: FWHX y Webservers

Posted: Wed Aug 01, 2012 1:52 pm
by elmoiquique
Gracias Manuel, por la respuesta..
Pero mi inquietud va por otro lado en estos momentos, no se si tu ya resolviste este problema con webservice de que cuando este te contesta con un xml y trae un archivo adjunto, como logro traer ese archivo para poder ver que contiene...