急 .net 如何调用JAVA写的WEBSERVICE

weiwei309 2004-08-27 06:57:46
象给出以下地址的java webservice
请问在.NET中如何调用里面的方法
如果有可能,请付上例子
http://10.168.168.106:9080/axis//services/HTMLSaving?wsdl

谢谢各位
谢谢了
...全文
143 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sunyuanjun 2004-10-29
  • 打赏
  • 举报
回复
我以前写了.net,java的webservice,并且互想用.net,java客户端(全是WIN程序)调用很好的,没试过asp.net调用java的webservice.以下是在vs2003中C#的代码.不知对你有否帮助.
有些问题说明:参数好像有时不是很好传,我记得我java wse中用INT返回值就不行,改用string就可以了...
添加WEB引用可以的:http://10.10.1.197:8080/service1/services/Bean1?wsdl

if(this.comboBox2.SelectedIndex==0)//Java
{
strres="0";
java.Bean1Service bs=new java.Bean1Service();
switch(this.comboBox1.SelectedItem.ToString())
{
case "+":
strres=bs.Add(double.Parse(this.textBox1.Text),double.Parse(this.textBox2.Text)).ToString();
break;
case "-":
strres=bs.Sub(double.Parse(this.textBox1.Text),double.Parse(this.textBox2.Text)).ToString();
break;
case "*":
strres=bs.Multi(double.Parse(this.textBox1.Text),double.Parse(this.textBox2.Text)).ToString();
break;
case "/":
strres=bs.Div(double.Parse(this.textBox1.Text),double.Parse(this.textBox2.Text)).ToString();
break;
default:
MessageBox.Show("Java WebService : 找不到对应的运算符!!!");
break;
}
strres="Java : "+strres;
}
else if(this.comboBox2.SelectedIndex==1)//.NET
{
strres="0";
dotnet.Service1 s1=new dotnet.Service1();
switch(this.comboBox1.SelectedItem.ToString())
{
case "+":
strres=s1.Add(double.Parse(this.textBox1.Text),double.Parse(this.textBox2.Text)).ToString();
break;
case "-":
strres=s1.Sub(double.Parse(this.textBox1.Text),double.Parse(this.textBox2.Text)).ToString();
break;
case "*":
strres=s1.Multi(double.Parse(this.textBox1.Text),double.Parse(this.textBox2.Text)).ToString();
break;
case "/":
strres=s1.Div(double.Parse(this.textBox1.Text),double.Parse(this.textBox2.Text)).ToString();
break;
default:
MessageBox.Show(".NET WebService : 找不到对应的运算符!!!");
break;
}
strres=".NET : "+strres;
}
weiwei309 2004-08-27
  • 打赏
  • 举报
回复
以下是WSDL代码,谢谢了
--------------------------
<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://10.168.168.106:9080/axis//services/HTMLSaving" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://10.168.168.106:9080/axis//services/HTMLSaving" xmlns:intf="http://10.168.168.106:9080/axis//services/HTMLSaving" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://www.w3.org/1999/XMLSchema" xmlns:tns2="http://www.w3.org/2003/05/soap-encoding" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <!--
WSDL created by Apache Axis version: 1.2alpha
Built on Dec 01, 2003 (04:33:24 EST)

-->
- <wsdl:message name="SaveHtmlRequest">
<wsdl:part name="strFileCode" type="tns2:string" />
<wsdl:part name="strFileName" type="tns2:string" />
<wsdl:part name="strHtmlContent" type="tns2:string" />
</wsdl:message>
- <wsdl:message name="SaveHtmlResponse">
<wsdl:part name="SaveHtmlReturn" type="tns2:string" />
</wsdl:message>
- <wsdl:portType name="HTMLSaving">
- <wsdl:operation name="SaveHtml" parameterOrder="strFileCode strFileName strHtmlContent">
<wsdl:input message="impl:SaveHtmlRequest" name="SaveHtmlRequest" />
<wsdl:output message="impl:SaveHtmlResponse" name="SaveHtmlResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="HTMLSavingSoapBinding" type="impl:HTMLSaving">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="SaveHtml">
<wsdlsoap:operation soapAction="" />
- <wsdl:input name="SaveHtmlRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://logical.webservice.resoft.com.cn" use="encoded" />
</wsdl:input>
- <wsdl:output name="SaveHtmlResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://10.168.168.106:9080/axis//services/HTMLSaving" use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="HTMLSavingService">
- <wsdl:port binding="impl:HTMLSavingSoapBinding" name="HTMLSaving">
<wsdlsoap:address location="http://10.168.168.106:9080/axis//services/HTMLSaving" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
weiwei309 2004-08-27
  • 打赏
  • 举报
回复
那我代码怎么写啊
就比如我添加web引用名称为WS,而WEBSERVICE里有一个叫AA()的方法,怎么调用啊
luluso 2004-08-27
  • 打赏
  • 举报
回复
引用-添加web引用
这样用不行?

62,039

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