Expand my Community achievements bar.

livecycle web service, send the completed form pdf

Avatar

Level 1

possible, send the completed form? and then receive it in the webservice. Someone has code as is done

3 Replies

Avatar

Level 1

-----------------CODE C#-----------------------------------

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.Services;

namespace WebApplication2

{

    /// <summary>

    /// Summary description for WebServPrueba

    /// </summary>

    [WebService(Namespace = "http://tempuri.org/")]

    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

    [System.ComponentModel.ToolboxItem(false)]

    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.

    // [System.Web.Script.Services.ScriptService]

    public class WebServPrueba : System.Web.Services.WebService

    {

        [WebMethod]

        public string HelloWorld()

        {

            return "Hello World";

        }

        [WebMethod]

        public string nombreUsuario(string nombre)

        {

            return "su nombre es" + nombre;

        }

        [WebMethod]

        public string envioTexto(string texto)

        {

            return "ok";

        }

    }

}

--------- CODE ADOBE LIVECYCLE-------------

Formulario1.SUBFORM1.Botón3::click - (JavaScript, client)

var url = this.resolveNode("xfa.form.Formulario1.SUBFORM1.txtURL").rawValue;

Net.SOAP.wireDump = true;

servicio = Net.SOAP.connect(url);

//si no se conecta al servicioWEB

if (servicio == null){

  app.alert(" NO HA SIDO POSIBLE CONECTARSE AL SERVICIO" + servicio );

}else{

  var entrada = {nombre:33};

  app.alert(servicio.nombreUsuario(entrada ));

}

Avatar

Level 1



I am testing this code does not work, to send a full pdf form, (link Google Groups)


----------code c# recived stream pdf --------------------------------------

        [WebMethod]

        public string enviarFormulario(Stream abc)

        {

            return "ok";

        }

--------code liveCycle for send entire pdf ------------------

var service=SOAP.connect(url );

var documentStream = Collab.documentToStream(event.target);

var encodedStream = Net.streamEncode(documentStream, "base64");

var myBudget = util.stringFromStream(encodedStream, "utf-8");

var base64 = {soapType: "xsd:string",soapValue: myBudget};

var result = service.enviarFormulario({abc:base64});

Avatar

Level 1

(link Google Groups)

Since the PDF contains the server details and exact location of web service I had to encrypt the PDF.

I will let you know the functionality within the PDF.

I implemented following code in the button click event to send the PDF itself to the server.

//////

var service=SOAP.connect("http://domainName.com/webservice.asmx?wsdl");

var documentStream = Collab.documentToStream(event.target);

var encodedStream = Net.streamEncode(documentStream, "base64");

var myBudget = util.stringFromStream(encodedStream, "utf-8");

var base64 = {soapType: "xsd:string",soapValue: myBudget};

var add = {soapType: "xsd:string",soapValue: email.rawValue};

var result = service.sendEmail({abc:base64, email:add});

for(var i in result ) console.println(i);

//////////

In the above code, "abc" and "email" are the input parameter names of the web service function named sendEmail(string abc, string email). so these names should be exact in the client code.

After posting this message i will break the existing sample code at the server,so the no more request are accepted from the sample PDF shared here.

I found this method to be the fastest, stable and simplest too to send PDF or any other binary data to the server. The same can also implemented for sending attachments from the PDF by adding JavaScript code to get the dataObjects.