问题描述
求救.如题.我用soapUI2.0.2测试过那个service有返回数值的.是复杂数据类型.但是当我用一个C#写的类去调用的时候连接是成功但无数据返回..查过很多网站也在过这里的网站.参照着做都不行.望大虾相救好象有人说.NET调用JAVA的WEBSERVICE如果返回是一般的类型如:string,int等就没问题.但一涉及到复杂数据类型就返回NULL是不是这样的啊?需要看WSDL文件吗?挺长的!<?xmlversion="1.0"encoding="utf-8"?><wsdl:definitionsxmlns:s1="http://response.webservice.au.gov.wa.tenders"xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"xmlns:s="http://www.w3.org/2001/XMLSchema"xmlns:s2="http://pojo.au.gov.wa.tenders"xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"xmlns:tns="http://webservice.au.gov.wa.tenders"xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"targetNamespace="http://webservice.au.gov.wa.tenders"xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"><wsdl:types><s:schemaxmlns="http://www.w3.org/2001/XMLSchema"elementFormDefault="Unqualified"targetNamespace="http://webservice.au.gov.wa.tenders"><s:importnamespace="http://pojo.au.gov.wa.tenders"/><s:importnamespace="http://response.webservice.au.gov.wa.tenders"/><s:elementname="getAllAgencies"><s:complexType/></s:element><s:elementname="getAllAgenciesResponse"><s:complexType><s:sequence><s:elementname="getAllAgenciesReturn"type="s1:AgencyWebServiceResponse"/></s:sequence></s:complexType></s:element><s:complexTypename="ArrayOf_xsd_string"><s:sequence><s:elementminOccurs="0"maxOccurs="unbounded"name="item"type="s:string"/></s:sequence></s:complexType><s:complexTypename="ArrayOf_tns2_Agency"><s:sequence><s:elementminOccurs="0"maxOccurs="unbounded"name="agencies"type="s2:Agency"/></s:sequence></s:complexType><s:elementname="getChildAgencies"><s:complexType><s:sequence><s:elementname="parentId"type="s:long"/></s:sequence></s:complexType></s:element><s:elementname="getChildAgenciesResponse"><s:complexType><s:sequence><s:elementname="getChildAgenciesReturn"type="s1:AgencyWebServiceResponse"/></s:sequence></s:complexType></s:element><s:elementname="getAgency"><s:complexType><s:sequence><s:elementname="agencyId"type="s:long"/></s:sequence></s:complexType></s:element><s:elementname="getAgencyResponse"><s:complexType><s:sequence><s:elementname="getAgencyReturn"type="s1:AgencyWebServiceResponse"/></s:sequence></s:complexType></s:element></s:schema><s:schemaxmlns="http://www.w3.org/2001/XMLSchema"elementFormDefault="Unqualified"targetNamespace="http://response.webservice.au.gov.wa.tenders"><s:importnamespace="http://webservice.au.gov.wa.tenders"/><s:importnamespace="http://pojo.au.gov.wa.tenders"/><s:complexTypename="WebServiceResponse"><s:sequence><s:elementname="exceptionMessage"nillable="true"type="s:string"/><s:elementname="invalid"type="s:boolean"/><s:elementname="methodName"nillable="true"type="s:string"/><s:elementname="numberOfRecords"type="s:int"/><s:elementname="serviceName"nillable="true"type="s:string"/><s:elementname="validationErrors"nillable="true"type="tns:ArrayOf_xsd_string"/></s:sequence></s:complexType><s:complexTypename="AgencyWebServiceResponse"><s:complexContentmixed="false"><s:extensionbase="s1:WebServiceResponse"><s:sequence><s:elementname="agencies"nillable="true"type="tns:ArrayOf_tns2_Agency"/></s:sequence></s:extension></s:complexContent></s:complexType></s:schema><s:schemaxmlns="http://www.w3.org/2001/XMLSchema"elementFormDefault="Unqualified"targetNamespace="http://pojo.au.gov.wa.tenders"><s:importnamespace="http://webservice.au.gov.wa.tenders"/><s:importnamespace="http://response.webservice.au.gov.wa.tenders"/><s:complexTypename="Agency"><s:sequence><s:elementname="abbrev"nillable="true"type="s:string"/><s:elementname="abn"nillable="true"type="s:string"/><s:elementname="agencyId"nillable="true"type="s:long"/><s:elementname="name"nillable="true"type="s:string"/><s:elementname="parentId"nillable="true"type="s:long"/><s:elementname="type"nillable="true"type="s:string"/></s:sequence></s:complexType></s:schema></wsdl:types><wsdl:messagename="getChildAgenciesRequest"><wsdl:partname="parameters"element="tns:getChildAgencies"/></wsdl:message><wsdl:messagename="getChildAgenciesResponse"><wsdl:partname="parameters"element="tns:getChildAgenciesResponse"/></wsdl:message><wsdl:messagename="getAllAgenciesRequest"><wsdl:partname="parameters"element="tns:getAllAgencies"/></wsdl:message><wsdl:messagename="getAgencyResponse"><wsdl:partname="parameters"element="tns:getAgencyResponse"/></wsdl:message><wsdl:messagename="getAllAgenciesResponse"><wsdl:partname="parameters"element="tns:getAllAgenciesResponse"/></wsdl:message><wsdl:messagename="getAgencyRequest"><wsdl:partname="parameters"element="tns:getAgency"/></wsdl:message><wsdl:portTypename="AgencyWebService"><wsdl:operationname="getAllAgencies"><wsdl:inputname="getAllAgenciesRequest"message="tns:getAllAgenciesRequest"/><wsdl:outputname="getAllAgenciesResponse"message="tns:getAllAgenciesResponse"/></wsdl:operation><wsdl:operationname="getChildAgencies"><wsdl:inputname="getChildAgenciesRequest"message="tns:getChildAgenciesRequest"/><wsdl:outputname="getChildAgenciesResponse"message="tns:getChildAgenciesResponse"/></wsdl:operation><wsdl:operationname="getAgency"><wsdl:inputname="getAgencyRequest"message="tns:getAgencyRequest"/><wsdl:outputname="getAgencyResponse"message="tns:getAgencyResponse"/></wsdl:operation></wsdl:portType><wsdl:bindingname="AgencyWebServiceSoapBinding"type="tns:AgencyWebService"><soap:bindingtransport="http://schemas.xmlsoap.org/soap/http"style="document"/><wsdl:operationname="getAllAgencies"><soap:operationsoapAction=""/><wsdl:inputname="getAllAgenciesRequest"><soap:bodyuse="literal"/></wsdl:input><wsdl:outputname="getAllAgenciesResponse"><soap:bodyuse="literal"/></wsdl:output></wsdl:operation><wsdl:operationname="getChildAgencies"><soap:operationsoapAction=""/><wsdl:inputname="getChildAgenciesRequest"><soap:bodyuse="literal"/></wsdl:input><wsdl:outputname="getChildAgenciesResponse"><soap:bodyuse="literal"/></wsdl:output></wsdl:operation><wsdl:operationname="getAgency"><soap:operationsoapAction=""/><wsdl:inputname="getAgencyRequest"><soap:bodyuse="literal"/></wsdl:input><wsdl:outputname="getAgencyResponse"><soap:bodyuse="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:servicename="AgencyWebServiceService"><wsdl:portname="AgencyWebService"binding="tns:AgencyWebServiceSoapBinding"><soap:addresslocation="http://dev.intecgroup.com.au/TendersWebServices/services/AgencyWebService"/></wsdl:port></wsdl:service></wsdl:definitions>
解决方案
解决方案二:
用SOAPUI测试下,返回的soapenvelope如下(调用其getAngency()参数是1)<soapenv:Envelopexmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><getAgencyResponsexmlns="http://webservice.au.gov.wa.tenders"><getAgencyReturn><agencies><agencies><abbrev>ICG</abbrev><abn>123</abn><agencyId>1</agencyId><name>Intec</name><parentId>23</parentId><type>agency</type></agencies></agencies><exceptionMessagexsi:nil="true"/><invalid>false</invalid><methodName>getAgency</methodName><numberOfRecords>1</numberOfRecords><serviceName>tenders.wa.gov.au.webservice.AdvertiserWebService</serviceName><validationErrorsxsi:nil="true"/></getAgencyReturn></getAgencyResponse></soapenv:Body></soapenv:Envelope>
解决方案三:
复杂数据类型,你看一下web引用中的是否有这个类型的声明.
解决方案四:
该回复于2008-03-16 10:33:01被版主删除
解决方案五:
复杂数据类型是不行比如list就会有问题的
解决方案六:
该回复于2008-03-15 20:12:30被版主删除
解决方案七:
该回复于2008-03-19 08:34:39被版主删除
解决方案八:
该回复于2008-03-19 08:36:00被版主删除
解决方案九:
都是很好的建议!值得学习