Asked by:
How to use WSDL in asp.net

Question
-
User-1590246810 posted
Hi,
I need one clarfications, about using wsdl file. our 3 party client give it to me the XML file document like below for connecting to thier server.!
and i need to assign those mentioed paramters in that wsdl.!
How can i achieve it using web refrence file.
<div class="e"><?xml version="1.0" encoding="UTF-8" ?></div> <div class="k">- <!--
Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5.
--></div> <div class="k">- <!--
Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5.
--></div> <div class="e"> <div style="text-indent: -2em; margin-left: 1em;" class="c">- <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.xxx.billingadapter.ae/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.xxxx.adapter.ae/1.0" name="BillingAdapterWSv3"></div> <div style="display: block;"> <div class="e"> <div style="text-indent: -2em; margin-left: 1em;" class="c">- <types></div> <div> <div class="e"> <div style="text-indent: -2em; margin-left: 1em;" class="c">- <xsd:schema></div> <div> <div class="e"> <div style="text-indent: -2em; margin-left: 1em;"> <xsd:import namespace="http://www.xxx.adapter.ae/1.0" schemaLocation="http://xxx.com:80/AdapterV2/AdapterWSv3?xsd=1" /></div> </div> <div> </xsd:schema></div> </div> </div> <div> </types></div> </div> </div> <div class="e"> <div style="text-indent: -2em; margin-left: 1em;" class="c">- <message name="chargeImmediately"></div> <div> <div class="e"> <div style="text-indent: -2em; margin-left: 1em;"> <part name="parameters" element="tns:chargeImmediately" /></div> </div> <div> </message></div> </div> </div> <div class="e"> <div style="text-indent: -2em; margin-left: 1em;" class="c">- <message name="chargeImmediatelyResponse"></div> <div> <div class="e"> <div style="text-indent: -2em; margin-left: 1em;"> <part name="parameters" element="tns:chargeImmediatelyResponse" /></div> </div> <div> </message></div> <div>
</div> <div>
</div> <div>please help me on this, Really appreciate your help.</div> <div>
</div> <div>
</div> </div> </div> </div> </div>Monday, September 23, 2013 3:51 AM
All replies
-
User1143442848 posted
Hi,
According to your description, you want to import the xml parameters to the WSDL file and retrieve it in your web application.
Firstly, please try to refer to the steps below to import the xsd to wsdl:
1, Create new file in your text or XML editor. If the editor supports WSDLs, select WSDL as the file type. If it does not support WSDLs, but supports XML, select XML as the file type. If neither WSDLs or XML are supported, select a plain text file type.
2, Name the file with any name you desire, and give the file a ".wsdl" extension. For example, the file can be named "HelloWorld.wsdl."
3, Create a second new file in your text or XML editor. If the editor supports XML schemas, select XML schema or XSD as the file type. If it does not support XML schemas, but supports XML file, select XML as the file type. If neither XML schemas or XML are supported, select a plain text file type.
4, Name the file with any name you desire, and give the file a ".xsd" extension. For example, the file can be named "HelloWorld.xsd."
5, Enter the following markup in the XML schema file you created:
<?xml version="1.0" ?> <xsd:schema targetNamespace="http://schemas.myorg.com/person/phone" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:import namespace="http://www.w3.org/2001/XMLSchema"/> <xsd:complexType name="Phone"> <xsd:sequence> <xsd:element name="areaCode" type="xsd:int"/> <xsd:element name="exchange" type="xsd:int"/> <xsd:element name="number" type="xsd:int"/> </xsd:sequence> </xsd:complexType> </xsd:schema>
6, Enter the following markup in the WSDL file you created:
<?xml version="1.0"?> <wsdl:description xmlns:wsdl="http://www.w3.org/ns/wsdl" xmlns:wsoap= "http://www.w3.org/ns/wsdl/soap" xmlns:external="http://schemas.myorg.com/person/phone" xmlns:helloWorld="http://schemas.myorg.com/wsdl/helloworld" targetNamespace="http://schemas.myorg.com/wsdl/helloworld"> <wsdl:documentation> WSDL with an import example </wsdl:documentation> <wsdl:types> <xs:import namespace="http://schemas.myorg.com/person/phone" schemaLocation= "http://www.myorg.com/supporting/schemas/helloworld.xsd"/> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schemas.myorg.com/wsdl/helloworld"> <xsd:element name="CallNumber" type="external:Phone"/> <xsd:element name="HelloResponse" type="xsd:string"/> </xsd:schema> </wsdl:types> <wsdl:interface name="helloInterface" > <wsdl:operation name="CallMe" pattern="http://www.w3.org/ns/wsdl/in-out" style="http://www.w3.org/ns/wsdl/style/iri"> <wsdl:input messageLabel="In" element="helloWorld:CallNumber" /> <wsdl:output messageLabel="Out" element="helloWorld:HelloResponse" /> </wsdl:operation> </wsdl:interface> <wsdl:binding name="helloBinding" interface="hy:helloInterface" type="http://www.w3.org/ns/wsdl/soap" wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/"> <wsdl:operation ref="hy:Hello" wsoap:mep="http://www.w3.org/2003/05/soap/mep/soap-response"/> </wsdl:binding> <wsdl:service name="helloService" interface="hy:helloInterface"> <wsdl:endpoint name="helloEndpoint" binding="hy:helloBinding" address="http://www.myorg.com/Service/Hello"/> </wsdl:service> </wsdl:description>
For more information, please try to refer to below:
# How to import xsd to wsdl
http://www.ehow.com/how_7691573_import-xsd-wsdl.html .Secondly, please try to use WSDL in your web application. In order to use web service you can add that wsdl file in your visual studio project as a service reference and then you can use that web service.
For more information about how to use WSDL in asp.net please refer to:
# how to use wsdl?
http://forums.asp.net/t/1778628.aspx
Best Regards,
Lisa Zhang
Monday, September 23, 2013 11:18 PM -
User-1552614833 posted
The Web Services Description Language tool generates code for XML Web services and XML Web service clients from WSDL contract files, XSD schemas, and .discomap discovery documents.
http://msdn.microsoft.com/en-us/library/ms181855(v=vs.90).aspx
Consume Web Services usign WSDL and SOAP requests
http://forums.asp.net/t/1893206.aspx
refer posts
Tuesday, September 24, 2013 1:05 AM