浏览 5009 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2008-10-09
axis里面有多个类型的持有类比如StringHolder类等,我们只需要把传入的参数改为对应类型的持有类就可以了. 下面是我的例子: 实现类 public class NumwireserviceforCRMSoapBindingImpl implements com.geosoft.numwire.webservice.server.toCRM.NumwireServiceForCRM{ public int asiainfo__ResQueryCustomerId(java.lang.String in0, javax.xml.rpc.holders.StringHolder in1) throws java.rmi.RemoteException { in1.value="1212121"; return -3; } } wsdl文档: <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="urn:numwireservice" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="urn:numwireservice" xmlns:intf="urn:numwireservice" xmlns:soapenc="http://schemas.xmlsoap.org/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.4 Built on Apr 22, 2006 (06:55:48 PDT)--> <wsdl:message name="asiainfo__ResQueryCustomerIdRequest"> <wsdl:part name="in0" type="soapenc:string"/> <wsdl:part name="in1" type="soapenc:string"/> </wsdl:message> <wsdl:message name="asiainfo__ResQueryCustomerIdResponse"> <wsdl:part name="asiainfo__ResQueryCustomerIdReturn" type="xsd:int"/> <wsdl:part name="in1" type="soapenc:string"/> </wsdl:message> <wsdl:portType name="NumwireServiceForCRM"> <wsdl:operation name="asiainfo__ResQueryCustomerId" parameterOrder="in0 in1"> <wsdl:input message="impl:asiainfo__ResQueryCustomerIdRequest" name="asiainfo__ResQueryCustomerIdRequest"/> <wsdl:output message="impl:asiainfo__ResQueryCustomerIdResponse" name="asiainfo__ResQueryCustomerIdResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="numwireserviceforCRMSoapBinding" type="impl:NumwireServiceForCRM"> <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="asiainfo__ResQueryCustomerId"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="asiainfo__ResQueryCustomerIdRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:numwireservice" use="encoded"/> </wsdl:input> <wsdl:output name="asiainfo__ResQueryCustomerIdResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:numwireservice" use="encoded"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="NumwireServiceForCRMService"> <wsdl:port binding="impl:numwireserviceforCRMSoapBinding" name="numwireserviceforCRM"> <wsdlsoap:address location="http://localhost:8080/services/numwireserviceforCRM"/> </wsdl:port> </wsdl:service> </wsdl:definitions> 调用: import java.net.MalformedURLException; import java.net.URL; import java.rmi.RemoteException; import javax.xml.rpc.ServiceException; import javax.xml.rpc.holders.StringHolder; import com.geosoft.numwire.webservice.server.toCRM.NumwireServiceForCRMServiceLocator; import com.geosoft.numwire.webservice.server.toCRM.NumwireserviceforCRMSoapBindingStub; public class TestMultyReturn { public static void main(String[] args) { NumwireServiceForCRMServiceLocator forCRMServiceLocator=new NumwireServiceForCRMServiceLocator(); NumwireserviceforCRMSoapBindingStub bindingStub=null; try { java.net.URL url=new URL("/*你的服务部署的url*/"); bindingStub=(NumwireserviceforCRMSoapBindingStub) forCRMServiceLocator.getnumwireserviceforCRM(url); String in0="aaaaa"; StringHolder in1=new StringHolder("sdsds"); bindingStub.asiainfo__ResQueryCustomerId(in0, in1); System.out.println(in1.value);//打印出来的是改变后的值 } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |