• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 440
  • Last Modified:

i need to consume a web service

i need to consume a web service at http://www.diconsa.gob.mx/SiCFDQA/servlet/aprvcargacfd?wsdl

i need to send 3 xml files

i'm reading some articles about web services, but i don'r understand how can i do it

could some one help me

httpwww.diconsa.gob.mxSiCFDQAser.txt
ejemplo.xml
0
tenriquez199
Asked:
tenriquez199
  • 6
  • 5
1 Solution
 
alexey_gusevCommented:
do the following:

- in your c# project r-click on References => Add Web Reference - this will open a window where you can paste the url for wsdl file and click Go; this will discover the web service for you and show its methods and offer its name; click OK

- in your source code where you want to use this web service, add

using wsTest.mx.gob.diconsa.www;
....

then you can consume it as

namespace wsTest
{
    class Program
    {
        static void Main(string[] args)
        {
            // This is the wrapper class defined in ws
            PRVCargaCFD ws = new PRVCargaCFD();
            StreamReader r = File.OpenText("c:\\test1.xml");
            string xml = r.ReadToEnd();
            r.Close();
            sbyte res = ws.Execute(1, xml);
            // do whatever you need with the result or call Execute again
            ....
            // Finally, dispose the object
            ws.Dispose();
        }
    }
}

that's it :)
0
 
tenriquez199Author Commented:
alexey a lot thanks

i'm testing you tell me ....i have dude....it can put in a default form? cause i did that, but have error

system tell me "can't find type or namespace wstest....missing using sirective or assemble reference"

could you help me please


error.jpg
0
 
alexey_gusevCommented:
you have to use your default namespace, not mine :)

so in your case it will be probably WebApplication1
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
tenriquez199Author Commented:
thanks alexey

other dude

that webservice work with 2 parameters ...how it will be the syntax ..cause i test 2 and have error.

            r.Close();
            string Strxml = xml;
            string Intproveedor = "1389";
            sbyte res = ws.Execute(Intproveedor ,Strxml );
            Console.WriteLine("Construido Objeto con el valor {0}",

also :
            sbyte res = ws.Execute(1,Intproveedor ,Strxml );

.........
you know wich is my error ?

thanks a lot
0
 
tenriquez199Author Commented:
excuse me.....i  solve it ...previous comment

now i have  next error:

"is not possible go to server. conection error with www.diconsa.gob.mx it look that remote debug monitor MSVSMON it not run at the remote server "


you know some about it?

thanks a lot


0
 
alexey_gusevCommented:
hmm, it looks strange. can you try both versions?

I've tested it from console app - works just fine
0
 
tenriquez199Author Commented:
alexev thnks

now my web server provider tell me i need to stay off debug

i have this error :
Error:debug remote MOnitor Microsoft Viusual Studio (MSVSMON.EXE) look down at remote server

you know wich can i do to avoid it?
0
 
tenriquez199Author Commented:
alexey thanks

i confuse
i don't have acces to remote server

that server is property a gobernemente institution..

how can i acces to remote server to run debug procees?

is ther other solution ..or i'm confuse


my provider tell me ...only stay off debug, but i don't know jow can we that
0
 
alexey_gusevCommented:
maybe they mean you cannot debug it? then try running it in release mode
0
 
tenriquez199Author Commented:
Alexey

wonderful

it run fine at test time.

also run fine at live time

thanks a lot
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now