请问如何用c#调用这个wsdl的webservice
我用vs2008生成了客户端,但是始终有异常抛出
不能发附件,只能贴代码了
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:tns1="urn:IntegralBasicInfoQuery" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:impl="http://136.5.74.105:9080/AIIntegralWeb/services/AIIntegralBasicInfoQueryForCQService" xmlns:intf="http://136.5.74.105:9080/AIIntegralWeb/services/AIIntegralBasicInfoQueryForCQService" targetNamespace="http://136.5.74.105:9080/AIIntegralWeb/services/AIIntegralBasicInfoQueryForCQService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:IntegralBasicInfoQuery">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:complexType name="IntegralBasicInfo">
<xsd:sequence>
<xsd:element name="consumePoint" nillable="true" type="xsd:string" />
<xsd:element name="custID" nillable="true" type="xsd:string" />
<xsd:element name="freezePoint" nillable="true" type="xsd:string" />
<xsd:element name="newPoint" nillable="true" type="xsd:string" />
<xsd:element name="note" nillable="true" type="xsd:string" />
<xsd:element name="totalPoint" nillable="true" type="xsd:string" />
<xsd:element name="usablePoint" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IntegralBasicInfoQueryForCQRequest">
<wsdl:part name="TimeStamp" type="xsd:string" />
<wsdl:part name="UserNum" type="xsd:string" />
<wsdl:part name="UserType" type="xsd:string" />
<wsdl:part name="BillDate" type="xsd:string" />
<wsdl:part name="SystemCode" type="xsd:string" />
<wsdl:part name="Result" type="xsd:int" />
<wsdl:part name="Status" type="xsd:string" />
<wsdl:part name="ErrorDescription" type="xsd:string" />
<wsdl:part name="ExtendField" type="xsd:string" />
</wsdl:message>
<wsdl:message name="IntegralBasicInfoQueryForCQResponse">
<wsdl:part name="IntegralBasicInfoQueryForCQReturn" type="tns1:IntegralBasicInfo" />
<wsdl:part name="Result" type="xsd:int" />
<wsdl:part name="Status" type="xsd:string" />
<wsdl:part name="ErrorDescription" type="xsd:string" />
<wsdl:part name="ExtendField" type="xsd:string" />
</wsdl:message>
<wsdl:portType name="IntegralImpl">
<wsdl:operation name="IntegralBasicInfoQueryForCQ" parameterOrder="TimeStamp UserNum UserType BillDate SystemCode Result Status ErrorDescription ExtendField">
<wsdl:input name="IntegralBasicInfoQueryForCQRequest" message="intf:IntegralBasicInfoQueryForCQRequest" />
<wsdl:output name="IntegralBasicInfoQueryForCQResponse" message="intf:IntegralBasicInfoQueryForCQResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AIIntegralBasicInfoQueryForCQServiceSoapBinding" type="intf:IntegralImpl">
<wsdlsoap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
<wsdl:operation name="IntegralBasicInfoQueryForCQ">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="IntegralBasicInfoQueryForCQRequest">
<wsdlsoap:body use="encoded" namespace="http://webservice.asiainfo.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:input>
<wsdl:output name="IntegralBasicInfoQueryForCQResponse">
<wsdlsoap:body use="encoded" namespace="http://136.5.74.105:9080/AIIntegralWeb/services/AIIntegralBasicInfoQueryForCQService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="IntegralImplService">
<wsdl:port name="AIIntegralBasicInfoQueryForCQService" binding="intf:AIIntegralBasicInfoQueryForCQServiceSoapBinding">
<wsdlsoap:address location="http://136.5.74.105:9080/AIIntegralWeb/services/AIIntegralBasicInfoQueryForCQService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
我用vs2008生成了客户端,但是始终有异常抛出
不能发附件,只能贴代码了
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:tns1="urn:IntegralBasicInfoQuery" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:impl="http://136.5.74.105:9080/AIIntegralWeb/services/AIIntegralBasicInfoQueryForCQService" xmlns:intf="http://136.5.74.105:9080/AIIntegralWeb/services/AIIntegralBasicInfoQueryForCQService" targetNamespace="http://136.5.74.105:9080/AIIntegralWeb/services/AIIntegralBasicInfoQueryForCQService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:IntegralBasicInfoQuery">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:complexType name="IntegralBasicInfo">
<xsd:sequence>
<xsd:element name="consumePoint" nillable="true" type="xsd:string" />
<xsd:element name="custID" nillable="true" type="xsd:string" />
<xsd:element name="freezePoint" nillable="true" type="xsd:string" />
<xsd:element name="newPoint" nillable="true" type="xsd:string" />
<xsd:element name="note" nillable="true" type="xsd:string" />
<xsd:element name="totalPoint" nillable="true" type="xsd:string" />
<xsd:element name="usablePoint" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IntegralBasicInfoQueryForCQRequest">
<wsdl:part name="TimeStamp" type="xsd:string" />
<wsdl:part name="UserNum" type="xsd:string" />
<wsdl:part name="UserType" type="xsd:string" />
<wsdl:part name="BillDate" type="xsd:string" />
<wsdl:part name="SystemCode" type="xsd:string" />
<wsdl:part name="Result" type="xsd:int" />
<wsdl:part name="Status" type="xsd:string" />
<wsdl:part name="ErrorDescription" type="xsd:string" />
<wsdl:part name="ExtendField" type="xsd:string" />
</wsdl:message>
<wsdl:message name="IntegralBasicInfoQueryForCQResponse">
<wsdl:part name="IntegralBasicInfoQueryForCQReturn" type="tns1:IntegralBasicInfo" />
<wsdl:part name="Result" type="xsd:int" />
<wsdl:part name="Status" type="xsd:string" />
<wsdl:part name="ErrorDescription" type="xsd:string" />
<wsdl:part name="ExtendField" type="xsd:string" />
</wsdl:message>
<wsdl:portType name="IntegralImpl">
<wsdl:operation name="IntegralBasicInfoQueryForCQ" parameterOrder="TimeStamp UserNum UserType BillDate SystemCode Result Status ErrorDescription ExtendField">
<wsdl:input name="IntegralBasicInfoQueryForCQRequest" message="intf:IntegralBasicInfoQueryForCQRequest" />
<wsdl:output name="IntegralBasicInfoQueryForCQResponse" message="intf:IntegralBasicInfoQueryForCQResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AIIntegralBasicInfoQueryForCQServiceSoapBinding" type="intf:IntegralImpl">
<wsdlsoap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
<wsdl:operation name="IntegralBasicInfoQueryForCQ">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="IntegralBasicInfoQueryForCQRequest">
<wsdlsoap:body use="encoded" namespace="http://webservice.asiainfo.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:input>
<wsdl:output name="IntegralBasicInfoQueryForCQResponse">
<wsdlsoap:body use="encoded" namespace="http://136.5.74.105:9080/AIIntegralWeb/services/AIIntegralBasicInfoQueryForCQService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="IntegralImplService">
<wsdl:port name="AIIntegralBasicInfoQueryForCQService" binding="intf:AIIntegralBasicInfoQueryForCQServiceSoapBinding">
<wsdlsoap:address location="http://136.5.74.105:9080/AIIntegralWeb/services/AIIntegralBasicInfoQueryForCQService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
这个是用网络工具截下来的消息,感觉是有问题的,和我用java发过去的正常请求不一样未处理 System.ServiceModel.FaultException
Message="无效的数字签名!; nested exception is: \n\tjava.lang.Exception: 无效的标签:<sec:IntegralImplService>"
Source="mscorlib"
StackTrace:
Server stack trace:
在 System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
在 OdsWebService.OdsServiceReference.IntegralImpl.IntegralBasicInfoQueryForCQ(IntegralBasicInfoQueryForCQRequest request)
在 OdsWebService.OdsServiceReference.IntegralImplClient.OdsWebService.OdsServiceReference.IntegralImpl.IntegralBasicInfoQueryForCQ(IntegralBasicInfoQueryForCQRequest request) 位置 D:\Visual Studio 2008\Projects\OdsWebService\OdsWebService\OdsWebService\Service References\OdsServiceReference\Reference.cs:行号 251
在 OdsWebService.OdsServiceReference.IntegralImplClient.IntegralBasicInfoQueryForCQ(String TimeStamp, String UserNum, String UserType, String BillDate, String SystemCode, Int32& Result, String& Status, String& ErrorDescription, String& ExtendField) 位置 D:\Visual Studio 2008\Projects\OdsWebService\OdsWebService\OdsWebService\Service References\OdsServiceReference\Reference.cs:行号 265
在 OdsWebService.Form1.confirm_Click(Object sender, EventArgs e) 位置 D:\Visual Studio 2008\Projects\OdsWebService\OdsWebService\OdsWebService\Form1.cs:行号 27
在 System.Windows.Forms.Control.OnClick(EventArgs e)
在 System.Windows.Forms.Button.OnClick(EventArgs e)
在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
在 System.Windows.Forms.Button.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
在 System.Windows.Forms.Application.Run(Form mainForm)
在 OdsWebService.Program.Main() 位置 D:\Visual Studio 2008\Projects\OdsWebService\OdsWebService\OdsWebService\Program.cs:行号 18
在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
InnerException:
这个是异常
这个是正确的消息
wsdl中并没有关于SoapHeader的描述我有个webservice用C#写的也需要soapheader.它的wsdl中包含<wsdl:input>
<soap:body use="literal" />
<soap:header message="tns:GetPurchasedExtrasAuthHeader" part="AuthHeader" use="literal" />
</wsdl:input>其它地方有对AuthHeader的定义。
wsdl中并没有关于SoapHeader的描述我有个webservice用C#写的也需要soapheader.它的wsdl中包含<wsdl:input>
<soap:body use="literal" />
<soap:header message="tns:GetPurchasedExtrasAuthHeader" part="AuthHeader" use="literal" />
</wsdl:input>其它地方有对AuthHeader的定义。