loadmodule jk2_module modules/mod_jk2.so
jkset config.file /usr/local/apache2/conf/workers2.properties
<servlet-mapping>
<servlet-name>axisservlet</servlet-name>
<url-pattern>*.jws</url-pattern>
</servlet-mapping>
<ifmodule mod_security.c>
# turn the filtering engine on or off
secfilterengine on
secfilterdefaultaction "deny,log,status:500"
secfilterscanpost on
. . .
# other rules
. . .
</ifmodule>
<wsdl:operation name="getinput">
<wsdlsoap:operation soapaction=""/>
<wsdl:input name="getinputrequest">
<wsdlsoap:body encodingstyle=http://schemas.xmlsoap.org/soap/encoding/
namespace="http://defaultnamespace"
use="encoded"/>
</wsdl:input>
<wsdl:output name="getinputresponse">
<wsdlsoap:body encodingstyle=http://schemas.xmlsoap.org/soap/encoding/
namespace="http://www.bluebank.example.com/axis/getbalance.jws"
use="encoded"/>
</wsdl:output>
<wsdl:message name="getinputresponse">
<wsdl:part name="getinputreturn" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="getinputrequest">
<wsdl:part name="id" type="xsd:string"/>
</wsdl:message>
#!perl -w
use soap::lite;
print soap::lite
-> service('http://www.bluebank.example.com/axis/getbalance.jws?wsdl')
-> getinput('12123');
post /axis/getbalance.jws http/1.0
content-type: text/xml; charset=utf-8
soapaction: ""
content-length: 576
expect: 100-continue
host: www.bluebank.example.com
<?xml version="1.0" encoding="utf-8"?>
<soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://www.bluebank.example.com/axis/getbalance.jws" xmlns:types="
http://www.bluebank.example.com/axis/getbalance.jws/encodedtypes"
xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"
xmlns:xsd="http://www.w3.org/2001/xmlschema">
<soap:body
soap:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/">
<q1:getinput xmlns:q1="http://defaultnamespace">
<id xsi:type="xsd:string">12123</id>
</q1:getinput>
</soap:body>
</soap:envelope>
...
http/1.1 200 ok
date: mon, 03 jan 2005 19:24:10 gmt
server: apache/2.0.50 (unix) mod_ssl/2.0.50 openssl/0.9.7d mod_jk2/2.0.4
set-cookie: jsessionid=69c6540cc427a8b064c0795addfc20ea; path=/axis
content-type: text/xml;charset=utf-8
connection: close
<?xml version="1.0" encoding="utf-8"?>
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/xmlschema"
xmlns:xsi="http://www.w3.org/2001/xmlschema-instance">
<soapenv:body>
<ns1:getinputresponse
soapenv:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://defaultnamespace">
<ns1:getinputreturn
xsi:type="xsd:string">$2500</ns1:getinputreturn>
</ns1:getinputresponse>
</soapenv:body>
</soapenv:envelope>
<ifmodule mod_security.c>
secfilterengine on
secfilterdefaultaction "deny,log,status:500"
# other rules
# ------- rules for web services --------------------------
<location /axis/getbalance.jws>
secfilterinheritance off
secfilterdefaultaction "deny,log,status:500"
secfilterscanpost on
secfiltercheckurlencoding on
secfiltercheckunicodeencoding on
</location>
#---------------------------------------------------------------
</ifmodule>
# ------- rules for web services --------------------------
<location /axis/getbalance.jws>
secfilterinheritance off
secfilterdefaultaction "deny,log,status:500"
secfilterscanpost on
secfiltercheckurlencoding on
secfiltercheckunicodeencoding on
</location>
#---------------------------------------------------------------
<q1:getinput xmlns:q1="http://defaultnamespace">
<id xsi:type="xsd:string">12123</id>
</q1:getinput>
<location /axis/getbalance.jws>
secfilterinheritance off
secfilterdefaultaction "deny,log,status:500"
secfilterscanpost on
secfiltercheckurlencoding on
secfiltercheckunicodeencoding on
secfilterselective post_payload "<\s*id[^>]*>" chain
</location>
<location /axis/getbalance.jws>
secfilterinheritance off
secfilterdefaultaction "deny,log,status:500"
secfilterscanpost on
secfiltercheckurlencoding on
secfiltercheckunicodeencoding on
secfilterselective post_payload "<\s*id[^>]*>" chain
secfilterselective post_payload "<\s*id[^>]*>.{6,}</\s*id\s*>""deny,status:500"
</location>
post /axis/getbalance.jws http/1.0
content-type: text/xml; charset=utf-8
soapaction: ""
content-length: 576
expect: 100-continue
host: www.bluebank.example.com
<?xml version="1.0" encoding="utf-8"?>
<soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://www.bluebank.example.com/axis/getbalance.jws" xmlns:types="
http://www.bluebank.example.com/axis/getbalance.jws/encodedtypes"
xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"
xmlns:xsd="http://www.w3.org/2001/xmlschema">
<soap:body
soap:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/">
<q1:getinput xmlns:q1="http://defaultnamespace">
<id xsi:type="xsd:string">12123</id>
</q1:getinput>
</soap:body>
</soap:envelope>
...
http/1.1 200 ok
date: mon, 03 jan 2005 19:24:10 gmt
server: apache/2.0.50 (unix) mod_ssl/2.0.50 openssl/0.9.7d mod_jk2/2.0.4
set-cookie: jsessionid=69c6540cc427a8b064c0795addfc20ea; path=/axis
content-type: text/xml;charset=utf-8
connection: close
<?xml version="1.0" encoding="utf-8"?>
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/xmlschema"
xmlns:xsi="http://www.w3.org/2001/xmlschema-instance">
<soapenv:body>
<ns1:getinputresponse
soapenv:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://defaultnamespace">
<ns1:getinputreturn
xsi:type="xsd:string">$2500</ns1:getinputreturn>
</ns1:getinputresponse>
</soapenv:body>
</soapenv:envelope>
post /axis/getblalance.jws http/1.0
content-type: text/xml; charset=utf-8
soapaction: ""
content-length: 577
expect: 100-continue
host: www.bluebank.example.com
<?xml version="1.0" encoding="utf-8"?>
<soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://www.bluebank.example.com/axis/getbalance.jws" xmlns:types="
http://www.bluebank.example.com/axis/getbalance.jws/encodedtypes"
xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"
xmlns:xsd="http://www.w3.org/2001/xmlschema">
<soap:body
soap:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/">
<q1:getinput xmlns:q1="http://defaultnamespace">
<id xsi:type="xsd:string">121234</id>
</q1:getinput>
</soap:body>
</soap:envelope>
...
http/1.1 500 internal server error
date: mon, 03 jan 2005 22:00:33 gmt
server: apache/2.0.50 (unix) mod_ssl/2.0.50 openssl/0.9.7d mod_jk2/2.0.4
content-length: 657
connection: close
content-type: text/html; charset=iso-8859-1
<!doctype html public "-//ietf//dtd html 2.0//en">
<html><head>
<title>500 internal server error</title>
</head><body>
<h1>internal server error</h1>
<p>the server encountered an internal error or misconfiguration and was
unable to complete your request.</p>
<p>please contact the server administrator, you@example.com and inform
them of the time the error occurred, and anything you might have done that
may have caused the error.</p>
<p>more information about this error may be available in the server
error
log.</p>
<hr />
<address>apache/2.0.50 (unix) mod_ssl/2.0.50 openssl/0.9.7d
mod_jk2/2.0.4
server at 192.168.7.50 port 80</address>
</body></html>
<location /axis/getbalance.jws>
secfilterinheritance off
secfilterdefaultaction "deny,log,status:500"
secfilterscanpost on
secfiltercheckurlencoding on
secfiltercheckunicodeencoding on
secfilterselective post_payload "<\s*id[^>]*>" chain
secfilterselective post_payload "<\s*id[^>]*>.{6,}</\s*id\s*>"
"deny,status:500"
secfilterselective post_payload "<\s*id[^>]*>.*[^a-za-z0-9][^<]*</\s*id\s*>"
"deny,status:500"
</location>
post /axis/getbalance.jws http/1.0
content-type: text/xml; charset=utf-8
soapaction: ""
content-length: 576
expect: 100-continue
host: www.bluebank.example.com
<?xml version="1.0" encoding="utf-8"?>
<soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://www.bluebank.example.com/axis/getbalance.jws" xmlns:types="
http://www.bluebank.example.com/axis/getbalance.jws/encodedtypes"
xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"
xmlns:xsd="http://www.w3.org/2001/xmlschema">
<soap:body
soap:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/">
<q1:getinput xmlns:q1="http://defaultnamespace">
<id xsi:type="xsd:string">12'12</id>
</q1:getinput>
</soap:body>
</soap:envelope>
...
500 internal server error
http/1.1 500 internal server error
date: mon, 03 jan 2005 22:00:33 gmt
server: apache/2.0.50 (unix) mod_ssl/2.0.50 openssl/0.9.7d mod_jk2/2.0.4
content-length: 657
connection: close
content-type: text/html; charset=iso-8859-1
<location /axis/getbalance.jws>
secfilterinheritance off
secfilterdefaultaction "deny,log,status:500"
secfilterscanpost on
secfiltercheckurlencoding on
secfiltercheckunicodeencoding on
secfilterselective post_payload "<\s*id[^>]*>" chain
secfilterselective post_payload "<\s*id[^>]*>.{6,}</\s*id\s*>"
"deny,status:500"
secfilterselective post_payload "<\s*id[^>]*>.*[^a-za-z0-9][^<]*</\s*id\s*>"
"deny,status:500"
secfilterselective post_payload "<\s*id[^>]*>.*select.+from[^<]*</\s*id\s*>"
"deny,status:500"
</location>
post /axis/getbalance.jws http/1.0
content-type: text/xml; charset=utf-8
soapaction: ""
content-length: 569
expect: 100-continue
host: www.bluebank.example.com
<?xml version="1.0" encoding="utf-8"?>
<soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://www.bluebank.example.com/axis/getbalance.jws" xmlns:types="
http://www.bluebank.example.com/axis/getbalance.jws/encodedtypes"
xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"
xmlns:xsd="http://www.w3.org/2001/xmlschema">
<soap:body soap:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/">
<q1:getinput xmlns:q1="http://defaultnamespace">
<id xsi:type="xsd:string">a</id>
</q1:getinput>
</soap:body>
</soap:envelope>
...
500 internal server error
http/1.1 500 internal server error
date: tue, 04 jan 2005 16:22:14 gmt
server: apache/2.0.50 (unix) mod_ssl/2.0.50 openssl/0.9.7d mod_jk2/2.0.4
set-cookie: jsessionid=1caf4cd0ed0f38fb40ecbc7bdab56c75; path=/axis
content-type: text/xml;charset=utf-8
connection: close
<?xml version="1.0" encoding="utf-8"?>
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/xmlschema"
xmlns:xsi="http://www.w3.org/2001/xmlschema-instance">
<soapenv:body>
<soapenv:fault>
<faultcode>soapenv:server.userexception</faultcode>
<faultstring>java.lang.numberformatexception:
for input string:"a"</faultstring>
<detail/>
</soapenv:fault>
</soapenv:body>
</soapenv:envelope>
如应答所示,错误的代码可能会暴露重要的内部信息,因此,非常有必要定义及使用过滤器。blue bank可以用下面的规则来过滤:
<location /axis/getbalance.jws>
secfilterinheritance off
secfilterdefaultaction "deny,log,status:500"
secfilterscanpost on
secfiltercheckurlencoding on
secfiltercheckunicodeencoding on
secfilterselective post_payload "<\s*id[^>]*>" chain
secfilterselective post_payload "<\s*id[^>]*>.{6,}</\s*id\s*>"
"deny,status:500"
secfilterselective post_payload "<\s*id[^>]*>.*[^a-za-z0-9][^<]*</\s*id\s*>"
"deny,status:500"
secfilterscanoutput on
secfilterselective output "faultcode" "deny,status:500"
</location>
http/1.1 500 internal server error
date: mon, 03 jan 2005 22:00:33 gmt
server: apache/2.0.50 (unix) mod_ssl/2.0.50 openssl/0.9.7d mod_jk2/2.0.4
content-length: 657
connection: close
content-type: text/html; charset=iso-8859-1
<!doctype html public "-//ietf//dtd html 2.0//en">
<html><head>
<title>500 internal server error</title>
</head><body>
<h1>internal server error</h1>
<p>the server encountered an internal error or misconfiguration and was
unable to complete your request.</p>
<p>please contact the server administrator, you@example.com and inform
them of the time the error occurred, and anything you might have done that
may have caused the error.</p>
<p>more information about this error may be available in the server
error
log.</p>
<hr />
<address>apache/2.0.50 (unix) mod_ssl/2.0.50 openssl/0.9.7d
mod_jk2/2.0.4
server at 192.168.7.50 port 80</address>
</body></html>
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器