I'm trying to get a CXF service running on existing jetty server (not stand-alone).
I see the list of services at http://localhost:9100/cxfservices
But, when I click on the wsdl link, I get 404 error. What am I missing here?
WSDL link is:http://localhost:9100/cxfservices/QueryService?wsdl
Endpoint address: http://localhost:9100/cxfservices/QueryService
web.xml
...
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/cxfservices/*</url-pattern>
</servlet-mapping>
...
beans.xml
...
<jaxws:endpoint id="queryService"
implementor="com.sap.odp.cxf.QueryServiceImpl"
address="/QueryService"/>
...
Related
I have started an Google cloud endpoints v2 project using the starter code provided by Google which exposes one API named "echo".
My aim is to add another exposed class (one class/api name per business module).
Once deployed, all calls to the new API are not generating a "NOT FOUND" error.
As a solution i have tried to look into the web.xml and did the below changes.
Initial WEB.XML version:
<!-- Route API method requests to the backend. -->
<servlet-mapping>
<servlet-name>EndpointsServlet</servlet-name>
<url-pattern>/_ah/api/*</url-pattern>
</servlet-mapping>
I have added my new servlet and tried to add a new servlet mapping as below:
<servlet-mapping>
<servlet-name>EndpointsServlet</servlet-name>
<url-pattern>/_ah/api/echo/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>UserEndpointsServlet</servlet-name>
<url-pattern>/_ah/api/user/*</url-pattern>
</servlet-mapping>
Now after adding the /echo/* to the initial servlet mapping, the ECHO working services stopped servicing, and the system still cannot invoke the new service.
Does anyone knows what i am doing wrong and what is the solution?
I don't think this feature is not supported by the endpoints v2 framework since it does seem a good design practice to do this separation.
You should use the same servlet, using an init-param with all of the Endpoint classes you need:
<init-param>
<param-name>services</param-name>
<param-value>com.example.echo.Echo,com.example.echo.Echo2</param-value>
</init-param>
You should not use /_ah/api/echo/* or /_ah/api/user/* in your web.xml. Instead, use #Api(name = "echo") or #Api(name = "user") and bind EndpointsServlet to /_ah/api/*.
I am using PrimeFaces 5.0 and tomcat 7 and my application is in AWS.
I am trying to use PrimeFaces push. I have implemented a sample application and it is working with my local system. If i deploy the code to AWS it fails.
Xhtml code
<p:socket onMessage="jsFunctionToCall" channel="/service/push"/>
Web.xml
<filter>
<filter-name>shiroFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.cpr.AtmosphereInterceptor</param-name>
<param-value>org.atmosphere.interceptor.ShiroInterceptor</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>shiroFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>Push Servlet</servlet-name>
<servlet-class>org.primefaces.push.PushServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>Push Servlet</servlet-name>
<url-pattern>/primepush/*</url-pattern>
</servlet-mapping>
Java code
#PushEndpoint("/service/push")
public class ServicePushResource {
#OnMessage(encoders = {JSONEncoder.class})
public String onMessage(String count) {
return count;
}
}
Pushing message:
EventBus eventBus = EventBusFactory.getDefault().eventBus();
eventBus.publish("/service/push", String.valueOf("msg"));
I am getting the error message that
WebSocket connection to 'ws://example.com/primepush/service/push?X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.2.4-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-atmo-protocol=true' failed: Error during WebSocket handshake: Unexpected response code: 501
After this error there is another error message that
Websocket failed. Downgrading to Comet and resending push.js.xhtml?ln=primefaces&v=5.1:1
Failed to load resource: the server responded with a status of 501 (Not Implemented) http://example.com/primepush/service/push?X-Atmos…ng&X-Atmosphere-TrackMessageSize=true&X-atmo-protocol=true&_=1422008343786
On inspecting both the error message, I found that the p:socket component is failing with transport as 'WebSocket' and it is trying with 'long-polling' which is not implemented. So my question is whether AWS support 'WebSocket' if not what is the workaround for that?
Currently WebSocket is not supported with AWS. The work aroud is to use AWS EB loadbalancer with TCP/SSL. I did this by changing the protocol from HTTP to TCP in loadbalancer configuration. But this won't work alone, need to tell beanstalk to communicate directly to tomcat in case of websocket. This can be done using a configuration file which can be added as specified in this post.
Documentation of Primefaces 5.0 says to use Atmosphere 2.1.3. I had had similar problem as you when I tried to use 2.2.x version. The current version I use is 2.1.4 and it works for me fine. Maybe you could try this also.
The other case is that firefox browser throws wss connection error (but primepush works anyway).
Please refer also to:
https://bugzilla.mozilla.org/show_bug.cgi?id=594502
Is it possible to start JAXWS servlet at the roor of the web contex, so that the WSDL will be also accessible?
My context root, defined in application.xml is /myapp/webservice/v1 (the last part should be configurable in the deployment descriptor, and the web service should be available in web context root).
I've tried:
<servlet>
<display-name>WebService</display-name>
<servlet-name>WebService</servlet-name>
<servlet-class>my.package.WebServiceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>WebService</servlet-name>
<url-pattern></url-pattern>
</servlet-mapping>
The WebService answers under the address /myapp/webservice/v1, but when I type /myapp/webservice/v1?wsdl, it's converted into /myapp/webservice/v1/?wsdl, which doesn't return WSDL, but it tries to invoke the WebService itself, which answers: "Hello! This is an Axis2 Web Service!" (standard greeting when doing GET to WebService).
I've tried also with url pattern '.'. '' and '/' are not accepted (WebSphere).
When I use
<url-pattern>ws</url-pattern>
and
<welcome-file-list>
<welcome-file>ws</welcome-file>
</welcome-file-list>
the web service works, but the WSDL is available only on /myapp/webservice/v1/ws?wsdl, which makes the solution incompatibile with existing clients.
The reason behind is to create version as separate WARs, which can be then deployed independently or within EAR, and to make WebService address fully configurable, we need to make it accessible under the context root of the Web Module.
I don't know if the problems we are experiencing are WebSphere-specific or Axis-specific...
I have created a cloundfoundry app using Spring. However, my jsp files are being rendered as pure text (as if Tomcat is not executing the source code). The browser shows the source when requesting a particular URL.
File structure
webapps
-jsp
-javascripts
-css
-WEB-INF
web.xml:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:META-INF/spring/applicationContext*.xml</param-value>
</context-param>
<welcome-file-list>
<welcome-file>/jsp/index.jsp</welcome-file>
</welcome-file-list>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Handles Spring requests -->
<servlet>
<servlet-name>Honesty</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/spring/webmvc-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Honesty</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
spring config:
<!-- Turns on support for mapping requests to Spring MVC #Controller methods
Also registers default Formatters and Validators for use across all #Controllers -->
<mvc:annotation-driven/>
<context:annotation-config />
<mvc:default-servlet-handler/>
Thanks for any insight you can provide. Its as if Tomcat is not serving the request as the JSP source is showing, not a JSP rendered page.
The response headers show nginx as the server:
Connection:keep-alive
Date:Mon, 30 Jul 2012 03:58:16 GMT
ETag:W/"611-1343620259000"
Keep-Alive:timeout=20
Server:nginx
Are you using Spring MVC? I suppose you are putting the JSP in some resource directory which can be accessed. Would like to see your spring configuration file and your project structure.
The problem was my servlet mapping of "/*". switched to just "/" and now everything works as expected.
Inside the applicationcontext.xml file we have like this
<bean id="vincent" class="com.bayer.vincent.service.vincent"/>
<jaxws:endpoint
id="vincentSOAP"
implementor="#vincent"
implementorClass="com.bayer.vincent.service.vincent"
address="/vincent/soap"
bindingUri="http://schemas.xmlsoap.org/wsdl/soap/" />
what does this mean by this defination ??
My question is how the vincent class is being getting called ??
CXF has provided a custom spring namespace to help easily configure a webservice endpoint here.
If the implementor starts with a #, CXF makes the assumption that the endpoint is a Spring Bean, the way it is in your case.
The endpoint will have to be a normal JAX-WS endpoint, i.e annotated with #Webservice annotation, eg:
#WebService(serviceName="MemberService", endpointInterface="org.bk.memberservice.endpoint.MemberEndpoint", targetNamespace="http://bk.org/memberservice/")
Now any call to your uri-/vincent/soap, will be redirected by the CXF front controller(which you can register in the web.xml file):
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
which maintains an internal registry of payload uri's to handlers(in this case the Spring bean) and dispatches the request appropriately.
As far I understand there created proxy class which forwards all calls to your real class.
See also Configuring an Endpoint where described all jaxws:endpoint attributes.