网站建议:179001057@qq.com

xfire1.2X 配置使用SOAP1.2报文

技术2022-05-11  4

 大家都说xfire简单好用,不过我更觉得这个是相对而言的,如果你需要一些非默认的特性,那么就比较麻烦了,至少这样的文档太少了,指使不知该如何下手。下面是关于让xfire生成的服务使用SOAP1.2报文的设置内容,大家看看吧,我倒觉得不如Axis2来得简单。

 

<? xml version="1.0" encoding="UTF-8" ?> <! DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd" > < beans >      <!--  SOAP12 binding  -->      < bean  id ="xxxxPwdSoap12BindingBean"         class ="org.codehaus.xfire.spring.config.Soap12BindingBean" >          < property  name ="endpoints" >              < list >                  < ref  bean ="xxxxPwdEndPoint"   />              </ list >          </ property >          < property  name ="allowUndefinedEndpoints"  value ="true"   />          < property  name ="transport"             value ="http://www.w3.org/2003/05/soap/bindings/HTTP/"   /> <!--WSDL1.1 http://schemas.xmlsoap.org/soap/http -->      </ bean >      < bean  id ="xxxxPwdEndPoint"         class ="org.codehaus.xfire.spring.config.EndpointBean" >          < property  name ="name"  ref ="xxxxPwdQName"   />          < property  name ="url"             value ="http://localhost:7001/ReadyESB/XxxxPwdService"   />      </ bean >      < bean  id ="xxxxPwdQName"  class ="javax.xml.namespace.QName" >          < constructor-arg >              < value > http://interfaces.service.web.readyesb </ value >          </ constructor-arg >      </ bean >      <!--  SOAP12 binding for WSS -->      < bean  id ="xxxxPwdWSSSoap12BindingBean"         class ="org.codehaus.xfire.spring.config.Soap12BindingBean" >          < property  name ="endpoints" >              < list >                  < ref  bean ="xxxxPwdWSSEndPoint"   />              </ list >          </ property >          < property  name ="allowUndefinedEndpoints"  value ="true"   />          < property  name ="transport"             value ="http://www.w3.org/2003/05/soap/bindings/HTTP/"   />      </ bean >      < bean  id ="xxxxPwdWSSEndPoint"         class ="org.codehaus.xfire.spring.config.EndpointBean" >          < property  name ="name"  ref ="xxxxPwdWSSQName"   />          < property  name ="url"             value ="http://localhost:7001/ReadyESB/XxxxPwdServiceWSS"   />      </ bean >      < bean  id ="xxxxPwdWSSQName"  class ="javax.xml.namespace.QName" >          < constructor-arg >              < value > http://interfaces.service.web.readyesb </ value >          </ constructor-arg >      </ bean >      <!--  XMLBeans Service Template  -->      < bean  id ="xxxxPwdXMLBeansServiceTemplate"         class ="org.codehaus.xfire.spring.remoting.XFireExporter"         abstract ="true" >          < property  name ="serviceFactory"             ref ="xfire.xmlbeansServiceFactory"   />          < property  name ="xfire"  ref ="xfire"   />          < property  name ="style"  value ="document"   />  <!--  为了兼容性考虑请使用 wrapped Mod 2008-01-29 -->          < property  name ="use"  value ="literal"   />          < property  name ="bindings"  ref ="xxxxPwdSoap12BindingBean"   />          < property  name ="createDefaultBindings"  value ="false"   />      </ bean >      <!--  XMLBeans Service Template for WSS -->      < bean  id ="xxxxPwdWSSXMLBeansServiceTemplate"         class ="org.codehaus.xfire.spring.remoting.XFireExporter"         abstract ="true" >          < property  name ="serviceFactory"             ref ="xfire.xmlbeansServiceFactory"   />          < property  name ="xfire"  ref ="xfire"   />          < property  name ="style"  value ="document"   />  <!--  为了兼容性考虑请使用 wrapped Mod 2008-01-29 -->          < property  name ="use"  value ="literal"   />          < property  name ="bindings"  ref ="xxxxPwdWSSSoap12BindingBean"   />          < property  name ="createDefaultBindings"  value ="false"   />      </ bean >      <!--  XxxxPwd Interface  -->      < bean  id ="XxxxPwdBean"  class ="readyesb.web.service.impl.XxxxPwdImpl"   />      <!--  XxxxPwd标准配置  -->      < bean  id ="XxxxPwdService"  parent ="xxxxPwdXMLBeansServiceTemplate" >          < property  name ="serviceBean"  ref ="XxxxPwdBean"   />          < property  name ="serviceClass"             value ="readyesb.web.service.interfaces.XxxxPwd"   />          < property  name ="name"  value ="XxxxPwdService"   />      </ bean >      <!--  XxxxPwdWSS认证配置  -->      < bean  id ="XxxxPwdServiceWSS"         parent ="xxxxPwdWSSXMLBeansServiceTemplate" >          < property  name ="serviceBean"  ref ="XxxxPwdBean"   />          < property  name ="serviceClass"             value ="readyesb.web.service.interfaces.XxxxPwdWSS"   />          < property  name ="inHandlers" >              < list >                  < ref  bean ="domInHandler"   />                  < ref  bean ="wss4jInHandler"   />                  < ref  bean ="ValidateUserTokenHandler"   />              </ list >          </ property >          < property  name ="name"  value ="XxxxPwdServiceWSS"   />      </ bean > </ beans > 另外一部分      <!--  ===============XMLBeans Data Binding===========  -->      < bean  id ="xmlbeansTypeRegistry"         class ="org.codehaus.xfire.xmlbeans.XmlBeansTypeRegistry"   />      < bean  id ="xfire.xmlbeansServiceFactory"         class ="org.codehaus.xfire.xmlbeans.XmlBeansServiceFactory"         singleton ="true" >          < constructor-arg  index ="0"  ref ="xfire.transportManager"   />      </ bean >      <!--  ===============End=============================  --> 其中有一项,需要注意的 < property  name ="allowUndefinedEndpoints"  value ="true"   />,有人说是方便设置服务器端不用进行EndPoints设置的,其实是限制客户端在访问的时候,是否使用服务器端指定的EndPoints的。用这个能不能防止代理访问呢,我试了试通过TcpTrace,总之value=“false”的话,服务端就会报错。

最新回复(0)