Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello Experts,

I have a WSDL. But I don't know how to pass values to the functions in webservices. can anyone help me with this. Here is my wsdl

XML
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:sch="http://www.goodyear.com/spring-ws/thq/schemas/submitAdjustment" xmlns:tns="http://www.goodyear.com/spring-ws/thq/definitions/submitAdjustment" targetNamespace="http://www.goodyear.com/spring-ws/thq/definitions/submitAdjustment" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <schema xmlns:tns="http://www.goodyear.com/spring-ws/thq/schemas/submitAdjustment" elementFormDefault="qualified" targetNamespace="http://www.goodyear.com/spring-ws/thq/schemas/submitAdjustment" xmlns="http://www.w3.org/2001/XMLSchema">
      <element name="SubmitAdjustmentRequest">
        <complexType>
          <all>
            <element name="adjustment" type="tns:AdjustmentTo" />
          </all>
        </complexType>
      </element>
      <element name="SubmitAdjustmentResponse">
        <complexType>
          <sequence>
            <element minOccurs="0" maxOccurs="unbounded" name="adjustmentResults" type="tns:SubmitAdjustmentResult" />
          </sequence>
        </complexType>
      </element>
      <complexType name="AdjustmentTo">
        <sequence>
          <element minOccurs="1" name="address1" type="string" />
          <element minOccurs="0" name="address2" type="string" />
          <element minOccurs="1" name="city" type="string" />
          <element minOccurs="0" name="custEmail" type="string" />
          <element minOccurs="1" name="custName" type="string" />
          <element minOccurs="0" name="custNonsig" type="string" />
          <element minOccurs="0" name="custPhone" type="string" />
          <element minOccurs="1" name="dealerNonsigNbr" type="string" />
          <element minOccurs="0" name="docDispositionInd" type="string" />
          <element minOccurs="1" name="docNbr" type="string" />
          <element minOccurs="0" name="naNbr" type="string" />
          <element minOccurs="0" name="otherInfo" type="string" />
          <element minOccurs="1" name="postalCode" type="string" />
          <element minOccurs="1" name="stateProv" type="string" />
          <element minOccurs="1" name="shipDt" type="string" />
          <element minOccurs="0" name="vehicleID" type="string" />
          <element minOccurs="0" name="vehicleMake" type="string" />
          <element minOccurs="0" name="vehicleModel" type="string" />
          <element minOccurs="0" name="vehicleYear" type="string" />
          <sequence>
            <element minOccurs="1" maxOccurs="unbounded" name="lineItems" type="tns:AdjustmentLineItemTo" />
          </sequence>
        </sequence>
      </complexType>
      <complexType name="SubmitAdjustmentResult">
        <sequence>
          <element name="docId" type="string" />
          <element name="message" type="string" />
          <element name="reference" type="string" />
          <element name="step" type="string" />
        </sequence>
      </complexType>
      <complexType name="AdjustmentLineItemTo">
        <all>
          <element minOccurs="1" name="adjustmentType" type="string" />
          <element minOccurs="0" name="approvalNbr" type="string" />
          <element minOccurs="0" name="comment" type="string" />
          <element minOccurs="1" name="currentTreadDepth" type="integer" />
          <element minOccurs="1" name="prodCode" type="string" />
          <element minOccurs="1" name="prodDesc" type="string" />
          <element minOccurs="0" name="purchaseDt" type="string" />
          <element minOccurs="1" name="removalReasonCode" type="string" />
          <element minOccurs="1" name="replacementInvNbr" type="string" />
          <element minOccurs="0" name="replacementPrice" type="decimal" />
          <element minOccurs="1" name="tireID" type="string" />
          <element minOccurs="0" name="tireMileage" type="integer" />
          <element minOccurs="1" name="wheelPos" type="string" />
        </all>
      </complexType>
    </schema>
  </wsdl:types>
  <wsdl:message name="SubmitAdjustmentResponse">
    <wsdl:part name="SubmitAdjustmentResponse" element="sch:SubmitAdjustmentResponse" />
  </wsdl:message>
  <wsdl:message name="SubmitAdjustmentRequest">
    <wsdl:part name="SubmitAdjustmentRequest" element="sch:SubmitAdjustmentRequest" />
  </wsdl:message>
  <wsdl:portType name="SubmitAdjustment">
    <wsdl:operation name="SubmitAdjustment">
      <wsdl:input name="SubmitAdjustmentRequest" message="tns:SubmitAdjustmentRequest" />
      <wsdl:output name="SubmitAdjustmentResponse" message="tns:SubmitAdjustmentResponse" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="SubmitAdjustmentSoap11" type="tns:SubmitAdjustment">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="SubmitAdjustment">
      <soap:operation soapAction="" />
      <wsdl:input name="SubmitAdjustmentRequest">
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output name="SubmitAdjustmentResponse">
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="SubmitAdjustmentService">
    <wsdl:port name="SubmitAdjustmentSoap11" binding="tns:SubmitAdjustmentSoap11">
      <soap:address location="http://apps.test.tire-hq.com:80/thq/services" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>



