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?
 
tenriquez199Connect With a Mentor Author Commented:
hi CodeCruiser ...

i before had this error

simply was deactive debug = true at web.config , and it run fine
0
 
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
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
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
 
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
 
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
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.

All Courses

From novice to tech pro — start learning today.