Solved

how can i consume a web service soap with c#

Posted on 2011-09-26
7
1,035 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need help on C# Linq query on object 6 53
Vb.net dynamic formulas in runtime 11 62
Automated testing suggestions? 2 28
Video Player 2017 5 14
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

895 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now