Please let me know how to call functions from a webservice.
Posted
Comments
Kornfeld Eliyahu Peter 9-Feb-15 10:32am    
In your project add a web-reference to that WSDL, that will create a proxy around and voila...
sudevsu 9-Feb-15 11:08am    
I have added this wsdl in my project. But I don't know how to consume it
Kuthuparakkal 9-Feb-15 11:12am    
What's the source of that WDSL, it should be a url. So copy the Url and create a service reference and paste the url. VS would create a class (proxy) for it. Now consume the class like anyother class
sudevsu 9-Feb-15 11:53am    
"Now consume the class like any other class"
This where I am stuck. How do I consume the class ?
I have url
http://apps.test.tire-hq.com/thq/services.asmx/submitAdjustment.wsdl
When I add webreference I can see only one method SubmitAdjustment()
I created an object for it and passed values to that method. Now How do I know that it is submitted and how I do get a response?
Kuthuparakkal 9-Feb-15 12:38pm    
Follow: http://www.csharptutorial.in/37/csharp-net-how-to-consume-a-web-service-in-csharp-net-visual-studio-2010

Hi,

Follow below steps.
1) Create a service (webService/WCF).And copy the Service wsdl URl's similar to "http:-----/Service1.svc?wsdl"
2) Go to your Windows application's Solution Explorer. Right Click on your Project.
3) Select "Add Service Reference".
4) "Add Service Reference" dialogue box opens. Paste the URL of WSDL url you copied from service.
5)Click on "Go" button. You will find all the WebMethods in the service.
6) Rename Servicename in Name space text box to a meaningful service name.
7) Click "OK" button. You are done..!

Now use service name space you entered while adding in your windows application programming.
C#
MyService.Service1Client serv = new MyService.Service1Client();
            string s = serv.GetData(32);
 
Share this answer
 
Comments
sudevsu 9-Feb-15 12:52pm    
thank you. But this not what I am looking for. After doing all these. I got my service in my application. But I want to know How to call the function and get response of it.
sudevsu 9-Feb-15 12:55pm    
How do I know function accepted parameters and it is doing something and gives me a result?
Shridhar Gowda 9-Feb-15 13:27pm    
In the above example I given, function getdata() is in web service. It returns a string "you entered 32". U can view it in a messagebox.
sudevsu 9-Feb-15 13:55pm    
Thank you. Can you look at my WSDL and tell me if I can call <wsdl:input name="SubmitAdjustmentRequest" message="tns:SubmitAdjustmentRequest">
<wsdl:output name="SubmitAdjustmentResponse" message="tns:SubmitAdjustmentResponse">
methods.
Input for Parameters and Output for response?
Shridhar Gowda 10-Feb-15 1:41am    
Hi Sudevsu, WSDL is nothing to do with developer. WSDL is for client application to understand and generate service proxy. If you follow the 7 steps I mentioned, it will create the proxy and update the web.config automatically. When you create the object of this proxy and call the function in it, proxy will communicate with service and return you the result.
My WS doesn't have SOAP Headers. So I created a library file with Soap Header and called that dll in my web.config file and there you go it worked. There after I created an object for the service I added already using Add Web reference and passed the parameters.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900