当前位置:编程学习 > C#/ASP.NET >>

wsdl报错问题

wsdl文件:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.ekangcn.com/model/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="math" targetNamespace="http://www.ekangcn.com/model/">
  <wsdl:types>
    <xsd:schema targetNamespace="http://localhost/soap_test/">
      <xsd:element name="add">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="in" type="xsd:string"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="addResponse">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="out" type="xsd:string"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.ekangcn.com/model/">
         <xsd:element name="ressssult" type="tns:NewType"></xsd:element>

         <xsd:complexType name="NewType">
         <xsd:sequence>
         <xsd:element name="wenjuan_id" type="xsd:int"></xsd:element>
         <xsd:element name="tijian_id" type="xsd:int"></xsd:element>
         <xsd:element name="yinsu_name" type="xsd:string"></xsd:element>
         <xsd:element name="yinsu_value" type="xsd:string"></xsd:element>
         <xsd:element name="bin_name" type="xsd:string"></xsd:element>
         <xsd:element name="yinsu_name_describe" type="xsd:string"></xsd:element>
         </xsd:sequence>
         </xsd:complexType>
        </xsd:schema>
    </wsdl:types>
  <wsdl:message name="addRequest">
    <wsdl:part name="x" type="xsd:int"/>
    <wsdl:part name="y" type="xsd:int"></wsdl:part>
  </wsdl:message>
  <wsdl:message name="addResponse">
    <wsdl:part name="addReturn" type="xsd:int"/>
  </wsdl:message>
  <wsdl:message name="subRequest">
   <wsdl:part name="b" type="xsd:int"></wsdl:part>
   <wsdl:part name="a" type="xsd:int"></wsdl:part>
  </wsdl:message>
  <wsdl:message name="subResponse">
   <wsdl:part name="subResponse" type="xsd:int"></wsdl:part>
  </wsdl:message>
  <wsdl:message name="insert_result_top3Request">
   <wsdl:part name="wenjuan_id" type="xsd:int"></wsdl:part>
   <wsdl:part name="tijian_id" type="xsd:int"></wsdl:part>
   <wsdl:part name="user_id" type="xsd:int"></wsdl:part>
  </wsdl:message>
  <wsdl:message name="top3Response">
   <wsdl:part name="top3Response"
   element="tns:result">
   </wsdl:part>
  </wsdl:message>
  <wsdl:message name="top3Res">
   <wsdl:part name="resss" element="tns:resss"></wsdl:part>
  </wsdl:message>
  <wsdl:portType name="math">
    <wsdl:operation name="add">
      <wsdl:input message="tns:addRequest"/>
      <wsdl:output message="tns:addResponse"/>
    </wsdl:operation>
    <wsdl:operation name="sub">
     <wsdl:input message="tns:subRequest"></wsdl:input>
     <wsdl:output message="tns:subResponse"></wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="insert_result_top3">
     <wsdl:input message="tns:insert_result_top3Request"></wsdl:input>
     <wsdl:output message="tns:top3Res"></wsdl:output>
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:binding name="mathBinding" type="tns:math">
   <soap:binding style="rpc"
   transport="http://schemas.xmlsoap.org/soap/http" />
   <wsdl:operation name="add">
   <soap:operation soapAction="http://localhost/soap_test/add" />
   <wsdl:input>
   <soap:body use="encoded"
   namespace="http://localhost/soap_test/"
   encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
   </wsdl:input>
   <wsdl:output>
   <soap:body use="encoded"
   namespace="http://localhost/soap_test/"
   encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
   </wsdl:output>
   </wsdl:operation>
   <wsdl:operation name="sub">
   <soap:operation soapAction="http://localhost/soap_test/sub" />
   <wsdl:input>
   <soap:body use="encoded"
   namespace="http://localhost/soap_test/"
   encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
   </wsdl:input>
   <wsdl:output>
   <soap:body use="encoded"
   namespace="http://localhost/soap_test/"
   encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
   </wsdl:output>
   </wsdl:operation>
   <wsdl:operation name="insert_result_top3">
   <soap:operation
   soapAction="http://localhost/soap_test/insert_result_top3" />
   <wsdl:input>
   <soap:body use="encoded"
   namespace="http://localhost/soap_test/"
   encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
   </wsdl:input>
   <wsdl:output>
   <soap:body use="encoded"
   namespace="http://localhost/soap_test/"
   encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
   </wsdl:output>
   </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="math">
    <wsdl:port binding="tns:mathBinding" name="mathSOAP">
      <soap:address location="http://www.ekangcn.com/model/server.php"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>


