[JBossWS] - Re: Specify WS-Security Handler using JEE standards
by ivlcic
I've been looking for the same sollution and found this workaround:
I replaced standard client conf with secure one so everything in your app will be under WS-Security. (If you dont need everything encrypted use the wiki instructions)
Write your own "endpoint-config" and place it in war
META-INF/standard-jaxws-endpoint-config.xml:
| <?xml version="1.0" encoding="UTF-8"?>
| <jaxws-config xmlns="urn:jboss:jaxws-config:2.0"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xmlns:javaee="http://java.sun.com/xml/ns/javaee"
| xsi:schemaLocation="urn:jboss:jaxws-config:2.0 jaxws-config_2_0.xsd">
|
| <endpoint-config>
| <config-name>Standard Endpoint</config-name>
| <post-handler-chains>
| <javaee:handler-chain>
| <javaee:protocol-bindings>##SOAP11_HTTP ##SOAP11_HTTP_MTOM</javaee:protocol-bindings>
| <javaee:handler>
| <javaee:handler-name>WSSecurity Handler</javaee:handler-name>
| <javaee:handler-class>org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerServer</javaee:handler-class>
| </javaee:handler>
| <javaee:handler>
| <javaee:handler-name>Recording Handler</javaee:handler-name>
| <javaee:handler-class>org.jboss.wsf.framework.invocation.RecordingServerHandler</javaee:handler-class>
| </javaee:handler>
| <javaee:handler>
| <!-- YOUR OWN HANDLERS IN POST CHAIN -->
| <javaee:handler-name>Encrypted Request Logger</javaee:handler-name>
| <javaee:handler-class>org.dropchop.mpg.ws.RequestLogger</javaee:handler-class>
| </javaee:handler>
| </javaee:handler-chain>
| </post-handler-chains>
| </endpoint-config>
|
| </jaxws-config>
|
and client side .jar (or just in class path) META-INF/standard-jaxws-client-config.xml:
| <?xml version="1.0" encoding="UTF-8"?>
| <jaxws-config xmlns="urn:jboss:jaxws-config:2.0"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xmlns:javaee="http://java.sun.com/xml/ns/javaee"
| xsi:schemaLocation="urn:jboss:jaxws-config:2.0 jaxws-config_2_0.xsd">
|
| <client-config>
| <config-name>Standard Client</config-name>
| <post-handler-chains>
| <javaee:handler-chain>
| <javaee:protocol-bindings>##SOAP11_HTTP ##SOAP11_HTTP_MTOM</javaee:protocol-bindings>
| <javaee:handler>
| <javaee:handler-name>WSSecurityHandlerOutbound</javaee:handler-name>
| <javaee:handler-class>org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerClient</javaee:handler-class>
| </javaee:handler>
| </javaee:handler-chain>
| </post-handler-chains>
| <property>
| <property-name>http://org.jboss.ws/http#chunksize</property-name>
| <property-value>2048</property-value>
| </property>
| </client-config>
| </jaxws-config>
|
Your files will be loaded before the ones from jboss libs and you can delete all references to jboss libs from your source code.
I guess its a hack, but in my humble opinion after reading a spec (JAX-WS 2.1), user of native stack should be able to add his(hers) processing logic before SOAP protocol handling. With current jbossws (in AS 5.0.0GA) this is imposible since POST chains are delgated to execution before ENDPOINT.
I tested it so it works for me. (use it at your own risk since I'm not sure its ok)...
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4226230#4226230
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4226230
15 years, 8 months
[JBossWS] - org.jboss.ws.WSException: Cannot write generated wsdl
by gautamz
Hello,
I have a wsdl that imports hr-xml elements as below. I use wsconsume to generate the server interfaces and then implement the interface in my class. Compiled the code; and created a war
(War has WEB-INF/web.xml. Classes moved to WEB-INF/classes)
When deploying to jboss, wsdl get emitted and then deployment fails with org.jboss.ws.WSException: Cannot write generated wsdl (more of the stacktrace at the bottom of this post)
Any ideas of what may be happening, and, how to resolve this? I tried the same through eclipse - and same error. I'm using JBossAS 4.2.3/jbossws 3.1.1
Thanks!
| <?xml version="1.0" encoding="UTF-8"?>
| <wsdl:definitions name="BackgroundCheckService"
| xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:hr="http://ns.hr-xml.org/2007-04-15"
| xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
| xmlns:messages="http://www.testcompany.com/ws/hrxml/Screening/1.0"
| xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.testcompany.com/ws/hrxml/Screening/1.0">
| <wsdl:types>
| <xs:schema attributeFormDefault="qualified"
| elementFormDefault="qualified"
| targetNamespace="http://www.testcompany.com/ws/hrxml/Screening/1.0">
| <xs:import namespace="http://ns.hr-xml.org/2007-04-15"
| schemaLocation="http://ns.hr-xml.org/2_5/HR-XML-2_5/CPO/ApplicationAcknowledgement.xsd" />
| <xs:import namespace="http://ns.hr-xml.org/2007-04-15"
| schemaLocation="http://ns.hr-xml.org/2_5/HR-XML-2_5/Screening/US/BackgroundCheck.xsd" />
| <xs:include schemaLocation="CommonServicesTypes.xsd" />
| </xs:schema>
| </wsdl:types>
|
| <wsdl:message name="BackgroundCheckRequest">
| <wsdl:part element="hr:BackgroundCheck" name="BackgroundCheckRequest" />
| </wsdl:message>
| <wsdl:message name="Acknowledge">
| <wsdl:part element="hr:ApplicationAcknowledgement" name="Acknowledge" />
| </wsdl:message>
|
| <wsdl:portType name="BackgroundCheckPort">
| <wsdl:operation name="CreateBackgroundCheck">
| <wsdl:input message="messages:BackgroundCheckRequest" />
| <wsdl:output message="messages:Acknowledge" />
| </wsdl:operation>
| </wsdl:portType>
|
| <wsdl:binding name="BackgroundCheckBinding" type="messages:BackgroundCheckPort">
| <soap:binding style="document"
| transport="http://schemas.xmlsoap.org/soap/http" />
| <wsdl:operation name="CreateBackgroundCheck">
| <soap:operation style="document" soapAction="" />
| <wsdl:input>
| <soap:body use="literal" />
| </wsdl:input>
| <wsdl:output>
| <soap:body use="literal" />
| </wsdl:output>
| </wsdl:operation>
| </wsdl:binding>
|
| <wsdl:service name="BackgroundCheckService">
| <wsdl:port binding="messages:BackgroundCheckBinding" name="BackgroundCheckPort">
| <soap:address location="REPLACE_WITH_ACTUAL_URL" />
| </wsdl:port>
| </wsdl:service>
| </wsdl:definitions>
|
| ERROR [MainDeployer] Could not start deployment: file:/C:/Java/jbos
|
| s-4.2.2.GA/server/default/deploy/backgroundcheckws.war
|
| org.jboss.ws.WSException: Cannot write generated wsdl
|
| at org.jboss.ws.metadata.builder.jaxws.JAXWSWebServiceMetaDataBuilder.pr
|
| ocessOrGenerateWSDL(JAXWSWebServiceMetaDataBuilder.java:391)
|
| at org.jboss.ws.metadata.builder.jaxws.JAXWSWebServiceMetaDataBuilder.bu
|
| ildWebServiceMetaData(JAXWSWebServiceMetaDataBuilder.java:158)
|
| at org.jboss.ws.metadata.builder.jaxws.JAXWSServerMetaDataBuilder.setupP
|
| roviderOrWebService(JAXWSServerMetaDataBuilder.java:50)
|
| at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE.buildMeta
|
| Data(JAXWSMetaDataBuilderJSE.java:63)
|
| at org.jboss.wsf.stack.jbws.UnifiedMetaDataDeploymentAspect.create(Unifi
|
| edMetaDataDeploymentAspect.java:66)
|
| at org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl.deploy
|
| (DeploymentAspectManagerImpl.java:115)
|
| at org.jboss.wsf.container.jboss42.ArchiveDeployerHook.deploy(ArchiveDep
|
| loyerHook.java:97)
|
| at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInt
|
| erceptor.java:90)
|
| at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.
|
| start(SubDeployerInterceptorSupport.java:188)
|
| at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterce
|
| ptor.java:95)
|
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
|
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
|
| java:264)
|
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
|
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
|
| at $Proxy45.start(Unknown Source)
|
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
|
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
|
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
|
| at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
|
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
|
| sorImpl.java:25)
|
| at java.lang.reflect.Method.invoke(Method.java:585)
|
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
|
| er.java:155)
|
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
|
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
|
| or.java:133)
|
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
|
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
|
| BeanOperationInterceptor.java:142)
|
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
|
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
|
| java:264)
|
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
|
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
|
| at $Proxy9.deploy(Unknown Source)
|
| at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
|
| tScanner.java:421)
|
| at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
|
| canner.java:634)
|
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
|
| doScan(AbstractDeploymentScanner.java:263)
|
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
|
| loop(AbstractDeploymentScanner.java:274)
|
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
|
| run(AbstractDeploymentScanner.java:225)
|
| Caused by: java.io.IOException: org.xml.sax.SAXParseException: The prefix "xml"
|
| cannot be bound to any namespace other than its usual namespace; neither can the
|
| namespace for "xml" be bound to any prefix other than "xml".
|
| at org.jboss.wsf.common.DOMUtils.parse(DOMUtils.java:156)
|
| at org.jboss.wsf.common.DOMUtils.parse(DOMUtils.java:135)
|
| at org.jboss.ws.tools.wsdl.WSDL11Writer.writeBuilder(WSDL11Writer.java:1
|
| 56)
|
| at org.jboss.ws.tools.wsdl.WSDL11Writer.write(WSDL11Writer.java:140)
|
| at org.jboss.ws.tools.wsdl.WSDLWriter.write(WSDLWriter.java:90)
|
| at org.jboss.ws.metadata.builder.jaxws.JAXWSWebServiceMetaDataBuilder.wr
|
| iteWsdl(JAXWSWebServiceMetaDataBuilder.java:418)
|
| at org.jboss.ws.metadata.builder.jaxws.JAXWSWebServiceMetaDataBuilder.pr
|
| ocessOrGenerateWSDL(JAXWSWebServiceMetaDataBuilder.java:382)
|
| ... 35 more
|
| 09:40:53,549 ERROR [RequestHandlerImpl] Error processing web service request
|
| java.lang.IllegalStateException: Cannot obtain endpoint meta data
|
| at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleWSDLRequest(Request
|
| HandlerImpl.java:520)
|
| at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doGet(RequestHandlerImpl.
|
| java:144)
|
| at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(Request
|
| HandlerImpl.java:126)
|
| at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java
|
| :84)
|
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
|
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
|
| icationFilterChain.java:290)
|
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
|
| ilterChain.java:206)
|
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
|
| lter.java:96)
|
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
|
| icationFilterChain.java:235)
|
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
|
| ilterChain.java:206)
|
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
|
| alve.java:230)
|
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
|
| alve.java:175)
|
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
|
| yAssociationValve.java:179)
|
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
|
| e.java:84)
|
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
|
| ava:127)
|
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
|
| ava:102)
|
| at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedC
|
| onnectionValve.java:157)
|
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
|
| ve.java:109)
|
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
|
| a:262)
|
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
|
| :844)
|
| at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
|
| ss(Http11Protocol.java:583)
|
| at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
|
| 6)
|
| at java.lang.Thread.run(Thread.java:595)
|
| 09:40:53,549 ERROR [[BackgroundCheck]] Servlet.service() for servlet BackgroundC
|
| heck threw exception
|
| java.lang.IllegalStateException: Cannot obtain endpoint meta data
|
| at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleWSDLRequest(Request
|
| HandlerImpl.java:520)
|
| at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doGet(RequestHandlerImpl.
|
| java:144)
|
| at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(Request
|
| HandlerImpl.java:126)
|
| at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java
|
| :84)
|
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
|
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
|
| icationFilterChain.java:290)
|
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
|
| ilterChain.java:206)
|
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
|
| lter.java:96)
|
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
|
| icationFilterChain.java:235)
|
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
|
| ilterChain.java:206)
|
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
|
| alve.java:230)
|
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
|
| alve.java:175)
|
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
|
| yAssociationValve.java:179)
|
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
|
| e.java:84)
|
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
|
| ava:127)
|
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
|
| ava:102)
|
| at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedC
|
| onnectionValve.java:157)
|
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
|
| ve.java:109)
|
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
|
| a:262)
|
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
|
| :844)
|
| at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
|
| ss(Http11Protocol.java:583)
|
| at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
|
| 6)
|
| at java.lang.Thread.run(Thread.java:595)
|
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4226219#4226219
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4226219
15 years, 8 months
[JBossWS] - WebFault and Declared RuntimeException is wrapped by SOAPFau
by skajotde
Hi All !
I'm writing webservice with JBoss 4.2.3 and jbossws-native-3.0.3.GA. When I declare checked exception, client can catch right unbinded exception.
@WebMethod
| public String testWyjatek003(@WebParam(name = "paramString") String paramString) throws WyjatekTestowy,
| WyjatekTestowyDziedziczacy;
When I declare runtime exception, exception is right unmarshalled as cause of SOAPFaultException but is not unwrapped.
| @WebMethod
| public String testWyjatekRuntime005(@WebParam(name = "paramString") String paramString)
| throws WyjatekTestowyRuntime02;
|
| @WebFault
| @ApplicationException(rollback = true)
| public class WyjatekTestowyRuntime02 extends RuntimeException {
| [...]
| }
|
I was investigating this case and I found ClientProxy.handleException(Exception ex)
private void handleException(Exception ex) throws Throwable
| {
| if (ex instanceof SOAPFaultException)
| {
| // Unwrap the cause if it is an Application Exception, otherwise use a protocol exception
| Throwable cause = ex.getCause();
| if (cause instanceof Exception)
| {
| // Throw unwrapped WebServiceException
| if (cause instanceof WebServiceException)
| throw (WebServiceException)cause;
|
| // Throw wrapped SOAPException
| if (cause instanceof SOAPException)
| throw (SOAPFaultException)ex;
|
| // Throw wrapped RuntimeException
| if (cause instanceof RuntimeException)
| throw (SOAPFaultException)ex;
|
| // Throw all other causes
| throw (Exception)cause;
| }
| }
| throw ex;
| }
So RuntimeException is wrapped with SOAPFaultException.
Is there way to write transparent code with declaring RuntimException and services with JBossWS ?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4225916#4225916
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4225916
15 years, 8 months
[JBossWS] - Re: SSL Client truststore
by zurchman
Here's what it took to run a JAX-WS RI SSL client with the JBossWS 3.0.1-native-2.0.4.GA delivered with jbossesb-server-4.5.GA.
The post that made the difference was the one by Alessio at the end of this topic:
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=141843
I don't recommend doing it this way, but all the artifacts were built with the RI. The only class compiled against the JBoss classes was the service mainline.
1) Set the truststore in the javax.net.ssl.trustStore property
2) Include org.jboss.ws.core.StubExt
3) Set the "Config" name to "Standard WSSecurity Client"
| System.setProperty("javax.net.ssl.trustStore",
| "path-to-my-truststore");
| BindingProvider bp = (BindingProvider) default_webservice;
| Map<String, Object> context = bp.getRequestContext();
| context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
| endpoint);
| System.out.println("new endpoint: " + endpoint);
| ((StubExt)default_webservice).setConfigName("Standard WSSecurity Client");
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4225769#4225769
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4225769
15 years, 8 months
[JBossWS] - Re: How to configure <application-policy name=
by joncmuniz
It's very very easy!!!!!!!!!!!!!
| <!--
| A template configuration for the JBossWS security domain.
| This defaults to the UsersRolesLoginModule the same as other and should be
| changed to a stronger authentication mechanism as required.
|
| <application-policy name="JBossWS">
| <authentication>
| <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
| flag="required">
| <module-option name="usersProperties">props/jbossws-users.properties</module-option>
| <module-option name="rolesProperties">props/jbossws-roles.properties</module-option>
| <module-option name="unauthenticatedIdentity">anonymous</module-option>
| </login-module>
| </authentication>
| </application-policy>
| -->
|
CHANGE FOR THIS ----------
| <application-policy name="JBossWS">
| <authentication>
| <login-module code="org.jboss.security.auth.spi.LdapLoginModule"
| flag="required">
| <module-option name="java.naming.factory.initial">
| com.sun.jndi.ldap.LdapCtxFactory
| </module-option>
| <module-option name="java.naming.provider.url">
| ldap://YOUR IP:PORT LDAP/
| </module-option>
| <module-option name="java.naming.security.authentication">
| simple
| </module-option>
| <module-option name="principalDNPrefix">uid=</module-option>
| <module-option name="principalDNSuffix">
| ,ou=users,dc=cds,dc=com
| </module-option>
|
| <module-option name="rolesCtxDN">
| ou=groups,dc=cds,dc=com
| </module-option>
| <module-option name="uidAttributeID">member</module-option>
| <module-option name="matchOnUserDN">true</module-option>
|
| <module-option name="roleAttributeID">cn</module-option>
| <module-option name="roleAttributeIsDN">false </module-option>
| </login-module>
| </authentication>
| </application-policy>
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4225646#4225646
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4225646
15 years, 8 months