how can i do a web service project c# that i have in vicual basic

i have rhis code to do a web service project visual basic

Dim swCargar As New SwcargaXml.wCargaXml      'Definicion de variable del Servicio Web
Dim txtvar As String      'Variable que contendra el xml
Dim Restxt As String      'Variable que contendra el resultado
'la siguiente linea carga un archivo XML a la variable string txtvar
txtvar = My.Computer.FileSystem.ReadAllText("c:\prueba.xml")
Restxt = swCargar.CargarFacDigXml(txtvar, "#PROVEDOR", "PASSWORD")
MsgBox(txtvar)

i have a dude...how chenge line..
Dim swCargar As New SwcargaXml.wCargaXml

to visual c#

?

web serice reference is  http://admin.sanborns.com.mx/sisFactDig/sw/wCargaXml.asmx

comeone could help me

hanks lot
LVL 1
tenriquez199Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

srikanthreddyn143Commented:
SwcargaXml.wCargaXml  swCargar  = new SwcargaXml.wCargaXml();
0
CodeCruiserCommented:
Try this


SwcargaXml.wCargaXml swCargar = new SwcargaXml.wCargaXml();
string txtvar = null;
string Restxt = null;
txtvar = IO.File.ReadAllText("c:\\prueba.xml");
Restxt = swCargar.CargarFacDigXml(txtvar, "#PROVEDOR", "PASSWORD");
MessageBox.Show(txtvar);

Open in new window

0
tenriquez199Author Commented:
thenks srikanthreddyn143 , CodeCruiser

i have 2 errors:

1)Error      1      The type or namespace name 'SwcargaXml' could not be found (are you missing a using directive or an assembly reference?)      C:\WebServSanborns\Default.aspx.cs      23      9      C:\WebServSanborns\
2) Error      3      The name 'IO' does not exist in the current context      C:\WebServSanborns\Default.aspx.cs      26      18      C:\WebServSanborns\

that's the code:

using System;
using System.IO;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.UI.HtmlControls;


public partial class _Default : System.Web.UI.Page
{

    protected void Button1_Click(object sender, EventArgs e)
    {
        SwcargaXml.wCargaXml swCargar = new SwcargaXml.wCargaXml();
        string txtvar = null;
        string Restxt = null;
        txtvar = IO.File.ReadAllText("c:\\prueba.xml");
        Restxt = swCargar.CargarFacDigXml(txtvar, "#PROVEDOR", "PASSWORD");



im grateful with yours thanks a lot
error-web-service.JPG
0
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

CodeCruiserCommented:
For error 2:

change
txtvar = IO.File.ReadAllText("c:\\prueba.xml");

to
txtvar = File.ReadAllText("c:\\prueba.xml");


For 1st error, make sure you have added the reference and using statements for the service.
0
tenriquez199Author Commented:
thanks CodeCruiser ..error 2 is ok now, i still have error

i define the web refrence you copul see at image at right side, or i need to add other reference?

thanks

error-web-service2.JPG
0
srikanthreddyn143Commented:
Try this.

wCargaXml swCargar = new wCargaXml();
0
tenriquez199Author Commented:
thenks srikanthreddyn143

still have same error (Error      1      The type or namespace name 'wCargaXml' could not be found (are you missing a using directive or an assembly reference?)      C:\WebServSanborns\Default.aspx.cs      30      9      C:\WebServSanborns\
)
---------------------------------------------------------------------------------------------------------
this is the code :

using System;
using System.IO;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.ComponentModel;
using System.EnterpriseServices;
using System.Linq;
using System.Web.Services;
using System.Web;
using System.Xml;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.Services.Protocols;
using System.Web.UI.HtmlControls;





public partial class _Default : System.Web.UI.Page
{

    protected void Button1_Click(object sender, EventArgs e)
    {
        wCargaXml swCargar = new wCargaXml();
        string txtvar = null;
        string Restxt = null;
//        txtvar = IO.File.ReadAllText("c:\\prueba.xml");
        txtvar = File.ReadAllText("c:\\prueba.xml");

        Restxt = swCargar.CargarFacDigXml(txtvar, "#PROVEDOR", "PASSWORD");
error-web-service3.JPG
0
CodeCruiserCommented:
You need to use the proper namespace

Try this

wCargaXml.discomap.wCargaXml swCargar = new wCargaXml.discomap.wCargaXml();
0
tenriquez199Author Commented:
hi CodeCruiser thanks

still have the error ....have you some other idea?
Error      1      The type or namespace name 'wCargaXml' could not be found (are you missing a using directive or an assembly reference?)      C:\WebServSanborns\Default.aspx.cs      30      9      C:\WebServSanborns\

------------------

using System;
using System.IO;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.ComponentModel;
using System.EnterpriseServices;
using System.Linq;
using System.Web.Services;
using System.Web;
using System.Xml;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.Services.Protocols;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
    protected void Button1_Click(object sender, EventArgs e)
    {
        wCargaXml.discomap.wCargaXml swCargar = new wCargaXml.discomap.wCargaXml();
        string txtvar = null;
        string Restxt = null;
error-web-service4.JPG
0
CodeCruiserCommented:
You need to play with that. Use the intellisense to get to that class.
0
tenriquez199Author Commented:
hi... thanks yours comments.

to solve it was necesary add a using line, and write the web variable as this:

using mx.com.sanborns.admin;
.
.
 wCargaXml swCargar = new wCargaXml();



----------------------------------------

but now i run the application and have this error:

can not go automatically to the server, conection error with server 'admin.sanborns.com.mx'. the debugger can not connect to remote computer. there may be no such equipment or a firewal prevent comunication with it

-----------------------------

this is the code :

using System;
using System.IO;
using mx.com.sanborns.admin;

public partial class _Default : System.Web.UI.Page
{
    protected void Button1_Click(object sender, EventArgs e)
    {
       
        wCargaXml swCargar = new wCargaXml();
        string txtvar = null;
        string Restxt = null;
//        txtvar = IO.File.ReadAllText("c:\\prueba.xml");
        //txtvar = File.ReadAllText("c:\\prueba.xml");
        txtvar = File.ReadAllText("C:\\ValleRedondo\\facturacion electronica\\SANBORNS\\VRE640702H15_SHE190630V37_UA_25948.xml");
       
        Restxt = swCargar.CargarFacDigXml(txtvar, "#570301", "VRE640702H15");
       
    }
}



could help me

thanks a lot

error-web-service5.JPG
0
CodeCruiserCommented:
Does the provided address resolve to an IP using ping? Try adding http:// at the start
0
tenriquez199Author Commented:
hi CodeCruiser ...

i before had this error

simply was deactive debug = true at web.config , and it run fine
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CodeCruiserCommented:
Any points sir?
0
tenriquez199Author Commented:
excelent thanks all
0
maedgar321Commented:
Hi tenriquez199:

Could you help me I have the same problem as you, I could spend your code please
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.