日期:2014-05-19  浏览次数:20838 次

高手请进,关于webservice
我想用java调用.net   的webservice   遇到问题如下:
Service.cs
using   System;
using   System.Web;
using   System.Web.Services;
using   System.Web.Services.Protocols;

[WebService(Namespace   =   "http://www.wl.com/SU ")]
[WebServiceBinding(ConformsTo   =   WsiProfiles.BasicProfile1_1)]
public   class   Service   :   System.Web.Services.WebService
{
        public   Service   ()   {

                //如果使用设计的组件,请取消注释以下行  
                //InitializeComponent();  
        }
      [System.Web.Services.Protocols.SoapRpcMethodAttribute(Action   =   "http://www.wl.com/Rpc ",   RequestNamespace   =   "http://www.wl.com/SU ",   ResponseNamespace   =   "http://www.wl.com/SU ")]

        [WebMethod]
        public   string   HelloWorld(string   ls_aa,string   ip)   {
                string   tt   =   " ";
                if   (ls_aa   ==   " "   ||   ls_aa   ==   null)   tt   =   "哭哭哭哭 ";
                return   "Hello   World "   +   ls_aa   +   ip   +   tt;
        }
       
}

//声明:soaprpcmethod
[System.Web.Services.Protocols.SoapRpcMethodAttribute(Action   =   "http://www.wl.com/Rpc ",   RequestNamespace   =   "http://www.wl.com/SU ",   ResponseNamespace   =   "http://www.wl.com/SU ")]


此时报错,服务所启的页面中:应用程序中的服务器错误。
要使其一致,请更改服务的实现方法以使用“rpc-literal”或“document-literal”SOAP   消息。您需要将显式的   <font   class=value> Use=SoapBindingUse.Literal </font>   属性添加到所有服务和方法级别的特性中:   SoapRpcService、SoapRpcMethod、SoapDocumentService   和   SoapDocumentMethod


在线等。。。。


------解决方案--------------------
[WebService(Namespace = "http://www.wl.com/SU ")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

把这些去掉