怎样把民谣吉他品牌大全连接到电脑上 求大神指点

AXIS2 RCP/literal样式,两种MESSAGE定义方式SOAP的payload -
- ITeye技术网站
博客分类:
没有COMPLEXTYPE的MESSAGE WSDL文件内容
清单1:
&?xml version="1.0" encoding="UTF-8" standalone="no"?&
&wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="/RPCService/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="RPCService"
targetNamespace="/RPCService/"&
&wsdl:message name="concatRequest"&
&wsdl:part name="s1" type="xsd:string" /&
&wsdl:part name="s2" type="xsd:string"/&
&/wsdl:message&
&wsdl:message name="concatResponse"&
&wsdl:part name="out" type="xsd:string" /&
&/wsdl:message&
&wsdl:portType name="RPCService"&
&wsdl:operation name="concat"&
&wsdl:input message="tns:concatRequest" /&
&wsdl:output message="tns:concatResponse" /&
&/wsdl:operation&
&/wsdl:portType&
&wsdl:binding name="RPCServiceSOAP" type="tns:RPCService"&
&soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http" /&
&wsdl:operation name="concat"&
&soap:operation soapAction="/RPCService/concat" /&
&wsdl:input&
&soap:body namespace="/RPCService/"
use="literal" /&
&/wsdl:input&
&wsdl:output&
&soap:body namespace="/RPCService/"
use="literal" /&
&/wsdl:output&
&/wsdl:operation&
&/wsdl:binding&
&wsdl:service name="RPCService"&
&wsdl:port binding="tns:RPCServiceSOAP" name="RPCServiceSOAP"&
&soap:address location="http://localhost:8080/axis2/services/RPCService" /&
&/wsdl:port&
&/wsdl:service&
&/wsdl:definitions&
客户端调用时,直接使用AXIOM(lowlevel)的代码:
package com.ctgx.www.
import javax.xml.namespace.QN
import org.apache.axiom.om.OMAbstractF
import org.apache.axiom.om.OME
import org.apache.axiom.om.OMF
import org.apache.axis2.AxisF
import org.apache.axis2.addressing.EndpointR
import org.apache.axis2.client.O
import org.apache.axis2.client.ServiceC
* filename:LowLevelClient.java description: the file desciption goes here
* Copyright: Copyright(c)2010 CTGX *
* @author: 梁明杰
* @version: 1.0 Create at:
下午04:47:45
public class LowLevelClient {
* @param args
public static void main(String[] args) throws AxisFault {
ServiceClient client = new ServiceClient();
Options options = new Options();
//采用这种方式必须设定HTTP SOAPAction Header
options.setAction("/RPCService/concat");
options.setTo(new EndpointReference(
"http://localhost:1234/axis2/services/RPCService?wsdl"));
client.setOptions(options);
OMElement request = makeRequest();
OMElement response = client.sendReceive(request);
System.out.println(response.toString());
private static OMElement makeRequest() {
OMFactory factory = OMAbstractFactory.getOMFactory();
OMElement request = factory.createOMElement(new QName(
"/RPCService/", "concat"));
OMElement s1 = factory.createOMElement(new QName("s1"));
s1.setText("abc");
OMElement s2 = factory.createOMElement(new QName("s2"));
s2.setText("123");
request.addChild(s2);
request.addChild(s1);
对应的SOAP消息如下:
清单3:
&soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&
&soapenv:Body&
&axis2ns1:concat xmlns:axis2ns1="/RPCService/"&
&s2&123&/s2&
&s1&abc&/s1&
&/axis2ns1:concat&
&/soapenv:Body&
&/soapenv:Envelope&
使用COMPLEXTYPE的MESSAGE WSDL文件内容
清单4:
&?xml version="1.0" encoding="UTF-8" standalone="no"?&
&wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="/SimpleService1/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="SimpleService1"
targetNamespace="/SimpleService1/"&
&wsdl:types&
&xsd:schema targetNamespace="/SimpleService1/"&
&xsd:complexType name="concat"&
&xsd:sequence&
&xsd:element name="s1" type="xsd:string" /&
&xsd:element name="s2" type="xsd:string"&&/xsd:element&
&/xsd:sequence&
&/xsd:complexType&
&xsd:complexType name="concatResponse"&
&xsd:sequence&
&xsd:element name="out" type="xsd:string" /&
&/xsd:sequence&
&/xsd:complexType&
&/xsd:schema&
&/wsdl:types&
&wsdl:message name="concatRequest"&
&wsdl:part type="tns:concat" name="parameters" /&
&/wsdl:message&
&wsdl:message name="concatResponse"&
&wsdl:part type="tns:concatResponse" name="parameters" /&
&/wsdl:message&
&wsdl:portType name="SimpleService1"&
&wsdl:operation name="concat"&
&wsdl:input message="tns:concatRequest" /&
&wsdl:output message="tns:concatResponse" /&
&/wsdl:operation&
&/wsdl:portType&
&wsdl:binding name="SimpleServiceSOAP" type="tns:SimpleService1"&
&soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http" /&
&wsdl:operation name="concat"&
&soap:operation soapAction="/SimpleService1/concat" /&
&wsdl:input&
&soap:body use="literal" /&
&/wsdl:input&
&wsdl:output&
&soap:body use="literal" /&
&/wsdl:output&
&/wsdl:operation&
&/wsdl:binding&
&wsdl:service name="SimpleService"&
&wsdl:port binding="tns:SimpleServiceSOAP" name="SimpleServiceSOAP"&
&soap:address location="http://localhost:8080/axis2/services/SimpleService1" /&
&/wsdl:port&
&/wsdl:service&
&/wsdl:definitions&
客户端测试代码:
清单5:
package com.ctgx.www.simpleservice1;
import javax.xml.namespace.QN
import org.apache.axiom.om.OMAbstractF
import org.apache.axiom.om.OME
import org.apache.axiom.om.OMF
import org.apache.axis2.AxisF
import org.apache.axis2.addressing.EndpointR
import org.apache.axis2.client.O
import org.apache.axis2.client.ServiceC
* filename:LowLevelClient.java description: the file desciption goes here
* Copyright: Copyright(c)2010 CTGX *
* @author: 梁明杰
* @version: 1.0 Create at:
下午04:47:45
public class LowLevelClient {
* @param args
public static void main(String[] args) throws AxisFault {
ServiceClient client = new ServiceClient();
Options options = new Options();
options.setAction("/SimpleService1/concat");
options.setTo(new EndpointReference(
"http://localhost:1234/axis2/services/SimpleService1"));
client.setOptions(options);
OMElement request = makeRequest();
OMElement response = client.sendReceive(request);
System.out.println(response.toString());
private static OMElement makeRequest() {
OMFactory factory = OMAbstractFactory.getOMFactory();
OMElement request = factory.createOMElement(new QName(
"/SimpleService1/", "concat"));
OMElement parameters=factory.createOMElement(new QName("parameters"));
OMElement s1 = factory.createOMElement(new QName("s1"));
s1.setText("abc");
OMElement s2 = factory.createOMElement(new QName("s2"));
s2.setText("123");
request.addChild(parameters);
parameters.addChild(s1);
parameters.addChild(s2);
SOAP消息
清单6:
&soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&
&soapenv:Body&
&axis2ns1:concat xmlns:axis2ns1="/SimpleService1/"&
&parameters&
&s1&abc&/s1&
&s2&123&/s2&
&/parameters&
&/axis2ns1:concat&
&/soapenv:Body&
&/soapenv:Envelope&
需要说明的地方:
第一,清单1没有使用COMPLEXTYPE,清单4使用了COMPLEXTYPE 所以导致清单3和清单6的SOAP BODY 的消息不同。清单3中两个参数S1和S2直接包含在方法名concat中,且名字和MESSAGE的PART的名字相同。清单6中两个参数S1和S2包含在parameters中,parameters比如和MESSAGE part的名字,且PARAMETERS的两个元素就是COMPLEXTYPE中定义的元素。在SOAP中不能有类型和元素的引用,PARAMETERS实际上就构成了一个复合元素。
第二,清单3和清单6中S1和S2的顺序不同,这和AXIS2生成的服务端代码有关系。也就是说,MESSAGE中的PART顺序,不一定是方法中参数的顺序,不过使用COMPLEXTYPE方式定义,可以保证这一点。这和AXIS2的数据绑定有关系。
第三点,AXIS2对RCP/LITERAL的支持,实际上是DOCOMENT WRAPPER方式,也就是说,在RCP/LITERAL代码生成过程中,AXIS2做包装转换
附件是TCPMON应用程序,用来捕捉SOAP信息非常方便
(244.2 KB)
下载次数: 24
浏览: 9290 次
来自: 成都
需要重启linux吗?我说的是操作系统
错喽!!!不信
自己试试看!!!基于axis2的soap环境搭建_图文_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
基于axis2的soap环境搭建
上传于||文档简介
&&纯属私人学习使用
阅读已结束,如果下载本文需要使用5下载券
想免费下载本文?
定制HR最喜欢的简历
下载文档到电脑,查找使用更方便
还剩15页未读,继续阅读
定制HR最喜欢的简历
你可能喜欢java解析wsdl报告:服务器未能识别 HTTP 头 SOAPAction 的值,求解? - 开源中国社区
当前访客身份:游客 [
当前位置:
搜了下答案:
一、你把webserver地址加上?wsdl既可以解决问题,即
二、通过添加web引用方式的,你删除web引用再重新添加web引用即可,引用的地址还是&也不需要wsdl。
三、加上命名空间call.setOperationName(new QName(&.cn/&, &getSupportCity&));
上述办法都不行,这个错依旧在的。
请问为何这样?怎么解决掉呢?
我导入的jar包有:
共有2个回答
<span class="a_vote_num" id="a_vote_num_
嗨 我也碰到了这个问题 你解决了吗 不过用wsdl2java这种方式是没有问题的
你解决了吗
<span class="a_vote_num" id="a_vote_num_
Options options = client.getOptions();
options.setAction(&http://tempuri.org/Send&);
更多开发者职位上
有什么技术问题吗?
streaml...的其它问题
类似的话题在Axis2中提供了一个Axis2模块(soapmonitor),该模块实现了与中实现的logging模块相同的功能,所不同的是,logging模块直接将SOAP请求与响应消息输出到Tomcat控制台中,而soapmonitor模块利用applet直接在页面中输出SOAP请求和响应消息。
&&&&下面是配置和使用soapmonitor模块的步骤:&&&&
第1步:部署Applet和Servlet
&&&&由于axis2默认情况下已经自带了soapmonitor模块,因此,soapmonitor模块并不需要单独安装。但applet所涉及到的相应的.class文件需要安装一下。在&Tomcat安装目录&\webapps\axis2\WEB-INF\lib目录中找到soapmonitor-1.4.1.jar文件,将该文件解压。虽然applet并不需要soapmonitor-1.4.1.jar文件中所有的.class文件,但为了方便,读者也可以直接将解压目录中的org目录复制到&Tomcat安装目录&\webapps\axis2目录中,Applet所需的.class文件需要放在这个目录。然后再将org目录复制到&Tomcat安装目录&\webapps\axis2\WEB-INF\classes目录中,soapmonitor模块中的Servlet所对应的.class文件需要放在这个目录。
第2步:配置Servlet
&&&&打开&Tomcat安装目录&\webapps\axis2\WEB-INF\web.xml文件,在其中加入如下的内容:
servlet-name
&SOAPMonitorService
servlet-name
servlet-class
&&&&&&&&org.apache.axis2.soapmonitor.servlet.SOAPMonitorService
servlet-class
init-param
param-name
&SOAPMonitorPort
param-name
param-value
param-value
init-param
load-on-startup
load-on-startup
servlet-mapping
servlet-name
&SOAPMonitorService
servlet-name
url-pattern
&/SOAPMonitor
url-pattern
servlet-mapping
第3步:在services.xml文件中引用soapmonitor模块
与引用logging模块一样,引用soapmonitor模块也需要使用&module&元素,引用soapmonitor模块的services.xml文件的内容如下:
="myService"
description
&&&&&&&&使用logging和soapmonitor模块
description
&&引用logging模块&&
="logging"
&&引用soapmonitor模块&&
="soapmonitor"
parameter&
="ServiceClass"
&&&&&&&&service.MyService&&&
messageReceivers
messageReceiver&
="http://www.w3.org/2004/08/wsdl/in-out"
&&&&&&&&&&&&class
="org.apache.axis2.rpc.receivers.RPCMessageReceiver"
messageReceivers
&&&&由于soapmonitor模块已经在axis2.xml进行配置了,因此,在本例中不需要再对axis2.xml文件进行配置了。&&&&
第4步:使用soapmonitor模块
&&& 启动Tomcat后,在浏览器中输入如下的URL:
&&&&在浏览器中将出现soapmonitor所带的Applet的界面,当访问MyService的getGreeting方法时,在Tomcat控制台与Applet中都显示了相应的SOAP请求和响应消息。如图1和图2分别是调用了两次getGreeting方法后输出的SOAP请求和响应消息。
&&&&如果读者想让logging和soapmonitor模块监视部署在Axis2中的所有WebService,可以在axis2.xml文件中使用&module&元素来引用这两个模块,代码如下:
&&引用logging模块&&
="logging"
&&引用soapmonitor模块&&
="soapmonitor"
阅读(...) 评论()

我要回帖

更多关于 民谣吉他考级标准教程 的文章

 

随机推荐