[jboss-user] [JBossWS] - ...Port does not contain operation meta data for: {http://ww

helmutdoe do-not-reply at jboss.com
Wed Jul 2 10:09:06 EDT 2008


Hi Community,

i know i had posted this problem allready in another thread but i seems to be a good choice to state this as standalone topic. 
What i need and what i had already done. I need to get working a simple Webservice using WSSecurity. Both Encryption and Signature shall be used. The Webservice should consumed by a standalone client.

So what i have done. Since i had read all tutorial from JBossWS and several other Documentation i got the folloing code for my Server Side.


  | /*
  |  * LottoEJBWS.java
  |  *
  |  * Created on 22. Juni 2008, 13:18
  |  *
  |  * To change this template, choose Tools | Template Manager
  |  * and open the template in the editor.
  |  */
  | 
  | package com.tools.wsse;
  | 
  | import java.util.Random;
  | import javax.ejb.Stateless;
  | 
  | import javax.jws.HandlerChain;
  | import javax.jws.WebMethod;
  | import javax.jws.WebService;
  | import javax.jws.soap.SOAPBinding;
  | 
  | import org.jboss.annotation.security.SecurityDomain;
  | import org.jboss.ws.annotation.EndpointConfig;
  | 
  | 
  | /**
  |  *
  |  * @author Wolfram
  |  **/
  | @WebService(name="LottoEJBWS", 
  | 		targetNamespace = "urn:com:tools:wsse",
  | 		serviceName = "LottoEJBWSService") 
  | @SOAPBinding(style = SOAPBinding.Style.DOCUMENT,
  | 		parameterStyle=SOAPBinding.ParameterStyle.WRAPPED, 
  | 		use=SOAPBinding.Use.LITERAL)
  | @EndpointConfig(configName="Standard WSSecurity Endpoint") 
  | public class LottoEJBWS {
  |     @WebMethod()
  |     public String get6from49() {
  |         Random random = new Random();	
  |         String result = "";
  | 
  | //cutted
  | 
  |         return (result);
  |     }
  | 
  |     /**
  |      * Web service operation
  |      */
  |     @WebMethod()
  |     public boolean setValue(String name, int age) {
  |         System.out.println("===================================="); 
  |         System.out.println("Name: " + name + " Age: " + age ); 
  |         System.out.println("===================================="); 
  |         return true;
  |     }
  | }
  | 

web.xml

  | <?xml version="1.0" encoding="UTF-8"?>
  | <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  | 	<context-param> 
  | 		<param-name>jbossws-config-name</param-name>
  | 		<param-value>Standard WSSecurity Endpoint</param-value> 
  | 		</context-param>	   
  |   <display-name>LottoWSSE-war</display-name>
  |      <servlet>
  |         <servlet-name>LottoEJBWS</servlet-name>
  |         <servlet-class>com.tools.wsse.LottoEJBWS</servlet-class>
  |         <load-on-startup>1</load-on-startup>
  |     </servlet>
  |     <servlet-mapping>
  |         <servlet-name>LottoEJBWS</servlet-name>
  |         <url-pattern>/LottoEJBWS</url-pattern>
  |     </servlet-mapping>
  |     <session-config>
  |         <session-timeout>30</session-timeout>
  |     </session-config>
  |   <welcome-file-list>
  |     <welcome-file>index.html</welcome-file>
  |     <welcome-file>index.htm</welcome-file>
  |     <welcome-file>index.jsp</welcome-file>
  |     <welcome-file>default.html</welcome-file>
  |     <welcome-file>default.htm</welcome-file>
  |     <welcome-file>default.jsp</welcome-file>
  |   </welcome-file-list>
  | </web-app>
  | 

jboss-wsse-client.xml

<jboss-ws-security xmlns="http://www.jboss.com/ws-security/config" 
  | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  | xsi:schemaLocation="http://www.jboss.com/ws-security/config 
  | http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
  |    <config>
  |             <sign type="x509v3" alias="s1as" includeTimestamp="false"/>
  |             <encrypt type="x509v3"
  |                   alias="s1as"/>
  |             <requires>
  |                 <signature/>
  |                 <encryption/>
  |              </requires>
  |         </config>
  | </jboss-ws-security>

jboss-wsse-server.xml

<jboss-ws-security xmlns="http://www.jboss.com/ws-security/config" 
  | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  | xsi:schemaLocation="http://www.jboss.com/ws-security/config 
  | http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
  |    <config>
  |             <sign type="x509v3" alias="s1as" includeTimestamp="false"/>
  |             <encrypt type="x509v3"
  |                   alias="s1as"/>
  |             <requires>
  |                 <signature/>
  |                 <encryption/>
  |              </requires>
  |         </config>
  | </jboss-ws-security>

Since @EndpointConfig points to AS_HOME/server/default/deploy/jbosswss.sar/META-INF no need to includes standard-jaxws-endpoint-config.xml.
All the above described in addition with Trust + Keystore is packed as war file and deployed successfull.

The Client Side is implemented as shown below. To get Service classes etc. wsconsume -k <wsdl-url> was used. All automatically generated files arent shown. So the Cleint looks like...


  | /*
  |  * Main.java
  |  *
  |  * Created on 22. Juni 2008, 18:20
  |  *
  |  * To change this template, choose Tools | Template Manager
  |  * and open the template in the editor.
  |  */
  | 
  | package com.tools.wsse;
  | 
  | import java.io.File;
  | import java.net.URL;
  | import java.util.ArrayList;
  | import java.util.Iterator;
  | import java.util.List;
  | import javax.jws.HandlerChain;
  | import javax.xml.namespace.QName;
  | import javax.xml.ws.BindingProvider;
  | import javax.xml.ws.Service;
  | import javax.xml.ws.WebServiceClient;
  | import javax.xml.ws.handler.Handler;
  | import org.apache.log4j.Logger;
  | import org.apache.log4j.PropertyConfigurator;
  | import org.jboss.ws.core.StubExt;
  | import org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerClient;
  | import org.jboss.ws.extensions.addressing.jaxws.WSAddressingClientHandler;
  | 
  | /**
  |  *
  |  * @author Wolfram
  |  */
  | public class Main {
  |     
  |     /** Creates a new instance of Main */
  |     public Main() {}
  |       
  |     public static void main(String[] args) {
  |     
  |         try { // Call Web Service Operation
  |                 // PropertyConfigurator.configure("src//log4j.properties");
  |          
  |             System.setProperty("org.jboss.ws.wsse.keyStore", "src/WEB-INF/keystore.jks");
  |             System.setProperty("org.jboss.ws.wsse.trustStore", "src/WEB-INF/cacerts.jks");
  |             System.setProperty("org.jboss.ws.wsse.keyStorePassword", "changeit");
  |             System.setProperty("org.jboss.ws.wsse.trustStorePassword", "changeit");
  |             System.setProperty("org.jboss.ws.wsse.keyStoreType", "jks");
  |             System.setProperty("org.jboss.ws.wsse.trustStoreType", "jks");
  |             
  |             URL wsdlURL = new URL("http://localhost:8080/LottoWSSE-war/LottoEJBWS?wsdl");
  |             QName serviceName = new QName("urn:com:tools:wsse", "LottoEJBWSService");
  |             Service service = Service.create(wsdlURL, serviceName);
  |             LottoEJBWS port = service.getPort(LottoEJBWS.class);
  |             System.out.println(System.getProperty("user.dir").toString());
  |             ((StubExt) port).setSecurityConfig(new File("src/META-INF/jboss-wsse-client.xml").toURI().toURL().toExternalForm()); 
  |             ((StubExt) port).setConfigName("Standard WSSecurity Client"); 
  |             
  |             BindingProvider bindingProvider = (BindingProvider)port;
  |             List<Handler> handlerChain = new ArrayList<Handler>();
  |             handlerChain.add(new WSAddressingClientHandler());
  |             handlerChain.add(new WSSecurityHandlerClient());
  |             handlerChain.add(new LogHandler());
  |             bindingProvider.getBinding().setHandlerChain(handlerChain); 
  | 
  |             //org.me.client.LottoEJBWSService service = new org.me.client.LottoEJBWSService();     
  |             //org.me.client.LottoEJBWS port = service.getLottoEJBWSPort();
  |                                
  |             // TODO process result here
  |             
  |             java.lang.String result = port.get6From49();
  |             System.out.println("Result = "+result);
  |         } catch (Exception ex) {
  |            System.out.println("Fehler: " + ex.getMessage()); 
  |            ex.printStackTrace(System.out);
  |         }
  |     
  |     }
  | }
  | 
  | 

the file jboss-wsse-client.xml is the same like above ones.  

The SoapRequest is signed and encrypted. but the server throws the following Exception.


  | 14:35:26,515 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
  | org.jboss.ws.core.CommonSOAPFaultException: Endpoint {urn:com:tools:wsse}LottoEJBWSPort does not contain operation meta data for: {http://www.w3.org/2001/04/xmlenc#}EncryptedData
  | 	at org.jboss.ws.core.server.ServiceEndpointInvoker.getDispatchDestination(ServiceEndpointInvoker.java:468)
  | 	at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:177)
  | 	at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:466)
  | 	at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:284)
  | 	at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:201)
  | 	at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:134)
  | 	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(ApplicationFilterChain.java:290)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  | 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  | 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
  | 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  | 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
  | 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
  | 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
  | 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
  | 	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
  | 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  | 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
  | 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
  | 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
  | 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
  | 	at java.lang.Thread.run(Thread.java:595)
  | 14:35:26,515 ERROR [SOAPFaultHelperJAXRPC] SOAP request exception
  | javax.xml.rpc.soap.SOAPFaultException: Endpoint {urn:com:tools:wsse}LottoEJBWSPort does not contain operation meta data for: {http://www.w3.org/2001/04/xmlenc#}EncryptedData
  | 	at org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC.exceptionToFaultMessage(SOAPFaultHelperJAXRPC.java:189)
  | 	at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.exceptionToFaultMessage(SOAPFaultHelperJAXWS.java:170)
  | 	at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.createFaultMessageFromException(SOAP11BindingJAXWS.java:104)
  | 	at org.jboss.ws.core.CommonSOAPBinding.bindFaultMessage(CommonSOAPBinding.java:671)
  | 	at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:279)
  | 	at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:466)
  | 	at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:284)
  | 	at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:201)
  | 	at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:134)
  | 	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(ApplicationFilterChain.java:290)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  | 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  | 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
  | 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  | 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
  | 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
  | 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
  | 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
  | 	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
  | 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  | 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
  | 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
  | 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
  | 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
  | 	at java.lang.Thread.run(Thread.java:595)


I hope to pointed out detaily my problem and looking froward for response.

Thank You

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4162082#4162082

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4162082



More information about the jboss-user mailing list