Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
faea623d
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
faea623d
编写于
10月 01, 2014
作者:
A
aefimov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8038966: JAX-WS handles wrongly xsd:any arguments for Web services
Reviewed-by: coffeys
上级
bbb2b65e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
406 addition
and
0 deletion
+406
-0
test/javax/xml/ws/xsanymixed/CopyingResponse.java
test/javax/xml/ws/xsanymixed/CopyingResponse.java
+35
-0
test/javax/xml/ws/xsanymixed/ServiceImpl.java
test/javax/xml/ws/xsanymixed/ServiceImpl.java
+51
-0
test/javax/xml/ws/xsanymixed/Test.java
test/javax/xml/ws/xsanymixed/Test.java
+197
-0
test/javax/xml/ws/xsanymixed/compile-wsdl.sh
test/javax/xml/ws/xsanymixed/compile-wsdl.sh
+36
-0
test/javax/xml/ws/xsanymixed/service.wsdl
test/javax/xml/ws/xsanymixed/service.wsdl
+87
-0
未找到文件。
test/javax/xml/ws/xsanymixed/CopyingResponse.java
0 → 100644
浏览文件 @
faea623d
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
org.somewhere.ws.EchoRequest
;
import
org.somewhere.ws.EchoResponse
;
public
class
CopyingResponse
extends
EchoResponse
{
public
CopyingResponse
()
{}
public
CopyingResponse
(
EchoRequest
request
)
{
content
=
request
.
getContent
();
}
}
test/javax/xml/ws/xsanymixed/ServiceImpl.java
0 → 100644
浏览文件 @
faea623d
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
org.somewhere.ws.EchoRequest
;
import
org.somewhere.ws.EchoResponse
;
import
org.somewhere.ws.TestPort
;
import
javax.jws.WebService
;
import
javax.xml.namespace.QName
;
/**
* Simple Webservice implementation just copying xml part as is
* from incoming request into outgoing response
*/
@WebService
(
endpointInterface
=
"org.somewhere.ws.TestPort"
,
targetNamespace
=
"http://ws.somewhere.org/"
,
serviceName
=
"TestService"
,
portName
=
"TestPort"
)
public
class
ServiceImpl
implements
TestPort
{
public
static
final
QName
PORT_NAME
=
new
QName
(
"http://ws.somewhere.org/"
,
"TestPort"
);
public
static
final
QName
SERVICE_NAME
=
new
QName
(
"http://ws.somewhere.org/"
,
"TestService"
);
@Override
public
EchoResponse
echo
(
EchoRequest
request
)
{
return
new
CopyingResponse
(
request
);
}
}
test/javax/xml/ws/xsanymixed/Test.java
0 → 100644
浏览文件 @
faea623d
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8036981 8038966 8051441
* @summary the content of xs:any content:mixed should remain as is,
* no white space changes and no changes to namespace prefixes
* @run shell compile-wsdl.sh
* @run main/othervm Test
*/
import
com.sun.net.httpserver.HttpServer
;
import
javax.xml.transform.Source
;
import
javax.xml.transform.Transformer
;
import
javax.xml.transform.TransformerException
;
import
javax.xml.transform.TransformerFactory
;
import
javax.xml.transform.stream.StreamResult
;
import
javax.xml.transform.stream.StreamSource
;
import
javax.xml.ws.Dispatch
;
import
javax.xml.ws.Endpoint
;
import
javax.xml.ws.Service
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.StringReader
;
import
java.net.InetSocketAddress
;
import
java.net.URL
;
import
java.nio.file.FileVisitResult
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.nio.file.SimpleFileVisitor
;
import
java.nio.file.attribute.BasicFileAttributes
;
import
static
java
.
nio
.
file
.
FileVisitResult
.
CONTINUE
;
public
class
Test
{
private
static
HttpServer
httpServer
;
private
static
Endpoint
endpoint
;
private
static
final
String
NL
=
System
.
getProperty
(
"line.separator"
);
private
static
final
String
XS_ANY_MIXED_PART
=
"<AppHdr xmlns=\"urn:head.001\">"
+
NL
+
" <Fr>"
+
NL
+
NL
+
"<FIId xmlns=\"urn:head.009\">"
+
NL
+
NL
+
" any"
+
NL
+
" white"
+
NL
+
" space"
+
NL
+
NL
+
" <FinInstnId>... and"
+
NL
+
NL
+
" NO namespace prefixes!!!"
+
NL
+
NL
+
" </FinInstnId>"
+
NL
+
NL
+
" </FIId>"
+
NL
+
"</Fr>"
+
NL
+
"</AppHdr>"
;
private
static
final
String
XML_REQUEST
=
"<soap:Envelope "
+
"xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" "
+
"xmlns:ws=\"http://ws.somewhere.org/\">"
+
"<soap:Header/><soap:Body>"
+
"<ws:echoRequest>"
+
NL
+
XS_ANY_MIXED_PART
+
NL
+
"</ws:echoRequest>"
+
"</soap:Body></soap:Envelope>"
;
private
static
String
deployWebservice
()
throws
IOException
{
// Manually create HttpServer here using ephemeral address for port
// so as to not end up with attempt to bind to an in-use port
httpServer
=
HttpServer
.
create
(
new
InetSocketAddress
(
0
),
0
);
httpServer
.
start
();
endpoint
=
Endpoint
.
create
(
new
ServiceImpl
());
endpoint
.
publish
(
httpServer
.
createContext
(
"/wservice"
));
String
wsdlAddress
=
"http://localhost:"
+
httpServer
.
getAddress
().
getPort
()
+
"/wservice?wsdl"
;
log
(
"address = "
+
wsdlAddress
);
return
wsdlAddress
;
}
private
static
void
stopWebservice
()
{
if
(
endpoint
!=
null
&&
endpoint
.
isPublished
())
{
endpoint
.
stop
();
}
if
(
httpServer
!=
null
)
{
httpServer
.
stop
(
0
);
}
}
public
static
void
main
(
String
[]
args
)
throws
IOException
,
TransformerException
{
try
{
String
address
=
deployWebservice
();
Service
service
=
Service
.
create
(
new
URL
(
address
),
ServiceImpl
.
SERVICE_NAME
);
Dispatch
<
Source
>
d
=
service
.
createDispatch
(
ServiceImpl
.
PORT_NAME
,
Source
.
class
,
Service
.
Mode
.
MESSAGE
);
Source
response
=
d
.
invoke
(
new
StreamSource
(
new
StringReader
(
XML_REQUEST
)));
String
resultXml
=
toString
(
response
);
log
(
"= request ======== \n"
);
log
(
XML_REQUEST
);
log
(
"= result ========= \n"
);
log
(
resultXml
);
log
(
"\n=================="
);
boolean
xsAnyMixedPartSame
=
resultXml
.
contains
(
XS_ANY_MIXED_PART
);
log
(
"resultXml.contains(XS_ANY_PART) = "
+
xsAnyMixedPartSame
);
if
(!
xsAnyMixedPartSame
)
{
fail
(
"The xs:any content=mixed part is supposed to be same in request and response."
);
throw
new
RuntimeException
();
}
log
(
"TEST PASSED"
);
}
finally
{
stopWebservice
();
// if you need to debug or explore wsdl generation result
// comment this line out:
deleteGeneratedFiles
();
}
}
private
static
String
toString
(
Source
response
)
throws
TransformerException
,
IOException
{
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
TransformerFactory
transformerFactory
=
TransformerFactory
.
newInstance
();
Transformer
transformer
=
transformerFactory
.
newTransformer
();
transformer
.
transform
(
response
,
new
StreamResult
(
bos
));
bos
.
close
();
return
new
String
(
bos
.
toByteArray
());
}
private
static
void
fail
(
String
message
)
{
log
(
"TEST FAILED."
);
throw
new
RuntimeException
(
message
);
}
private
static
void
log
(
String
msg
)
{
System
.
out
.
println
(
msg
);
}
private
static
void
deleteGeneratedFiles
()
{
Path
p
=
Paths
.
get
(
".."
,
"classes"
,
"javax"
,
"xml"
,
"ws"
,
"xsanymixed"
,
"org"
);
System
.
out
.
println
(
"performing cleanup, deleting wsdl compilation result: "
+
p
.
toFile
().
getAbsolutePath
());
if
(
Files
.
exists
(
p
))
{
try
{
Files
.
walkFileTree
(
p
,
new
SimpleFileVisitor
<
Path
>()
{
@Override
public
FileVisitResult
visitFile
(
Path
file
,
BasicFileAttributes
attrs
)
throws
IOException
{
System
.
out
.
println
(
"deleting file ["
+
file
.
toFile
().
getAbsoluteFile
()
+
"]"
);
Files
.
delete
(
file
);
return
CONTINUE
;
}
@Override
public
FileVisitResult
postVisitDirectory
(
Path
dir
,
IOException
exc
)
throws
IOException
{
System
.
out
.
println
(
"deleting dir ["
+
dir
.
toFile
().
getAbsoluteFile
()
+
"]"
);
if
(
exc
==
null
)
{
Files
.
delete
(
dir
);
return
CONTINUE
;
}
else
{
throw
exc
;
}
}
});
}
catch
(
IOException
ioe
)
{
ioe
.
printStackTrace
();
}
}
}
}
test/javax/xml/ws/xsanymixed/compile-wsdl.sh
0 → 100644
浏览文件 @
faea623d
#! /bin/sh
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
if
[
"x
$TESTJAVA
"
=
x
]
;
then
TESTJAVA
=
$1
;
shift
TESTCLASSES
=
.
fi
echo
"compiling [test-service.wsdl] wsdl ..."
$TESTJAVA
/bin/wsimport
-keep
-d
${
TESTCLASSES
}
${
TESTSRC
}
/service.wsdl
echo
"WSDL compiled. Main test class Test.java can be compiled now."
test/javax/xml/ws/xsanymixed/service.wsdl
0 → 100644
浏览文件 @
faea623d
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<definitions
xmlns=
"http://schemas.xmlsoap.org/wsdl/"
xmlns:soap=
"http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns=
"http://ws.somewhere.org/"
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:wsam=
"http://www.w3.org/2007/05/addressing/metadata"
name=
"TestService"
targetNamespace=
"http://ws.somewhere.org/"
>
<types>
<xsd:schema
targetNamespace=
"http://ws.somewhere.org/"
version=
"1.0"
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:tns=
"http://ws.somewhere.org/"
>
<xsd:element
type=
"tns:echoRequest"
name=
"echoRequest"
/>
<xsd:element
type=
"tns:echoResponse"
name=
"echoResponse"
/>
<xsd:complexType
name=
"echoRequest"
mixed=
"true"
>
<xsd:sequence>
<xsd:any
namespace=
"##any"
processContents=
"skip"
minOccurs=
"1"
maxOccurs=
"10"
/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType
name=
"echoResponse"
mixed=
"true"
>
<xsd:sequence>
<xsd:any
namespace=
"##any"
processContents=
"skip"
minOccurs=
"1"
maxOccurs=
"10"
/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
<message
name=
"echoRequest"
>
<part
element=
"tns:echoRequest"
name=
"parameters"
/>
</message>
<message
name=
"echoResponse"
>
<part
element=
"tns:echoResponse"
name=
"parameters"
/>
</message>
<portType
name=
"TestPort"
>
<operation
name=
"echo"
>
<input
message=
"tns:echoRequest"
wsam:Action=
"http://ws.somewhere.org/tester/echoRequest"
/>
<output
message=
"tns:echoResponse"
wsam:Action=
"http://ws.somewhere.org/tester/echoResponse"
/>
</operation>
</portType>
<binding
name=
"TestServicePortBinding"
type=
"tns:TestPort"
>
<soap:binding
style=
"document"
transport=
"http://schemas.xmlsoap.org/soap/http"
/>
<operation
name=
"echo"
>
<soap:operation
soapAction=
""
/>
<input>
<soap:body
use=
"literal"
/>
</input>
<output>
<soap:body
use=
"literal"
/>
</output>
</operation>
</binding>
<service
name=
"TestService"
>
<port
binding=
"tns:TestServicePortBinding"
name=
"TestPort"
>
<soap:address
location=
"http://localhost/ws/tester"
/>
</port>
</service>
</definitions>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录