Jboss webservice error using topdown approach - jbossws

I started creating a sample webservice using top-down approach in jboss4.2.2 GA.
From the wsdl, i generated stubs using wsconsume
I created a new java class: SalesTaxImpl implementing the interface in the generated stub. Configured #WebService with endpointInterface, portname, wsdllocation.
My war application has the following:
WEB-INF/classes/
WEB-INF/wsdl/SalesTaxService.wsdl
WEB-INF/web.xml
In web.xml i have,
<web-app>
<servlet>
<servlet-name>SalesTax</servlet-name>
<servlet-class>com.hp.np.ws.SalesTaxImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SalesTax</servlet-name>
<url-pattern>/tax</url-pattern>
</servlet-mapping>
</web-app>
After placing the war in <JBOSS_HOME>/server/default/deploy path, i am getting the following error:
19:25:05,046 INFO [DefaultEndpointRegistry] register: jboss.ws:context=JbossWST
opDown,endpoint=SalesTax
19:25:05,078 INFO [TomcatDeployer] deploy, ctxPath=/JbossWSTopDown, warUrl=.../
tmp/deploy/tmp13893JbossWSTopDown-exp.war/
19:25:05,171 ERROR [MainDeployer] Could not start deployment: file:/C:/jboss-4.2
.2.GA/server/default/deploy/JbossWSTopDown.war
org.jboss.ws.WSException: Cannot build meta data: Cannot get URL for: WEB-INF/ws
dl/SalesTaxService.wsdl
at org.jboss.ws.metadata.builder.jaxws.JAXWSWebServiceMetaDataBuilder.bu
ildWebServiceMetaData(JAXWSWebServiceMetaDataBuilder.java:207)
at org.jboss.ws.metadata.builder.jaxws.JAXWSServerMetaDataBuilder.setupP
roviderOrWebService(JAXWSServerMetaDataBuilder.java:50)
I tried giving different combination, but no luck

Related

Does RemoteApiOption method useServiceAccountCredential works with P12 file?

Does useServiceAccountCredential works with P12 file. I am trying to use it in Java and get error com.google.appengine.repackaged.com.google.api.client.http.HttpResponseException‌​: 302 Found
Yes it does. You need to have an AppEngine app serving the remote API. E.g., you would have a python app, with the following lines in app.yaml:
- url: /remoteapi.*
script: google.appengine.ext.remote_api.handler.application
Or java app with the following in web.xml:
<servlet>
<display-name>Remote API Servlet</display-name>
<servlet-name>RemoteApiServlet</servlet-name>
<servlet-class>com.google.apphosting.utils.remoteapi.RemoteApiServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>RemoteApiServlet</servlet-name>
<url-pattern>/remote_api</url-pattern>
</servlet-mapping>
Please note that depending on your client, it might call a bit different url, e.g. /remote_api
Also, if you have deployed the AppEngine app in a module, take that into account in the client code, you would have:
RemoteApiOptions raoptions = new RemoteApiOptions()
.server("my-module-dot-my-project.appspot.com", 443)
.useServiceAccountCredential("my-service-account-id", "my-p12-file.p12");
RemoteApiInstaller installer = new RemoteApiInstaller();
installer.install(raoptions);
Hope that helps!

Ajax Proxy in WebSphere Portal

