如何从webservice调用函数? [英] How to call functions from webservice?

查看:68
本文介绍了如何从webservice调用函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Experts,



我有一个WSDL。但我不知道如何将值传递给webservices中的函数。谁能帮我这个。这是我的wsdl



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 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.




Please let me know how to call functions from a webservice.

推荐答案

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.

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.
MyService.Service1Client serv = new MyService.Service1Client();
            string s = serv.GetData(32);


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.
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.


这篇关于如何从webservice调用函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