用.NET WebService Studio测试结果:


地址是:http://www.ekangcn.com/model/server.php?WSDL --------------------编程问答-------------------- 加到100分了 来个大神!!! --------------------编程问答-------------------- 我直接在vs的web项目中添加web服务引用,没有你说的那个问题。
--------------------编程问答-------------------- 你这能直接调用方法么? --------------------编程问答--------------------
引用 3 楼 u011681421 的回复:
你这能直接调用方法么?

输入如下代码,可以弹出20的结果,add也是可以的,insert_result_top3()没试。
 com.ekangcn.www.math math = new com.ekangcn.www.math();
            int result = math.sub(30, 10);
            MessageBox.Show(result + "");

--------------------编程问答-------------------- 没分了,搭车问下?

使用VB6调用WebService报错

语句如下:哪位高手帮忙看看,就剩10分了没法给,折现也行啊!

Private Sub cmdUpData_Click()
Dim soapClient As New SoapClient30
Dim dd As MSXML2.DOMDocument
Dim strSend As String

'On Error GoTo Err1

Set dd = New MSXML2.DOMDocument



strSend = "<s:Envelope xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/"">" & _
   "<s:Body>" & _
      "<PostSalesInfo xmlns=""http://tempuri.org/"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"">" & _
         "<sales>" & _
            "<PropertyId>1</PropertyId>" & _
            "<TenantId>8</TenantId>" & _
            "<ContractId>8</ContractId>" & _
            "<PosId>1</PosId>" & _
            "<SaleNo>201206290008</SaleNo>" & _
            "<SaleDate>2012-09-29T18:00:00.4904283+08:00</SaleDate>" & _
            "<DiscAmt>0</DiscAmt>" & _
            "<Amount>2500</Amount>" & _
            "<TaxAmt>0</TaxAmt>" & _
            "<Items>" & _
               "<SalesDetailModel>" & vbCrLf
strSend = strSend & "<Lines>1</Lines>" & _
                  "<ItemName>dfdfd</ItemName>" & _
                  "<Qty>1</Qty>" & _
                  "<Price>2500</Price>" & _
                  "<DiscAmt>0</DiscAmt>" & _
                  "<Amount>2500</Amount>" & _
                  "<TaxAmt>0</TaxAmt>" & _
                  "<Type>2</Type>" & _
                  "<Flag>1</Flag>" & _
                  "<PropertyId>1</PropertyId>" & _
                  "<TenantId>8</TenantId>" & _
                  "<PosId>1</PosId>" & _
                  "<SaleNo>201206290008</SaleNo>" & _
               "</SalesDetailModel>" & _
            "</Items>" & _
            "<Payments>" & _
            "<SalesPayModel>" & vbCrLf
strSend = strSend & "<Lines>1</Lines>" & _
                  "<PayCode>01</PayCode>" & _
                  "<PayAmt>2500</PayAmt>" & _
                  "<Flag>0</Flag>" & _
                  "<OtherAmt>0</OtherAmt>" & _
                  "<PropertyId>1</PropertyId>" & _
                  "<TenantId>8</TenantId>" & _
                  "<PosId>1</PosId>" & _
                  "<SaleNo>201206290008</SaleNo>" & _
               "</SalesPayModel>" & _
            "</Payments>" & _
         "</sales>" & _
      "</PostSalesInfo>" & _
   "</s:Body>" & _
"</s:Envelope>"
dd.loadXML strSend
soapClient.MSSoapInit "http://59.46.112.18:8082/service/POSServerWebService.asmx?WSDL"
soapClient.PostSalesInfo dd.xml
Exit Sub

Err1:
MsgBox soapClient.FaultString
End Sub


--------------------编程问答--------------------
引用 4 楼 guwei4037 的回复:
Quote: 引用 3 楼 u011681421 的回复:

你这能直接调用方法么?

输入如下代码,可以弹出20的结果,add也是可以的,insert_result_top3()没试。
 com.ekangcn.www.math math = new com.ekangcn.www.math();
            int result = math.sub(30, 10);
            MessageBox.Show(result + "");


能留个联系方式么?
补充:.NET技术 ,  Web Services
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,