×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Invoke NET webservice(svc) with data complext

Invoke NET webservice(svc) with data complext

Invoke NET webservice(svc) with data complext

(OP)
I'm trying to invoke a NET webservice type REST but I have problems because first, I have to get the values and send like a object.

I put the values in structs but someones I have to puthem in a list, I think so. The NET developers send me a sample of how can I invoke in net and this code Im trying to translate in CF.

This is NET Code

protected void Button1_Click(object sender, EventArgs e)
{
//Create Emission object in order to manage entities for emission process
IntegrationService.Emission myEmission = new IntegrationService.Emission();
myEmission.codSuc = 30;
myEmission.codRamo = 200;
myEmission.poliza = new IntegrationService.Poliza() {
//These must be initialized from WS
numPol = "0",
anioEndoso = 0,
numEndoso = "0",
//
codMoneda = 0,
codTipoPoliza = 4,
fecVigDesde = new DateTime(2013,11,30),
fecVigHasta = new DateTime(2014,11,30)
};
myEmission.agente = new IntegrationService.Agente() {
codTipoAgente = 1,
codAgente = 1000
};
myEmission.cliente = new System.Collections.Generic.List<IntegrationService.Cliente>(){
new IntegrationService.Cliente()
{
apPat = "Morales",
apMat = "Ibarra",
nombre = "Osiris",
tipoPersona = "J",
codItem = 0
}
};
myEmission.cobertura = new System.Collections.Generic.List<IntegrationService.Cobertura>(){
new IntegrationService.Cobertura()
{
codItem = 12,
codIndCob = 999,
codRamo = 5,
codTarifa = "13",
codObjeto = "999"
}
};
myEmission.inciso = new System.Collections.Generic.List<IntegrationService.Inciso>(){
new IntegrationService.Inciso()
{
codItem = 0,
codIndCob = 77
}
};
myEmission.clausula = new System.Collections.Generic.List<IntegrationService.Clausula>(){
new IntegrationService.Clausula()
{
codTipoAnexo = 25,
codAnexo = 50
}
};
myEmission.cuota = new System.Collections.Generic.List<IntegrationService.Cuota>(){
new IntegrationService.Cuota()
{
numCuota = 6,
codItem = 5,
fecVenc = new DateTime(2013,12,31),
impPrimaMe = 440.44m,
impIvaMe = 33.33m,
impRecFinMe = 22m,
impDerPoliza = 11m,
impDerPolizaTur = 0m,
impPremio = 1010m
}
};
myEmission.observacion = new System.Collections.Generic.List<IntegrationService.Observacion>(){
new IntegrationService.Observacion()
{
codItem = 7
}
};
//Instantiate service as client

IntegrationService.EmissionServiceClient myServiceClient = new IntegrationService.EmissionServiceClient();
//Open service client request
myServiceClient.Open();
//Call specified WebMethod as necessary, sending Emission object as parameter
result = myServiceClient.createPolicy(myEmission);
//Close service client request
myServiceClient.Close();

Label1.Text = result;
}


An this is my code in CF


<cfset myEmission = StructNew()>
<cfset myEmission.Emission.codSuc = "30">
<cfset myEmission.Emission.codRamo = "200">
<cfset myEmission.Poliza.numPol = "0">
<cfset myEmission.Poliza.anioEndoso = "0">
<cfset myEmission.Poliza.numEndoso = "0">
<cfset myEmission.Poliza.codMoneda = "0">
<cfset myEmission.Poliza.codTipoPoliza = "4">
<cfset myEmission.Poliza.fecVigDesde = "30/11/2013">
<cfset myEmission.Poliza.fecVigHasta = "30/11/2014">
<cfset myEmission.agente.codTipoAgente = "1">
<cfset myEmission.agente.codAgente = "1000">


<cfset myEmission.Cliente.apPat = "Zamora">
<cfset myEmission.Cliente.apMat = "Villasana">
<cfset myEmission.Cliente.nombre = "Moises">
<cfset myEmission.Cliente.tipoPersona = "J">
<cfset myEmission.Cliente.tipoPersona = "0">


<cfset myEmission.Cobertura.codItem = "12">
<cfset myEmission.Cobertura.codIndCob = "999">
<cfset myEmission.Cobertura.codRamo = "5">
<cfset myEmission.Cobertura.codTarifa = "13">
<cfset myEmission.Cobertura.codObjeto = "999">


<cfset myEmission.Inciso.codItem = "0">
<cfset myEmission.Inciso.codIndCob = "77">


<cfset myEmission.Clausula.codTipoAnexo = "25">
<cfset myEmission.Clausula.codAnexo = "50">


<cfset myEmission.Cuota.numCuota = "6">
<cfset myEmission.Cuota.codItem = "5">
<cfset myEmission.Cuota.fecVenc = "31/12/2013">
<cfset myEmission.Cuota.impPrimaMe = "440.44m">
<cfset myEmission.Cuota.impIvaMe = "33.33m">
<cfset myEmission.Cuota.impRecFinMe = "22m">
<cfset myEmission.Cuota.impDerPoliza = "11m">
<cfset myEmission.Cuota.impDerPolizaTur = "0m">
<cfset myEmission.Cuota.impPremio = "1010m">


<cfset myEmission.Observacion.codItem = "7">


<cfinvoke
webservice="http://somedomain.com/IntegrationService/EmissionS..."
method="createPolicy"
returnvariable="aString" argumentcollection="#myEmission#">
<cfinvokeargument name="emissionRequest" value=""/>
</cfinvoke>


<cfdump var="#aString#">


This part I don't know how to translate in CF, If some can help me please.

myEmission.cliente = new System.Collections.Generic.List<IntegrationService.Cliente>(){
new IntegrationService.Cliente()
{
apPat = "Morales",
apMat = "Ibarra",
nombre = "Osiris",
tipoPersona = "J",
codItem = 0
}
};



Do you know where can I found a sample of how to send this parameters to Net webservice from CF?
No there's much informacion about this.

regards

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close