?
Solved

how can i consume a web service soap with c#

Posted on 2011-09-26
7
Medium Priority
?
1,101 Views
Last Modified: 2013-12-17
hi..

i need to sonsume a web service with c#.

it web service run at this url http://www.diconsa.gob.mx/SiCFDQA/servlet/aprvcargacfd

it show this :

  <?xml version="1.0" encoding="UTF-8" ?>
  <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />


the description is at : http://www.diconsa.gob.mx/SiCFD/servlet/aprvcargacfd?wsdl

and show it :

<?xml version="1.0" encoding="UTF-8" ?>
- <definitions name="PRVCargaCFD" targetNamespace="SiCFD" xmlns:tns="SiCFD" xmlns:wsdlns="SiCFD" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns1="SiCFD" xmlns:tns2="Genexus">
- <types>
- <schema targetNamespace="SiCFD" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" elementFormDefault="qualified">
  <import namespace="Genexus" />
- <element name="PRVCargaCFD.Execute">
- <complexType>
- <sequence>
  <element minOccurs="1" maxOccurs="1" name="Intproveedor" type="xsd:int" />
  <element minOccurs="1" maxOccurs="1" name="Strxml" type="xsd:string" />
  </sequence>
  </complexType>
  </element>
- <element name="PRVCargaCFD.ExecuteResponse">
- <complexType>
- <sequence>
  <element minOccurs="1" maxOccurs="1" name="Intrespuesta" type="xsd:byte" />
  </sequence>
  </complexType>
  </element>
  </schema>
  </types>
- <message name="PRVCargaCFD.ExecuteSoapIn">
  <part name="parameters" element="tns:PRVCargaCFD.Execute" />
  </message>
- <message name="PRVCargaCFD.ExecuteSoapOut">
  <part name="parameters" element="tns:PRVCargaCFD.ExecuteResponse" />
  </message>
- <portType name="PRVCargaCFDSoapPort">
- <operation name="Execute">
  <input message="wsdlns:PRVCargaCFD.ExecuteSoapIn" />
  <output message="wsdlns:PRVCargaCFD.ExecuteSoapOut" />
  </operation>
  </portType>
- <binding name="PRVCargaCFDSoapBinding" type="wsdlns:PRVCargaCFDSoapPort">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <operation name="Execute">
  <soap:operation soapAction="SiCFDaction/APRVCARGACFD.Execute" />
- <input>
  <soap:body use="literal" />
  </input>
- <output>
  <soap:body use="literal" />
  </output>
  </operation>
  </binding>
- <service name="PRVCargaCFD">
- <port name="PRVCargaCFDSoapPort" binding="wsdlns:PRVCargaCFDSoapBinding">
  <soap:address location="http://www.diconsa.gob.mx/SiCFD/servlet/aprvcargacfd" />
  </port>
  </service>
  </definitions>



could help me to develope solution with c# web

some one could help me please

0
Comment
Question by:tenriquez199
  • 4
  • 2
7 Comments
 
LVL 18

Expert Comment

by:Gary Davis
ID: 36610388
You would start with adding a web reference and supply the address of the wsdl url.

Right click the project in solution explorer and choose Add Service Reference. Click Advanced on the bottom left and then click Add Web Reference.

Then in your code, you will be able to create an instance of the web service, set its properties and call its methods.

Gary Davis

0
 
LVL 1

Author Comment

by:tenriquez199
ID: 36619522
hi gardavis thanks

i did you tell me but  system give me a message

the file at URL http://www.diconsa.gob.mx/SiCFD/servlet/aprvcargacfd  cant recongnize as a know file.
the type files error message can you solve the problem
- the  'Esquema XML'  report is  'the root element is an W3 schema




you know how solve it?

thanks a lot


web-service-soap-error.JPG
0
 
LVL 18

Expert Comment

by:Gary Davis
ID: 36623275
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
LVL 17

Expert Comment

by:sonawanekiran
ID: 36707614
You need to
Add Service Reference >> Advance >> Add Web Reference and use below url

http://www.diconsa.gob.mx/SiCFD/servlet/aprvcargacfd?wsdl


See below screenshot



image001.png
0
 
LVL 1

Accepted Solution

by:
tenriquez199 earned 0 total points
ID: 36710356
thanks gardavis, sonawanekiran

i yet can assign the web service reference.

now when i run my application have an error... system tell me that:

Serever error at '/DICONSA' appplication.
You can not implement the method or operation
Description: An unhandled exception when running the current web request. Check the stack trace for more information about the error and where it originated in the code.
Detalles de la excepción: System.NotImplementedException: No se puede implementar el método o la operación.
Type text or a website address or translate a document.
Cancel
Spanish - detected to English translation
Exception Details: System.NotImplementedException: Unable to implement the method or operation.
Source Error:
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable it, do one of these steps and then reapply the URL:
1. Add a directive "Debug = true" at the top of the file that generated the error. example:
Stack Trace:

[NotImplementedException: No se puede implementar el método o la operación.]
   PRVCargaCFD.Execute(Int16 Intproveedor, String Strxml) +28
   WebApplication1_Default.Button1_Click(Object sender, EventArgs e) +79
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563




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

as you can see....some part of messages say me enable debug, ...but it is not posibble when my application need to consume a web service as it is
0
 
LVL 1

Author Comment

by:tenriquez199
ID: 37793642
i was testing wrong

i found that i dont have to run in a test mode when i consume a service

tanks a lot
0
 
LVL 1

Author Closing Comment

by:tenriquez199
ID: 37795195
thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question