axis使用和配置1Word文档格式.docx
- 文档编号:19967645
- 上传时间:2023-01-13
- 格式:DOCX
- 页数:17
- 大小:137.58KB
axis使用和配置1Word文档格式.docx
《axis使用和配置1Word文档格式.docx》由会员分享,可在线阅读,更多相关《axis使用和配置1Word文档格式.docx(17页珍藏版)》请在冰豆网上搜索。
}
privateStringcreateResponseText(Stringmsgid)
StringpayloadID="
1234"
Stringts=getTimeStamp();
StringrespText="
<
xmlversion=\"
\"
encoding=\"
UTF-8\"
>
\r\n"
+
"
SOAP-ENV:
Envelopexmlns:
SOAP-ENV=\"
Header/>
+
"
Body>
cXMLpayloadID=\"
+payloadID+"
xml:
lang=\"
en\"
timestamp=\"
+ts+"
Response>
Statuscode=\"
200\"
text=\"
OK\"
/>
Msg_id>
+msgid+"
/Msg_id>
/Response>
/cXML>
/SOAP-ENV:
Envelope>
returnrespText;
privateStringgetTimeStamp()
Datetoday=newDate();
SimpleDateFormatsdf=newSimpleDateFormat("
yyyy-MM-dd'
T'
HH:
mm:
ssZ"
etLog("
PlainConnectionSocketFactoryplainsf;
booleancheckForDefaultPort;
booleanauthenticationPreemptive;
CloseableHttpClienthttpclient;
CommonsHTTPClientPropertiesclientProperties;
booleanhttpChunkStream;
publicvoidinit()
();
authenticationPreemptive=((String)getOption("
)).booleanValue();
clientProperties=();
publicMyntlm(){
etProperty("
checkForDefaultPort"
));
HttpClientContextcontext=();
httpclientbuilder=createHttpClient(msgContext,context,targetURL);
RequestConfigreqConf=createRequestConfig(msgContext,targetURL,
httpclientbuilder);
booleanrestful=(
("
enableREST"
booleanposting=true;
StringwebMethod=null;
if()==
webMethod=("
if(webMethod==null)
webMethod="
POST"
else
posting=("
)||("
PUT"
if(posting){
if("
put"
method=newHttpPut());
else
method=newHttpPost());
}else{
method=newHttpGet());
}
addContextInfo(method,reqConf,msgContext,targetURL);
(reqConf);
StringhttpVersion=msgContext
.getStrProp("
if(httpVersion!
=null&
&
HTTP/"
;
ByteArrayOutputStreambinReq=newByteArrayOutputStream();
StringcontentType="
text/xml"
MessagereqMsg=();
if(reqMsg!
=null){
if(restful){
SOAPPartpart=();
Stringtypes[]=("
Content-Type"
if(types!
>
0)
contentType=types[0];
if(!
(
"
).getValue())){
("
contentType);
}
(null);
false"
((newStringBuilder()).append("
restmessageis:
)
.append(newString()))
.toString());
}else{
contentType=(msgContext
.getSOAPConstants());
}
(binReq);
((newStringBuilder()).append(
"
Contenttypeofrequestmessagedeterminedto:
).append(
contentType).toString());
HttpEntityreqEntity=null;
EntityBuilderreqBuilder=();
());
();
elseif())
(contentType));
reqEntity=();
if(method
.containsHeader){
removingoldcontentencodingvalue..."
method
.removeHeaders;
((newStringBuilder()).append("
settingchunkedto"
.append(httpChunkStream).toString());
((AbstractHttpEntity)reqEntity).setChunked(httpChunkStream);
((HttpEntityEnclosingRequest)method).setEntity(reqEntity);
HttpHosttarget=newHttpHost(),targetURL
.getPort(),());
httpclient=();
((newStringBuilder()).append("
targetconfiguredto:
.append()).append("
andcallingit..."
.toString());
CloseableHttpResponseresp=(target,method,
context);
intrespCode=().getStatusCode();
CalledsuccessfullywithHTTPcode:
).append(respCode)
contentType=getHeader(resp,"
StringcontentLocation=getHeader(resp,"
Content-Location"
StringcontentLength=getHeader(resp,"
Content-Length"
if((respCode<
=199||respCode>
=300)
&
text/html"
.equalsIgnoreCase(contentType)
||respCode<
=499||respCode>
=600)){
StringstatusMessage=().getReasonPhrase();
AxisFaultfault=newAxisFault("
HTTP"
(newStringBuilder())
.append("
("
).append(respCode).append("
)"
statusMessage).toString(),null,null);
("
return01"
(newStringBuilder()).append("
()))
.toString()));
(respCode));
throwfault;
respBody=();
HeadercontEnc=();
if(contEnc!
HeaderElementelems[]=();
HeaderElementarr$[]=elems;
intlen$=arr$.length;
for(inti$=0;
i$<
len$;
i$++){
HeaderElementel=arr$[i$];
if("
gzip"
.equalsIgnoreCase())){
respBody=newGzipDecompressingEntity(respBody);
(respBody);
HeaderresponseHeaders[]=();
Stringenc=(respBody);
if(enc==null)
enc="
iso-8859-1"
MessageoutMsg=null;
Contenttypeofresponsemessagedeterminedto:
if(restful){
outMsg=newMessage(respBody
.getContent(),enc,"
UTF-8"
false),false,
contentType,contentLocation);
().setMimeHeader("
try{
}catch(SOAPExceptione){
Errorwhilesettingmessageencoding"
e);
}elseif(contentLength!
=null
0"
.equalsIgnoreCase(contentLength))
outMsg=newMessage(newSOAPEnvelope());
outMsg=newMessage(),false,contentType,
contentLocation);
();
MimeHeadersresponseMimeHeaders=();
for(inti=0;
i<
;
i++){
HeaderresponseHeader=responseHeaders[i];
(),
());
("
response"
(outMsg);
if()){
Headerheaders[]=();
for(inti=0;
if(headers[i].getName().equalsIgnoreCase("
Set-Cookie"
)){
handleCookie("
Cookie"
headers[i].getValue(),
msgContext);
continue;
Set-Cookie2"
Cookie2"
}catch(Exceptione){
Error"
thrownewAxisFault("
ErrorwhileinvokingHttpClientSender:
}
if(httpclient!
=null)
try{
();
}catch(IOExceptione){
Errorwhileclosinghttpclient:
try{
}catch(IOExceptione){
publicvoidhandleCookie(StringcookieName,Stringacookie,
MessageContextmsgContext){
Stringck[]=("
"
ArrayListcookies=newArrayList();
for(inti=0;
intindex=ck[i].indexOf("
if(index!
=-1)
ck[i]=ck[i].substring(0,index);
index=ck[i].indexOf("
="
Stringkey=index!
=-1ck[i].substring(0,index):
ck[i];
ObjectoldCookies=(cookieName);
booleanalreadyExist=false;
if(oldCookies!
if(oldCookiesinstanceofString[]){
StringoldCookiesArray[]=(String[])(String[])oldCookies;
for(intj=0;
j<
j++){
StringanOldCookie=oldCookiesArray[j];
if(key!
(key)==0){
anOldCookie=ck[i];
alreadyExist=true;
}
(anOldCookie);
StringoldCookie=(String)oldCookies;
if(key!
oldCookie=ck[i];
alreadyExist=true;
(oldCookie);
if(!
alreadyExist)
(ck[i]);
if()==1)
(cookieName,(0));
elseif()>
1)
(cookieName,((Object)(cookies
.toArray(newString[()]))));
privateStringgetHeader(HttpResponseresp,Stringheader){
Headerh=(header);
returnh!
=null():
null;
privatevoidaddContextInfo(HttpRequestBasemethod,RequestConfigreqConf,
MessageContextmsgContext,URLtargetURL)throwsException{
Stringaction=()msgContext
.getSOAPActionURI():
if(action==null)
action="
Messagemsg=();
if(msg!
StringcontentType=(msgContext
.getSOAPConstants());
if()
()==
()==0)
contentType=(newStringBuilder()).append(contentType).append(
"
action=\"
).append(action).append("
).toString();
if()==
||("
attachment_encapsulation_format"
)=="
SOAPAction"
(newStringBuilder()).append("
.append(action).append("
).toString());
("
User-Agent"
("
axisUserAgent"
if("
Accept-Encoding"
"
MimeHea
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- axis 使用 配置