参数未传递到 .net webservice
我在将参数传递给 .Net Web 服务时遇到问题。我使用 axis 和 java 作为客户端。当我运行 java 客户端并同时调试 Web 服务时,我能够调用 Web 服务,但是当我检查传递给 .net Web 服务的参数时,该值什么都没有。我应该怎么办?
这是我的代码:
try {
String endpoint = "http://localhost/Test/Service.asmx?WSDL";
Service xxx = new Service();
Call call = (Call) (xxx.createCall());
sAcctNo = "test";
call.setTargetEndpointAddress( new java.net.URL(sEndPoint) );
call.setProperty(javax.xml.rpc.Call.SOAPACTION_USE_PROPERTY,new Boolean(true));
call.setProperty(javax.xml.rpc.Call.SOAPACTION_URI_PROPERTY,"http://tempuri.org/GetName");
call.setOperationName(new QName("GetName"));
call.setProperty(javax.xml.rpc.Call.OPERATION_STYLE_PROPERTY,"document");
call.addParameter( new QName("http://tempuri.org","str"),XMLType.XSD_STRING,ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);
call.setEncodingStyle(null);
ret = (String) call.invoke( new Object[]{ sAcctNo } );
out.println("You passed : '" + ret + "'");
} catch (Exception e) {
System.err.println(e.toString());
}
I'm having a problem in passing my parameters to a .Net webservice. I'm using axis and java as a client. when I run my java client and debug my webservice at the same time I am able to invoke the webservice but when I check the parameters passed to the .net webservice the value is nothing. what should I do?
Here is my code:
try {
String endpoint = "http://localhost/Test/Service.asmx?WSDL";
Service xxx = new Service();
Call call = (Call) (xxx.createCall());
sAcctNo = "test";
call.setTargetEndpointAddress( new java.net.URL(sEndPoint) );
call.setProperty(javax.xml.rpc.Call.SOAPACTION_USE_PROPERTY,new Boolean(true));
call.setProperty(javax.xml.rpc.Call.SOAPACTION_URI_PROPERTY,"http://tempuri.org/GetName");
call.setOperationName(new QName("GetName"));
call.setProperty(javax.xml.rpc.Call.OPERATION_STYLE_PROPERTY,"document");
call.addParameter( new QName("http://tempuri.org","str"),XMLType.XSD_STRING,ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);
call.setEncodingStyle(null);
ret = (String) call.invoke( new Object[]{ sAcctNo } );
out.println("You passed : '" + ret + "'");
} catch (Exception e) {
System.err.println(e.toString());
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这可能是操作名称的命名空间问题。
尝试替换:
与
命名空间是 QName 构造函数的第一个参数。它可能有助于调试来自工作 .NET 客户端的 SOAP 消息并与生成的 Java 客户端消息进行比较。
I think it might be a namespace issue with the operation name.
Try replacing:
with
Namespace is the first parameter of QName constructor. It might help to debug the SOAP message from a working .NET client and compare to the generated Java client message.