Solved

how can i consume a web service soap with c#

Posted on 2011-09-26
7
1,031 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

762 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

20 Experts available now in Live!

Get 1:1 Help Now