[英]Manually creating proxy for Web Service
I have to communicate (using .NET) with a web service running on Axis 1.2. 我必须与Axis 1.2上运行的Web服务进行通信(使用.NET)。 Using two .NET tools and the WSDL I have created C# proxies however I ran into problems such that:
使用两个.NET工具和WSDL,我创建了C#代理,但是遇到了以下问题:
1) WSDL.exe created a proxy which lacks input parameters for methods. 1)WSDL.exe创建了一个缺少方法输入参数的代理。 eg if there should be such a method:
例如,是否应该有这样一种方法:
AReturnType AMethod(AnInputType);
the created proxy had such a method: 创建的代理具有以下方法:
void AMethod();
2) I've read that instead of WSDL.exe, SVCUTIL.exe is recommended. 2)我读到,推荐使用SVCUTIL.exe而不是WSDL.exe。 So I've created the proxies with SVCUTIL, however ran into the infamous problem of NULL returned objects.
所以我用SVCUTIL创建了代理,但是遇到了臭名昭著的NULL返回对象的问题 。 Unfortunately I could not find any suitable solution.
不幸的是,我找不到任何合适的解决方案。
So I am willing to do the setup manually. 因此,我愿意手动进行设置。 Here's what I have:
这是我所拥有的:
So what do you suggest? 所以你有什么建议? Is there a way to manually create the proxy somehow?
有没有办法以某种方式手动创建代理? Or can generated Java code help me somehow?
还是生成的Java代码可以以某种方式帮助我?
Here's how a project I'm working on creates and uses a manual proxy. 这是我正在从事的项目创建和使用手动代理的方式。
This is the client proxy: 这是客户端代理:
[ServiceContract(Name = "YourServiceContract", Namespace = "http://....")]
public interface YourServiceContract,
{
[OperationContract]
object GetObject(object searchCriteria);
}
public class YourClient : ClientBase<YourServiceContract>, YourServiceContract
{
public YourClient (){ }
public YourClient (string endpointConfigurationName)
: base(endpointConfigurationName){ }
public object GetObject(object searchCriteria)
{
return base.Channel.GetObject(searchCriteria);
}
}
This is how it's called: 这就是所谓的:
public void GetYourObject(object searchCriteria)
{
YourClient proxy = new YourClient();
proxy.GetObject(searchCriteria);
proxy.SafeClose();
}
Have a look at this answer. 看看这个答案。 Will allow you to make an HttpRequest directly:-
将允许您直接发出HttpRequest:-
有一组预定义的互操作绑定将WCF客户端与Java世界中的服务连接起来。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.