`
sliver08
  • 浏览: 9831 次
  • 性别: Icon_minigender_1
  • 来自: 福州
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

新知识补充WebService----实现多个返回值的办法

阅读更多
业务需求需要实现web service的方法能返回多个返回值,查阅了下axis的user guilde,实现起来其实很简单.
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();
		}
	}
}
分享到:
评论

相关推荐

    webservice-*.jar共5个jar包

    webservices-api-2.2.jar.zip webservices-extra-2.2.jar.zip webservices-extra-api-2.2.jar.zip webservices-rt-1.2.jar.zip webservices-tools-2.2.0-4.jar.zip 如果还需要其他jar包,请留言留邮箱,如果我有,就...

    webservice-cxf-spring-jar.zip

    【标题】"webservice-cxf-spring-jar.zip" 是一个包含了使用Apache CXF与Spring框架集成开发Web服务的Java库集合。这个压缩包提供了一整套必要的JAR文件,以便于开发者在他们的项目中快速搭建和运行基于CXF的Web服务...

    C#WebService-Soap扩展实现安全认证

    1、利用SoapExtension,SoapExtensionAttribute,实现Soap自定义Attribute(标签)扩展类。 2、利用SoapHeader应用Soap扩展。 3、在写WebService时只需加认证标签,客户端调用时传入SoapHeader,即可完成认证。 4、...

    dubbo-rpc-webservice-2.8.4

    dubbo-rpc-webservice-2.8.4 dubbo-rpc-webservice-2.8.4

    webservice--javademo

    【标题】"webservice--javademo" 涉及的知识点主要集中在Java Web Services(JAX-WS)上,这是一种用于创建Web服务的技术。在Java领域,Web服务是一种允许不同应用程序之间交换数据的方式,它基于开放标准,如SOAP...

    Python库 | PedalPi-WebService-0.3.0.tar.gz

    PedalPi-WebService-0.3.0的命名方式表明它是一个迭代版本,即0.3.0,这意味着它可能已经经过了多次改进和优化,修复了已知的bug,并可能引入了新的功能或性能提升。开发者在使用时,应当关注库的更新,以便充分...

    WebService-Axis2 详细讲解

    WebService-Axis2 详细讲解 WebService是一种基于XML的开放标准,用于在不同的应用程序之间进行通信。它允许不同系统之间的数据交换,打破了平台和语言的界限。Axis2是Apache软件基金会开发的一个高性能、灵活且可...

    webservice-client-demo.rar

    【描述】描述中提到的 "webservice-service1-demo" 可能是一个包含Web服务提供者端实现的项目,而 "webservice-client-demo" 则是其配套的客户端示例。这个客户端Demo将演示如何连接到 "webservice-service1-demo" ...

    webservice-service-demo.rar

    【标题】"webservice-service-demo.rar" 是一个包含SpringBoot 2.0集成Webservice服务的演示项目。这个压缩包提供了发布Webservice服务的基本步骤和关键组件,旨在帮助开发者了解如何在SpringBoot环境下构建和使用...

    Webservice-CXF实用手册学习大全

    WebService-CXF实用手册学习大全的知识点涵盖了WebService技术的多个方面,主要分为以下几个部分: 1. WebService基础: - WebService是一种通过网络提供服务的技术,使用HTTP作为传输协议,SOAP作为消息格式,...

    WebService------AXIS

    AXIS则是实现WebService的一种流行工具,它是由Apache软件基金会开发的一个开放源码项目,主要用于简化WebService的创建和消费。 AXIS的主要特点和优势包括: 1. **易用性**:AXIS提供了一套简单的命令行工具,...

    2、webservice--常用注解1

    @WebService 是一个基本的WebService 注解,它用来标注某个类将被发布为WebService。该注解具有以下属性: * name:指定WebService 的名称。 * targetNamespace:指定WebService 的命名空间。 * serviceName:指定...

    webservice-CXF-spring+maven

    【描述】"webservice-CXF-spring 实现server+client" 暗示了这个项目包含两个主要部分:服务端(Server)和客户端(Client)。在服务端,开发者将定义Web服务接口并实现其业务逻辑,然后使用CXF来发布这些服务。...

    EOS发布WebService-服务端

    标题中的“EOS发布WebService-服务端”指的是EOS(Enterprise Object Services)系统开发中关于构建Web服务服务器端的部分。EOS是一个面向对象的服务框架,通常用于构建分布式应用和企业级系统。在这样的系统中,...

    webService-cxf-demo

    【标题】"webService-cxf-demo" 是一个基于Apache CXF框架实现的Web服务示例项目,主要用于展示如何创建和使用Web服务。CXF是一个开源的Java框架,它提供了多种方式来开发符合WS-*标准的Web服务,包括SOAP、RESTful ...

    webService-xfire入门doc

    【描述】"webService-xfire入门" 提示我们这是一个初学者指南,旨在帮助用户理解如何开始使用XFire来创建和使用Web服务。这通常包括安装步骤、基本概念解释、配置教程以及一些简单的示例项目。 【标签】"webService...

    webservice-client-call axis

    综上所述,"webservice-client-call axis"涉及到的知识点主要包括Web服务的概念、Axis库的作用、WSDL和SOAP的解释、使用Axis调用Web服务客户端的步骤以及相关注意事项。在实际开发中,理解并熟练运用这些概念和技术...

    HDI-V-WebService-ToAtlas

    【标题】"HDI-V-WebService-ToAtlas" 指的可能是一个关于使用Web服务(WebService)集成到Atlas框架的教程或演示。在IT行业中,Web服务是一种通过HTTP协议进行通信,实现不同系统间数据交换的技术。而Atlas是微软ASP...

    [JAVA]-Axis-Webservice-Demo

    Java Axis Web服务示例(`[JAVA]-Axis-Webservice-Demo`)提供了发布和调用Web服务的实际操作步骤。通过学习和实践这个示例,开发者可以更好地掌握使用Axis创建Web服务的技术,理解Web服务的基本原理,以及如何通过...

    WebService-CXF.ppt

    WebService-CXF.ppt

Global site tag (gtag.js) - Google Analytics