I am not able to make the ajax proxy work in WebSphere Portal 8. I tried using the Application specific ajax proxy method.
Below are my proxy config xml and web.xml
<?xml version="1.0" encoding="UTF-8"?>
<proxy:proxy-rules
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:proxy="http://www.ibm.com/xmlns/prod/sw/ajax/proxy-config/1.1">
<proxy:mapping url="http://api.wunderground.com/api/<key>/conditions/q/CA/San_Francisco.json" contextpath="/get/weatherData" />
<proxy:policy url="http://api.wunderground.com/api/<key>/conditions/q/CA/San_Francisco.json" acf="none">
<proxy:actions>
<proxy:method>GET</proxy:method>
</proxy:actions>
<proxy:headers></proxy:headers>
<proxy:mime-types></proxy:mime-types>
<proxy:cookies></proxy:cookies>
<proxy:users></proxy:users>
</proxy:policy>
<proxy:ipfilter></proxy:ipfilter>
</proxy:proxy-rules>
web.xml
<servlet>
<servlet-name>ProxyServlet</servlet-name>
<servlet-class>com.ibm.wps.proxy.servlet.ProxyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ProxyServlet</servlet-name>
<url-pattern>/get/weatherData</url-pattern>
</servlet-mapping>
The issue need to be inside of the ajax proxy xml you copied. the is corrupting the xml syntax of the document.
An XML validator (like https://www.xmlvalidation.com/ ) shows this error
The value of attribute "url" associated with an element type "proxy:mapping" must not contain the '<' character.
You could use the following mapping config to correct the problem then all information appended to get/weatherData will be attached to /api/.
<proxy:mapping
url="http://api.wunderground.com/api/"
contextpath="/get/weatherData" />
As I do not know what means in your application maybe it would be as simple as replacing with the real value

Jersey 2.2.0 on Google App Engine. Error 404. jersey init. works locally though

I am deploying my app using jersey 2.2.0 jars onto google app engine. I have been developing and running locally and it works well during local run/test.
I deployed to the google app engine, and I start getting Error: 404 erros for all resources. Checking google logs, at the first request it spits out the following
org.glassfish.jersey.server.ApplicationHandler initialize: Initiating Jersey application, version Jersey: 2.7 2014-03-12 18:11:31...
The jersey servlet spits out the following
I 09:27:38.889 org.glassfish.jersey.filter.LoggingFilter log: 1 * Server has received a request on thread Request EE25C261
GET http://xxxx.appspot.com/service/users/test
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
Accept-Language: en-US,en;q=0.8
Host: xxxxx.appspot.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36
X-AppEngine-City: bangalore
X-AppEngine-CityLatLong: 12.971599,77.594563
X-AppEngine-Country: IN
X-AppEngine-Region: ka
and then spits out the resource not found
I 09:41:15.094 org.glassfish.jersey.filter.LoggingFilter log: 3 * Server responded with a response on thread Request 9826AB68
< 404
It also adds one more line which suggests
I 09:27:39.180 This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application.
Now, all this works on my local testing but is only an issue when deployed to Google App Engine.
Here's my 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" version="2.5">
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>
org.glassfish.jersey.servlet.ServletContainer
</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<!-- Enter your Jersey resources to speed up initial Jersey loading
You can separate the java packages using , -->
<param-value>com.poolE.web.rest</param-value>
</init-param>
<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>org.glassfish.jersey.filter.LoggingFilter</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/service/*</url-pattern>
</servlet-mapping>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties" />
</system-properties>
</web-app>
and my jersey class is
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.poole.web.jpa.EMFService;
import com.poole.web.jpa.Users;
import com.poole.web.jpa.model.User;
#Path("/users/")
public class UsersResource {
private static final Logger log = Logger.getLogger(UsersResource.class.getName());
#GET
#Produces("application/json")
#Path("test")
public String info() {
log.info("comes into test");
return "Hello Jersey on Google App Engine";
}
}
Any help will be appreciated. I am stuck in this frustrating problem of just plumbing it all together in GAE

Deploying CXF webservices in Tomcat

I am trying to deploy a web service in Tomcat7 using maven.
Below I provide some configuration info:
web.xml
...
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
...
pom.xml
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
<path>/services/userinfo</path>
...
Given the <url-pattern>/services/*</url-pattern> and <path>/services/userinfo</path> configuration, the URL http://localhost:8080/services/userinfo shows 404.
If using instead <url-pattern>/*</url-pattern> everything works as expected (i.e. http://localhost:8080/services/userinfo shows the list of available methods).
The question:
Why /services/* doesn't work in my case?
The path in your tomcat-maven-plugin configuration
<path>/services/userinfo</path>
defines where you are deploying the webapp (the context root). In this case, you are deploying it to
http://localhost:8080/services/userinfo
Check out the webapps directory in your Tomcat installation.
Since you are defining the CXFServlet mapping as /services/*, the CXF service list would show at
http://localhost:8080/services/userinfo/services/
When you re-defined the mapping to /*, it just appeared to work as expected, but that was only because the context root you used and the service listing path you expected were the same.

Web.xml:welcome file displayed incorrectly

Welcome file is not displayed correctly on hosting.
web.xml:
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
on local Tomcat:
http://localhost:8099/Teal-0.1-BETA/ is OK
equals to
http://localhost:8099/Teal-0.1-BETA/index.html is OK
on hosting:
http://domain/index.html is OK
http://domain/ is displayed non correctly
As I observed this is displayed not correctly too:
http://domain/index.xhtml
I suspect web.xml config. Looks like problem in .html vs .xhtml extension.
Real file name is index.xhtml
I think that the problem is that you use JSF, but Tomcat renders welcome-file only with JSP engine. That might have been adressed in newer tomcat (7.x) which you have locally, but server uses older Tomcat.
But that's just my guess. Still I don't have much info.
Either case, try setting a welcome page to a plain file with immediate redirection to /index.html . Or better, handle it in Apache (or whatever you have in front of Tomcat).

Resources