象给出以下地址的java webservice
请问在.NET中如何调用里面的方法
如果有可能,请付上例子
http://10.168.168.106:9080/axis//services/HTMLSaving?wsdl谢谢各位
谢谢了

解决方案 »

  1.   

    引用-添加web引用
    这样用不行?
      

  2.   

    那我代码怎么写啊
    就比如我添加web引用名称为WS,而WEBSERVICE里有一个叫AA()的方法,怎么调用啊
      

  3.   

    以下是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>
      

  4.   

    我以前写了.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;
    }