Copy link to clipboard
Copied
Hi CFers,
I have this form, and I have which send information to a web service:
How I can?
FORM
<input type="text" name="name">
<input type="text" name="cpf">
<input type="text" name="inscricaoEstadual">
<input type="text" name="email">
WS
<xs:complexType name="cliente">
<xs:sequence>
<xs:element minOccurs="0" name="name" type="tns:clienteContato"/>
<xs:element minOccurs="0" name="cpf" type="xs:long"/>
<xs:element minOccurs="0" name="inscricaoEstadual" type="xs:string"/>
<xs:element minOccurs="0" name="email" type="xs:long"/>
</xs:sequence>
Tks
You have now made it more complicated. To return to your original question,
...
I have this form, and I have which send information to a web service:
How I can?
FORM
<input type="text" name="name">
<input type="text" name="cpf">
<input type="text" name="inscricaoEstadual">
<input type="text" name="email">
WS
<xs:complexType name="cliente">
<xs:sequence>
<xs:element minOccurs="0" name="name" type="tns:clienteContato"/>
<xs:element minOccurs="0" name="cpf"
Copy link to clipboard
Copied
For example, on the action page of the form, do something like
<cfif isDefined("form.email")>
<cfset cliente. = structNew()>
<cfset cliente.name = form.name>
<cfset cliente.cpf = form.cpf>
<cfset cliente.inscricaoEstadual = form.inscricaoEstadual>
<cfset cliente.email = form.email>
</cfif>
Then call the web service, passing the parameter cliente.
Copy link to clipboard
Copied
BKBK,
Today, my code is:
--- PAGE FORM.CFM ---
<form action="../ws/ws.cfm" method="post" name="ContactForm" id="contactForm">
<input type="text" name="name">
<input type="text" name="cpf">
<input type="text" name="inscricaoEstadual">
<input type="text" name="email">
</form>
--- PAGE WS.CFM ---
<cfhttp url="http://0.0.0.0:8080/services/ClienteWSService?wsdl" method="Post" result="teste" resolveurl="false" charset="utf-8">
<cfhttpparam name="name" value="#form.nome#" type="formfield" >
<cfhttpparam name="cpf" value="#form.cpf#" type="formfield">
<cfhttpparam name="inscricaoEstadual" value="#form.inscricaoEstadual#" type="formfield">
<cfhttpparam name="email" value="#form.email#" type="formfield">
</cfhttp>
That is correct?
If not,
Can you put some example to how I can call the web service, to passing the cliente information?
Tks,
Fabiano
Copy link to clipboard
Copied
You miss the form's submit button: <input type="submit" name="sbmt" value="Send to Webservice">
Also, you ignored the suggestion I gave you. In any case, I will repeat it.
In the page ws.cfm, create the cliente structure, as I suggested, and pass it to the service.
Copy link to clipboard
Copied
Hi BKBK,
Follows the code in the page WS.CFM
<cfif isDefined("form.email")>
<cfset cliente = structNew()>
<cfset cliente.NomeFantasia = form.NomeFantasia>
<cfset cliente.documento = form.documento>
<cfset cliente.inscricaoEstadual = form.inscricaoEstadual>
<cfset cliente.email = form.email>
<cfset cliente.endereco1 = form.endereco1>
<cfset cliente.endereco2 = form.endereco2>
<cfset cliente.cidade = form.cidade>
<cfset cliente.estado = form.estado>
<cfset cliente.cep = form.cep>
</cfif>
<form action="http://0.0.0.0:8080/0WS/services/ClienteWSService?wsdl" method="post" name="ContactForm" id="contactForm">
<input type="text" class="input-box" name="nome" placeholder="Digite a Razão Social." id="nome">
<input type="text" class="input-box" name="nomeFantasia" placeholder="Digite o Nome de Fantasia." id="nomeFantasia">
<input type="text" class="input-box" name="documento" placeholder="Digite o CNPJ." id="documento">
<input type="text" class="input-box" name="inscricaoEstadual" placeholder="Digite Inscrição Estadual." id="inscricaoEstadual">
<input type="text" class="input-box" name="endereco1" placeholder="Digite o Endereço." id="endereco1">
<input type="text" class="input-box" name="endereco2" placeholder="Digite o Endereço." id="endereco2">
<input type="text" class="input-box" name="cidade" placeholder="Digite a Cidade." id="cidade">
<input type="text" class="input-box" name="estado" placeholder="Assunto." id="estado">
<input type="text" class="input-box" name="cep" placeholder="Assunto." id="cep">
<input type="submit" name="submitf" id="submitf" value="Send to Webservice">
</form>
In the same form, I have more information, like Representante Legal for the Representate Legal I create other struct or inside this same CFIF I can put the information like <cfset cliente.NomeFantasia = form.NomeFantasia> and <cfset cliente.Nome= form.Nome>?
It's correct?
Best Regards and Tks for your help!!!
Fabiano
Copy link to clipboard
Copied
You have now made it more complicated. To return to your original question,
I have this form, and I have which send information to a web service:
How I can?
FORM
<input type="text" name="name">
<input type="text" name="cpf">
<input type="text" name="inscricaoEstadual">
<input type="text" name="email">
WS
<xs:complexType name="cliente">
<xs:sequence>
<xs:element minOccurs="0" name="name" type="tns:clienteContato"/>
<xs:element minOccurs="0" name="cpf" type="xs:long"/>
<xs:element minOccurs="0" name="inscricaoEstadual" type="xs:string"/>
<xs:element minOccurs="0" name="email" type="xs:long"/>
</xs:sequence>
form.cfm
<form action="../ws/ws.cfm" method="post" name="ContactForm" id="contactForm">
<input type="text" name="name">
<input type="text" name="cpf">
<input type="text" name="inscricaoEstadual">
<input type="text" name="email">
<input type="submit" name="submitf" id="submitf" value="Send to Webservice">
</form>
ws.cfm
<cfif isDefined("form.email")>
<cfset cliente. = structNew()>
<cfset cliente.name = form.name>
<cfset cliente.cpf = form.cpf>
<cfset cliente.inscricaoEstadual = form.inscricaoEstadual>
<cfset cliente.email = form.email>
<cfset ws = createObject("webservice", "http://0.0.0.0:8080/0WS/services/ClienteWSService?wsdl">
<cfset result = ws.wsOperation(cliente)>
</cfif>
Copy link to clipboard
Copied
Tks BKBK,
Now, I go to the next step of the form.
I go make some tests and after next level.
My form, have more information.
Tks, one more time BKBK.
[ ]'s
Fabiano