?
Solved

how can i consume a web service soap with c#

Posted on 2011-09-26
7
Medium Priority
?
1,074 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

 
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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The viewer will learn how to count occurrences of each item in an array.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

764 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