.NET 连接到 AXIS 服务。方法没有参数或数据类型
我在使用 .NET 项目中的 AXIS 服务参考时遇到了一些问题。我今天只是添加了引用 int VS2010,但是提供的方法都没有返回类型或参数。我只是查看了生成的 WSDL,如下所示:(缩短了此架构,也许缺少一些消息元素,但让我们关注参数的事情)
<?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();
}
}
}
我是否必须手动将参数添加到我的代理类中,还是我做错了什么?我只是尝试手动添加参数,但在方法调用中我只得到一个异常。
有什么提示给我吗?
I got a few problems using the AXIS Service Reference from my .NET Project. I simply added the reference today int VS2010, but the provided Method do all have no return Type or Params. I just looked at the generated WSDL which looks like this : ( Shorted this Schema, maybe there are missing some message elements, but lets focus on the parameter thing )
<?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>
Afterwards I looked at my generated proxy class "reference.cs", notifying that there are no params in the methods.
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();
}
}
}
Do I have to add the params manually to my proxy class or am I doin something else wrong ? I just tried to add the params manually but on the methodcall I only get an exception.
Any Hints for me ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许你应该使用 WRAPPED 风格。
更多信息: http://axis.apache.org/axis/java/ user-guide.html#ServiceStylesRPCDocumentWrappedAndMessage
Maybe you should use WRAPPED style.
More info: http://axis.apache.org/axis/java/user-guide.html#ServiceStylesRPCDocumentWrappedAndMessage