jaxbelement string<string>怎么实例

xfire学习总结_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
xfire学习总结
上传于||文档简介
&&x​f​i​r​e​学​习​总​结
阅读已结束,如果下载本文需要使用1下载券
想免费下载本文?
下载文档到电脑,查找使用更方便
还剩17页未读,继续阅读
你可能喜欢JAVA中,当我这样定义变量时:Collection&String&n=new ArrayList&String&(),变量n是ArrayList类型吗?_百度知道
JAVA中,当我这样定义变量时:Collection&String&n=new ArrayList&String&(),变量n是ArrayList类型吗?
提问者采纳
();String&gt,因此List有的方法;String&gt,有些方法可以调用不了,因为Collection里没有定义.String&gt,ArrayList也会有你应该这样定义List&lt,而ArrayList实现了List接口.println(n instanceof ArrayList);n=new ArrayList&(),你可以用 instanceof 关键定来判断System,有些方法只有List才有Collection&lt,不过不建议这样定义因为Collection是List和Set的直接父类; n = new ArrayList&这是java的多态的表现当你不知道实例变量是哪个类型的时候;String&这样定义的话是的
提问者评价
谢谢虽然你说的”我那种定义方法使变量没有List接口特有的方法“这点我迟疑,讲解很还是很耐心
其他类似问题
为您推荐:
其他2条回答
n=new ArrayList&String&();String&gt最好还是用List&lt
对,变量n所代表的实例就是一个ArrayList
arraylist的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁c语言中strrev怎么用?_百度知道
c语言中strrev怎么用?
strrev用于反转字符串.原型:extern char *strrev(char *s);用法:#include &string.h&功能:把字符串s的所有字符的顺序颠倒过来(不包括空字符NULL)。说明:返回指向颠倒顺序后的字符串指针。实例:#include&syslib.h&#include&string.h&main(){char*s=&WelcomeToBeijing&;&a target=&_blank& href=&/subview/;653995.htm&&clrscr&/a&();&a target=&_blank& href=&/subview/;1081126.htm&&textmode&/a&(0x00);//6linesperscreenprintf(&%s\n%s&,s,strrev(&a target=&_blank& href=&/subview/;1028541.htm&&strdup&/a&(s)));getchar();return0;}strrev(&a target=&_blank& href=&/subview/;678837.htm&&PHP4&/a&,&a target=&_blank& href=&/subview/110.htm&&PHP5&/a&)strrev—Reverseastring//PHP&?phpechostrrev(&&a target=&_blank& href=&/subview/;244883.htm&&HelloWorld&/a&!&);?&
其他类似问题
为您推荐:
string );&quot, whether/ if( result == 0 ) printf( &The string \/;/ This program checks a string to see/ it reads the same %s&#92, string ).h&The string \ &#47strrev已经过时; whether it is a palindrome, _strrev( _strdup( string ) ) );&#47.c//n&int main( void ){char* string = &;n&&quot: result = _stricmp( is a palindrome&#92,用_strrev代替。/& crt_strrev.h&gt:;#include &/&quot./%s\ Reverse string and compare (ignore case); is not a palindrome\#include &Able was I ere I saw Elba&
else printf( &&#47
strrev的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁[CONF] Apache Camel & SOAP
camel-commits mailing list archives
Message view
conflue...@apache.org
[CONF] Apache Camel & SOAP
&base href="https://cwiki.apache.org/confluence"&
&link rel="stylesheet" href="/confluence/s//_/styles/combined.css?spaceKey=CAMEL&forWysiwyg=true"
type="text/css"&
&body style="background:" bgcolor="white" class="email-body"&
&div id="pageContent"&
&div id="notificationFormat"&
&div class="wiki-content"&
&div class="email"&
&h2&&a href="https://cwiki.apache.org/confluence/display/CAMEL/SOAP"&SOAP&/a&&/h2&
&h4&Page &b&edited&/b& by
&a href="https://cwiki.apache.org/confluence/display/~davsclaus"&Claus
&h4&Changes (1)&/h4&
&div id="page-diffs"&
&table class="diff" cellpadding="0" cellspacing="0"&
&tr&&td class="diff-snipped" &...&br&&/td&&/tr&
&tr&&td class="diff-unchanged" &{info} &br& &br&&/td&&/tr&
&tr&&td class="diff-added-lines" style="background-color: #"&{tip:title=Namespace
prefix mapping} &br&See [JAXB] for details how you can control namespace prefix mappings
when marshalling using [SOAP] data format. &br&{tip} &br& &br&&/td&&/tr&
&tr&&td class="diff-unchanged" &h3. ElementNameStrategy &br&
&br&&/td&&/tr&
&tr&&td class="diff-snipped" &...&br&&/td&&/tr&
&h4&Full Content&/h4&
&div class="notificationGreySide"&
&h2&&a name="SOAP-SOAPDataFormat"&&/a&SOAP DataFormat&/h2&
&p&&b&Available as of Camel 2.3&/b&&/p&
&p&SOAP is a &a href="/confluence/display/CAMEL/Data+Format" title="Data Format"&Data
Format&/a& which uses JAXB2 and JAX-WS annotations to marshal and unmarshal SOAP payloads.
It provides the basic features of Apache CXF without need for the CXF Stack.&/p&
&div class='panelMacro'&&table class='infoMacro'&&colgroup&&col width='24'&&col&&/colgroup&&tr&&td
valign='top'&&img src="/confluence/images/icons/emoticons/information.gif" width="16"
height="16" align="absmiddle" alt="" border="0"&&/td&&td&&b&Supported
SOAP versions&/b&&br /&SOAP 1.1 is supported by default. SOAP 1.2 is supported
from Camel 2.11 onwards.&/td&&/tr&&/table&&/div&
&div class='panelMacro'&&table class='tipMacro'&&colgroup&&col width='24'&&col&&/colgroup&&tr&&td
valign='top'&&img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"&&/td&&td&&b&Namespace prefix mapping&/b&&br
/&See &a href="/confluence/display/CAMEL/JAXB" title="JAXB"&JAXB&/a& for details
how you can control namespace prefix mappings when marshalling using &a href="/confluence/display/CAMEL/SOAP"
title="SOAP"&SOAP&/a& data format.&/td&&/tr&&/table&&/div&
&h3&&a name="SOAP-ElementNameStrategy"&&/a&ElementNameStrategy&/h3&
&p&An element name strategy is used for two purposes. The first is to find a xml element
name for a given object and soap action when marshaling the object into a SOAP message. The
second is to find an Exception class for a given soap fault name.&/p&
&div class='table-wrap'&
&table class='confluenceTable'&&tbody&
&th class='confluenceTh'& Strategy &/th&
&th class='confluenceTh'& Usage &/th&
&td class='confluenceTd'& QNameStrategy &/td&
&td class='confluenceTd'& Uses a fixed qName that is configured on instantiation. Exception
lookup is not supported &/td&
&td class='confluenceTd'& TypeNameStrategy &/td&
&td class='confluenceTd'& Uses the name and namespace from the @XMLType annotation of
the given type. If no namespace is set then package-info is used. Exception lookup is not
supported &/td&
&td class='confluenceTd'& ServiceInterfaceStrategy &/td&
&td class='confluenceTd'& Uses information from a webservice interface to determine
the type name and to find the exception class for a SOAP fault&/td&
&/tbody&&/table&
&p&If you have generated the web service stub code with cxf-codegen or a similar tool
then you probably will want to use the ServiceInterfaceStrategy. In the case you have no annotated
service interface you should use QNameStrategy or TypeNameStrategy.&/p&
&h3&&a name="SOAP-UsingtheJavaDSL"&&/a&Using the Java DSL&/h3&
&p&The following example uses a named DataFormat of &em&soap&/em& which
is configured with the package com.example.customerservice to initialize the &a href="/javase/6/docs/api/javax/xml/bind/JAXBContext.html"
class="external-link" rel="nofollow"&JAXBContext&/a&. The second parameter is the
ElementNameStrategy. The route is able to marshal normal objects as well as exceptions.
the below just sends a SOAP Envelope to a queue. A web service provider would actually need
to be listening to the queue for a SOAP call to actually occur, in which case it would be
a one way SOAP request. If you need request reply then you should look at the next example.)&/p&
&div class="code panel" style="border-width: 1"&&div class="codeContent panelContent"&
&pre class="code-java"&
SoapJaxbDataFormat soap = &span class="code-keyword"&new&/span& SoapJaxbDataFormat(&span
class="code-quote"&"com.example.customerservice"&/span&, &span class="code-keyword"&new&/span&
ServiceInterfaceStrategy(CustomerService.class));
from(&span class="code-quote"&"direct:start"&/span&)
.marshal(soap)
.to(&span class="code-quote"&"jms:myQueue"&/span&);
&/div&&/div&
&div class='panelMacro'&&table class='tipMacro'&&colgroup&&col width='24'&&col&&/colgroup&&tr&&td
valign='top'&&img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"&&/td&&td&&b&See also&/b&&br
/&As the SOAP dataformat inherits from the &a href="/confluence/display/CAMEL/JAXB"
title="JAXB"&JAXB&/a& dataformat most settings apply here as well&/td&&/tr&&/table&&/div&
&h4&&a name="SOAP-UsingSOAP1.2"&&/a&Using SOAP 1.2&/h4&
&p&&b&Available as of Camel 2.11&/b&&/p&
&div class="code panel" style="border-width: 1"&&div class="codeContent panelContent"&
&pre class="code-java"&
SoapJaxbDataFormat soap = &span class="code-keyword"&new&/span& SoapJaxbDataFormat(&span
class="code-quote"&"com.example.customerservice"&/span&, &span class="code-keyword"&new&/span&
ServiceInterfaceStrategy(CustomerService.class));
soap.setVersion(&span class="code-quote"&"1.2"&/span&);
from(&span class="code-quote"&"direct:start"&/span&)
.marshal(soap)
.to(&span class="code-quote"&"jms:myQueue"&/span&);
&/div&&/div&
&p&When using XML DSL there is a version attribute you can set on the &soap&
element.&/p&
&div class="code panel" style="border-width: 1"&&div class="codeContent panelContent"&
&pre class="code-xml"&
&span class="code-tag"&&span class="code-comment"&&!-- Defining a ServiceInterfaceStrategy
for retrieving the element name when marshalling --&&/span&&/span&
&span class="code-tag"&&bean id=&span class="code-quote"&"myNameStrategy"&/span&
class=&span class="code-quote"&"org.apache.camel.dataformat.soap.name.ServiceInterfaceStrategy"&/span&&&/span&
&span class="code-tag"&&constructor-arg value=&span class="code-quote"&"com.example.customerservice.CustomerService"&/span&/&&/span&
&span class="code-tag"&&constructor-arg value=&span class="code-quote"&"true"&/span&/&&/span&
&span class="code-tag"&&/bean&&/span&
&/div&&/div&
&p&And in the Camel route&/p&
&div class="code panel" style="border-width: 1"&&div class="codeContent panelContent"&
&pre class="code-xml"&
&span class="code-tag"&&route&&/span&
&span class="code-tag"&&from uri=&span class="code-quote"&"direct:start"&/span&/&&/span&
&span class="code-tag"&&marshal&&/span&
&span class="code-tag"&&soap contentPath=&span class="code-quote"&"com.example.customerservice"&/span&
version=&span class="code-quote"&"1.2"&/span& elementNameStrategyRef=&span
class="code-quote"&"myNameStrategy"&/span&/&&/span&
&span class="code-tag"&&/marshal&&/span&
&span class="code-tag"&&to uri=&span class="code-quote"&"jms:myQueue"&/span&/&&/span&
&span class="code-tag"&&/route&&/span&
&/div&&/div&
&h3&&a name="SOAP-MultipartMessages"&&/a&Multi-part Messages&/h3&
&p&&b&Available as of Camel 2.8.1&/b& &/p&
&p&Multi-part SOAP messages are supported by the ServiceInterfaceStrategy. The ServiceInterfaceStrategy
must be initialized with a service interface definition that is annotated in accordance with
JAX-WS 2.2 and meets the requirements of the Document Bare style. The target method must meet
the following criteria, as per the JAX-WS specification:
1) it must have at most one &tt&in&/tt&
or &tt&in/out&/tt& non-header parameter, 2) if it has a return type other than
&tt&void&/tt& it must have no &tt&in/out&/tt& or &tt&out&/tt&
non-header parameters, 3) if it it has a return type of &tt&void&/tt& it must
have at most one &tt&in/out&/tt& or &tt&out&/tt& non-header parameter.&/p&
&p&The ServiceInterfaceStrategy should be initialized with a boolean parameter that
indicates whether the mapping strategy applies to the request parameters or response parameters.&/p&
&div class="code panel" style="border-width: 1"&&div class="codeContent panelContent"&
&pre class="code-java"&
ServiceInterfaceStrategy strat =
&span class="code-keyword"&new&/span& ServiceInterfaceStrategy(com.example.customerservice.multipart.MultiPartCustomerService.class,
&span class="code-keyword"&true&/span&);
SoapJaxbDataFormat soapDataFormat = &span class="code-keyword"&new&/span& SoapJaxbDataFormat(&span
class="code-quote"&"com.example.customerservice.multipart"&/span&, strat);
&/div&&/div&
&h4&&a name="SOAP-MultipartRequest"&&/a&Multi-part Request&/h4&
&p&The payload parameters for a multi-part request are initiazlied using a &tt&BeanInvocation&/tt&
object that reflects the signature of the target operation. The camel-soap DataFormat maps
the content in the &tt&BeanInvocation&/tt& to fields in the SOAP header and body
in accordance with the JAX-WS mapping when the &tt&marshal()&/tt& processor is
invoked. &/p&
&div class="code panel" style="border-width: 1"&&div class="codeContent panelContent"&
&pre class="code-java"&
BeanInvocation beanInvocation = &span class="code-keyword"&new&/span& BeanInvocation();
&span class="code-comment"&// Identify the target method
&/span&beanInvocation.setMethod(MultiPartCustomerService.class.getMethod(&span class="code-quote"&"getCustomersByName"&/span&,
GetCustomersByName.class, com.example.customerservice.multipart.Product.class));
&span class="code-comment"&// Populate the method arguments
&/span&GetCustomersByName getCustomersByName = &span class="code-keyword"&new&/span&
GetCustomersByName();
getCustomersByName.setName(&span class="code-quote"&"Dr. Multipart"&/span&);
Product product = &span class="code-keyword"&new&/span& Product();
product.setName(&span class="code-quote"&"Multiuse Product"&/span&);
product.setDescription(&span class="code-quote"&"Useful &span class="code-keyword"&for&/span&
lots of things."&/span&);
&span class="code-object"&Object&/span&[] args = &span class="code-keyword"&new&/span&
&span class="code-object"&Object&/span&[] {getCustomersByName, product};
&span class="code-comment"&// Add the arguments to the bean invocation
&/span&beanInvocation.setArgs(args);
&span class="code-comment"&// Set the bean invocation object as the message body
&/span&exchange.getIn().setBody(beanInvocation);
&/div&&/div&
&h4&&a name="SOAP-MultipartResponse"&&/a&Multi-part Response&/h4&
&p&A multi-part soap response may include an element in the soap body and will have
one or more elements in the soap header.
The camel-soap DataFormat will unmarshall the element
in the soap body (if it exists) and place it onto the body of the out message in the exchange.
Header elements will &b&not&/b& be marshaled into their JAXB mapped object types.
Instead, these elements are placed into the camel out message header &tt&org.apache.camel.dataformat.soap.UNMARSHALLED_HEADER_LIST&/tt&.
The elements will appear either as element instance values, or as JAXBElement values, depending
upon the setting for the &tt&ignoreJAXBElement&/tt& property. This property is
inherited from camel-jaxb.&/p&
&p&You can also have the camel-soap DataFormate ignore header content all-together by
setting the &tt&ignoreUnmarshalledHeaders&/tt& value to &tt&true&/tt&.
&h4&&a name="SOAP-HolderObjectmapping"&&/a&Holder Object mapping&/h4&
&p&JAX-WS specifies the use of a type-parameterized &tt&javax.xml.ws.Holder&/tt&
object for &tt&In/Out&/tt& and &tt&Out&/tt& parameters.
A &tt&Holder&/tt&
object may be used when building the &tt&BeanInvocation&/tt&, or you may use an
instance of the parameterized-type directly.
The camel-soap DataFormat marshals Holder values
in accordance with the JAXB mapping for the class of the &tt&Holder&/tt&'s value.
No mapping is provided for &tt&Holder&/tt& objects in an unmarshalled response.&/p&
&h3&&a name="SOAP-Examples"&&/a&Examples&/h3&
&h4&&a name="SOAP-Webserviceclient"&&/a&Webservice client&/h4&
&p&The following route supports marshalling the request and unmarshalling a response
or fault. &/p&
&div class="code panel" style="border-width: 1"&&div class="codeContent panelContent"&
&pre class="code-java"&
&span class="code-object"&String&/span& WS_URI = &span class="code-quote"&"cxf:&span
class="code-comment"&//http://myserver/customerservice?serviceClass=com.example.customerservice&dataFormat=MESSAGE"&/span&;
&/span&SoapJaxbDataFormat soapDF = &span class="code-keyword"&new&/span&
SoapJaxbDataFormat(&span class="code-quote"&"com.example.customerservice"&/span&,
&span class="code-keyword"&new&/span& ServiceInterfaceStrategy(CustomerService.class));
from(&span class="code-quote"&"direct:customerServiceClient"&/span&)
.onException(Exception.class)
.handled(&span class="code-keyword"&true&/span&)
.unmarshal(soapDF)
.marshal(soapDF)
.to(WS_URI)
.unmarshal(soapDF);
&/div&&/div&
&p&The below snippet creates a proxy for the service interface and makes a SOAP call
to the above route. &/p&
&div class="code panel" style="border-width: 1"&&div class="codeContent panelContent"&
&pre class="code-java"&
&span class="code-keyword"&import&/span& org.apache.camel.E
&span class="code-keyword"&import&/span& org.ponent.bean.ProxyH
Endpoint startEndpoint = context.getEndpoint(&span class="code-quote"&"direct:customerServiceClient"&/span&);
&span class="code-object"&ClassLoader&/span& classLoader = &span class="code-object"&Thread&/span&.currentThread().getContextClassLoader();
&span class="code-comment"&// CustomerService below is the service endpoint &span
class="code-keyword"&interface&/span&, *not* the javax.xml.ws.Service subclass
&/span&CustomerService proxy = ProxyHelper.createProxy(startEndpoint, classLoader, CustomerService.class);
GetCustomersByNameResponse response = proxy.getCustomersByName(&span class="code-keyword"&new&/span&
GetCustomersByName());
&/div&&/div&
&h4&&a name="SOAP-WebserviceServer"&&/a&Webservice Server&/h4&
&p&Using the following route sets up a webservice server that listens on jms queue customerServiceQueue
and processes requests using the class CustomerServiceImpl. The customerServiceImpl of course
should implement the interface CustomerService. Instead of directly instantiating the server
class it could be defined in a spring context as a regular bean.&/p&
&div class="code panel" style="border-width: 1"&&div class="codeContent panelContent"&
&pre class="code-java"&
SoapJaxbDataFormat soapDF = &span class="code-keyword"&new&/span& SoapJaxbDataFormat(&span
class="code-quote"&"com.example.customerservice"&/span&, &span class="code-keyword"&new&/span&
ServiceInterfaceStrategy(CustomerService.class));
CustomerService serverBean = &span class="code-keyword"&new&/span& CustomerServiceImpl();
from(&span class="code-quote"&"jms:&span class="code-comment"&//queue:customerServiceQueue"&/span&)
.onException(Exception.class)
.handled(&span class="code-keyword"&true&/span&)
.marshal(soapDF)
.unmarshal(soapDF)
.bean(serverBean)
.marshal(soapDF);
&/div&&/div&
&h3&&a name="SOAP-Dependencies"&&/a&Dependencies&/h3&
&p&To use the SOAP dataformat in your camel routes you need to add the following dependency
to your pom.&/p&
&div class="code panel" style="border-width: 1"&&div class="codeContent panelContent"&
&pre class="code-xml"&
&span class="code-tag"&&dependency&&/span&
&span class="code-tag"&&groupId&&/span&org.apache.camel&span
class="code-tag"&&/groupId&&/span&
&span class="code-tag"&&artifactId&&/span&camel-soap&span class="code-tag"&&/artifactId&&/span&
&span class="code-tag"&&version&&/span&2.3.0&span class="code-tag"&&/version&&/span&
&span class="code-tag"&&/dependency&&/span&
&/div&&/div&
&div id="commentsSection" class="wiki-content pageSection"&
&div style="float:"&
&a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey"&Change Notification Preferences&/a&
&a href="https://cwiki.apache.org/confluence/display/CAMEL/SOAP"&View Online&/a&
&a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=&revisedVersion=23&originalVersion=22"&View
Changes&/a&
&a href="https://cwiki.apache.org/confluence/display/CAMEL/SOAP?showComments=true&showCommentArea=true#addcomment"&Add
Comment&/a&
(inline, 7-Bit, 17746 bytes)

我要回帖

更多关于 gt lt 大于小于 的文章

 

随机推荐