.NET连接到AXIS服务。方法没有参数或数据类型
|
使用.NET项目中的AXIS服务参考时,遇到了一些问题。我今天只是在int VS2010中添加了引用,但是提供的Method都没有返回类型或参数。我只是查看了生成的WSDL,它看起来像这样:(简称为Schema,也许缺少一些消息元素,但让我们关注参数的东西)
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<wsdl:definitions xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:intf=\"urn:api.broadmail.de/soap11/RpcSession\" xmlns:apachesoap=\"http://xml.apache.org/xml-soap\" xmlns:wsdlsoap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:tns2=\"http://lang.java\" xmlns:impl=\"urn:api.broadmail.de/soap11/RpcSession\" targetNamespace=\"urn:api.broadmail.de/soap11/RpcSession\" xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\">
<wsdl:types>
<xsd:schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"urn:api.broadmail.de/soap11/RpcSession\">
<xsd:import namespace=\"http://lang.java\" />
<xsd:import namespace=\"http://schemas.xmlsoap.org/soap/encoding/\" />
<xsd:complexType name=\"WebserviceException\">
<xsd:sequence>
<xsd:element name=\"cause\" nillable=\"true\" type=\"xsd:anyType\" />
<xsd:element name=\"message\" nillable=\"true\" type=\"xsd:string\" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name=\"loginRequest\">
<wsdl:part name=\"in0\" type=\"xsd:long\" />
<wsdl:part name=\"in1\" type=\"xsd:string\" />
<wsdl:part name=\"in2\" type=\"xsd:string\" />
</wsdl:message>
<wsdl:portType name=\"SessionWebservice\">
<wsdl:operation name=\"login\" parameterOrder=\"in0 in1 in2\">
<wsdl:input name=\"loginRequest\" message=\"impl:loginRequest\" />
<wsdl:output name=\"loginResponse\" message=\"impl:loginResponse\" />
<wsdl:fault name=\"WebserviceException\" message=\"impl:WebserviceException\" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name=\"RpcSessionSoapBinding\" type=\"impl:SessionWebservice\">
<wsdlsoap:binding transport=\"http://schemas.xmlsoap.org/soap/http\" style=\"rpc\" />
<wsdl:operation name=\"login\">
<wsdlsoap:operation soapAction=\"\" />
<wsdl:input name=\"loginRequest\">
<wsdlsoap:body use=\"encoded\" namespace=\"urn:api.broadmail.de/soap11/RpcSession\" encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" />
</wsdl:input>
<wsdl:output name=\"loginResponse\">
<wsdlsoap:body use=\"encoded\" namespace=\"urn:api.broadmail.de/soap11/RpcSession\" encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" />
</wsdl:output>
<wsdl:fault name=\"WebserviceException\">
<wsdlsoap:fault use=\"encoded\" name=\"WebserviceException\" namespace=\"urn:api.broadmail.de/soap11/RpcSession\" encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name=\"SessionWebserviceService\">
<wsdl:port name=\"RpcSession\" binding=\"impl:RpcSessionSoapBinding\">
<wsdlsoap:address location=\"https://api.broadmail.de/soap11/RpcSession\" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
之后,我查看了生成的代理类\“ reference.cs \”,通知该方法中没有参数。
namespace OptivoInterfaceApp.broadmailSession {
[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]
[System.ServiceModel.ServiceContractAttribute(Namespace=\"urn:api.broadmail.de/soap11/RpcSession\", ConfigurationName=\"broadmailSession.SessionWebservice\")]
public interface SessionWebservice {
[System.ServiceModel.OperationContractAttribute()]
void login();
}
[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]
public interface SessionWebserviceChannel : OptivoInterfaceApp.broadmailSession.SessionWebservice, System.ServiceModel.IClientChannel {
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]
public partial class SessionWebserviceClient : System.ServiceModel.ClientBase<OptivoInterfaceApp.broadmailSession.SessionWebservice>, OptivoInterfaceApp.broadmailSession.SessionWebservice {
public SessionWebserviceClient() {
}
public SessionWebserviceClient(string endpointConfigurationName) :
base(endpointConfigurationName) {
}
public SessionWebserviceClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public SessionWebserviceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public SessionWebserviceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress) {
}
public void login() {
base.Channel.login();
}
}
}
我是否必须将参数手动添加到代理类中,还是我做错了其他事情?我只是尝试手动添加参数,但是在方法调用上,我只得到一个异常。
对我有什么提示吗?
没有找到相关结果
已邀请:
1 个回复
膝垫富顷