PSGI and WSDL - How "public" that WSDL?

130 views Asked by At

My problem is that I have these two files:

1.- marcas.psgi

#!/usr/bin/perl

use strict;
use warnings;

use WWW::Curl::easy;
use WWW::Curl;

use Data::Dumper qw(Dumper);
$Data::Dumper::Sortkeys = 1;

use Plack::Request;

my $app = sub {

    ### Pasandole los valores desde el $env
    my $env = shift;
    my $request = Plack::Request->new($env);

    my $MARCA1 = "";
    my $MARCA2 = "";
    my $MARCA3 = "";
    my $MARCA4 = "";
    my $MARCA5 = "";

    if ($request->param('MARCA1')) {
        $MARCA1 = $request->param('MARCA1');
    }
    if ($request->param('MARCA2')) {
        $MARCA2 = $request->param('MARCA2');
    }
    if ($request->param('MARCA3')) {
        $MARCA3 = $request->param('MARCA3');
    }
    if ($request->param('MARCA4')) {
        $MARCA4 = $request->param('MARCA4');
    }
    if ($request->param('MARCA5')) {
        $MARCA5 = $request->param('MARCA5');
    }

    #print system('php','-r','echo "Hola\n";');
    my $resultado = `php -r '
            include_once "marcas.php";
            prueba_curl("$MARCA1","$MARCA2","$MARCA3");
        '
    `;
    #print $resultado;

    return [
        '200',
        [ 'Content-Type' => 'text/plain' ],
        [ "<h1>".time()."</h1><br><br>".
          "MARCA1: ".$MARCA1."<br>".
          "MARCA2: ".$MARCA2."<br>".
          "MARCA3: ".$MARCA3."<br><hr><br>".
          $resultado."<br><hr><br>" ],
    ];

}

2.- IFSoft.wsdl

<?xml version="1.0" encoding="iso-8859-1" ?>



<wsdl:definitions name="IFSoft"
 targetNamespace="http://ip:5000/cgi-bin/psgi/wsdl/"
 xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
 xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
 xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
 xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
 xmlns:tns="http://ip:5000/cgi-bin/psgi/wsdl/"
 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema" >



<wsdl:types>

  <xsd:schema elementFormDefault="qualified" 
              targetNamespace="http://ip:5000/cgi-bin/psgi/wsdl" >

    <xsd:element name="marcasConsulta">
      <xsd:complexType>
    <xsd:sequence>
      <xsd:element name="MARCA1" type="xsd:string" />
      <xsd:element name="MARCA2" type="xsd:string" />
      <xsd:element name="MARCA3" type="xsd:string" />
          <xsd:element name="MARCA4" type="xsd:string" />
          <xsd:element name="MARCA5" type="xsd:string" />
    </xsd:sequence>
      </xsd:complexType>
    </xsd:element>

    <xsd:element name="marcasRespuesta">
      <xsd:complexType>
        <xsd:sequence>
          <xsd:element name="TablaMarcas" type="xsd:string" />
        </xsd:sequence>
      </xsd:complexType>
    </xsd:element>

  </xsd:schema>

</wsdl:types>



<wsdl:message name="marcasIn">
  <wsdl:part element="tns:marcasConsulta" name="parameters" />
</wsdl:message>

<wsdl:message name="marcasOut">
  <wsdl:part element="tns:marcasRespuesta" name="parameters" />
</wsdl:message>



<wsdl:portType name="IMarcas" >
  <wsdl:operation name="ConsultaMarcas" parameterOrder="MARCA1 MARCA2 MARCA3 MARCA4 MARCA5" >
    <wsdl:input message="tns:marcasIn" name="marcasIn" />
    <wsdl:input message="tns:marcasOut" name="marcasOut" />
  </wsdl:operation>
</wsdl:portType>



<wsdl:binding name="IMarcas" type="tns:IMarcas">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
  <wsdl:operation name="ConsultaMarcas">
    <soap:operation soapAction="marcasIn" style="document" />
    <wsdl:input name="marcasIn" >
      <soap:body use="literal" />
    </wsdl:input>
    <wsdl:output name="marcasOut" >
      <soap:body use="literal" />
    </wsdl:output>
  </wsdl:operation>
</wsdl:binding>




<wsdl:service name="ConsultaMarcas">
  <wsdl:documentation>Consulta de Marcas IF-Software.</wsdl:documentation>
  <wsdl:port binding="tns:IMarcas" name="IMarcas" >
    <soap:Address location="http://ip:5000/cgi-bin/psgi/marcas.psgi" />
  </wsdl:port>
</wsdl:service>



</wsdl:definitions>

To run the marcas.psgi what I do is:

plackup marcas.psgi

How I can do to access that marcas.psgi through the WSDL? How "public" that WSDL?

Thank you very much for everything.

0

There are 0 answers