Skip to main content

Glassfish V3 Embedded and Webservices (JAX-WS)

32 replies [Last post]
mzkq6z
Offline
Joined: 2010-11-10

Hi All,
I've been looking at deploying Webservices (JAX-WS) in the Embedded version of Glassfish.
I can't find any definitive documentation to say if this can be done or not?
I've attempted to use the both the Server Class and the Maven Embedded Plugin, but without any joy, and I've used the latest versions and snapshots versions for both. In have no problems in deploying EJBs, EJBs in Wars and so forth but cannot get a Webservices up and running.
Someone raised an issue #117 on this on the embedded Glassfish project, but there is no update since May of this year. So I'm unsure if there is an option to allow webservices to be deployed. I've read very brief documentation that it's planned, but no idea for when?
If it can be done, would appreciate any help.
Regards

Amjad

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mvatkina
Offline
Joined: 2005-04-04

If you are using GlassFish embedded API, try adding these jars to the classpath:
modules/endorsed/jaxb-api-osgi.jar
modules/endorsed/webservices-api-osgi.jar
modules/endorsed/javax.annotation.jar

If you are using EJB embedded API (createEJBContainer), see notes for https://glassfish.dev.java.net/issues/show_bug.cgi?id=12202 with the description of what I was able to successfuly test.

HTH,
-marina

mzkq6z
Offline
Joined: 2010-11-10

Hi,
I've had no luck in terms of attempts I've done the following:

  • Added the glassfish-embedded-static-shell jar version 3.0-b74b to the war file
  • Added all the jars you listed to the classpath, I don't know how the plugin loads this however I've tried various ways
  1. Glassfish Lib Folder
  2. Classpath element under the configuration element of the plugin.
  3. Dependancies at scope system level

If you can explain the versions have jars you are using, how you are loading the jars to the classpath, any additional configuration and some samples for the Maven Plugin that would be great.
Regards
Amjad

367 Guest
Offline
Joined: 2010-11-12

glassfish-embedded-static-shell jar must stay where it is, and either
referenced from there (e.g. if you use ANT) or referenced from it's place
using system scope dependency in Maven.

mvatkina
Offline
Joined: 2005-04-04

glassfish-embedded-static-shell jar must stay where it is, and either referenced from there (e.g. if you use ANT) or referenced from it's place using system scope dependency in Maven.

domdorn
Offline
Joined: 2009-06-20

your question per email and if you just use the first words of your
message as subject, its quite annoying to filter out if one can
contribute or not.

thanks

On Thu, Nov 11, 2010 at 10:02 AM, wrote:
>  Hi,
>
> I've had no luck in terms of attempts I've done the following:
>
>  * Added the glassfish-embedded-static-shell jar version 3.0-b74b to the war
>   file
>  * Added all the jars you listed to the classpath, I don't know how the
>   plugin loads this however I've tried various ways
>
>  1) Glassfish Lib Folder
>  2) Classpath element under the configuration element of the plugin.
>  3) Dependancies at scope system level
>
> If you can explain the versions have jars you are using, how you are loading
> the jars to the classpath, any additional configuration and some samples for
> the Maven Plugin that would be great.
>
> Regards
>
> Amjad
>
>

mzkq6z
Offline
Joined: 2010-11-10

Hi,
The issue is that none of the browsers I've used IE, FireFox, or Chrome does the subject line appear anymore.
I can't make the subject line appear next to my name.
Regards

Amjad

mzkq6z
Offline
Joined: 2010-11-10

Hi,
Currently I'm working with the embedded glassfish plugin, and I point this to an instance of Glassfish.
I tried add the following jars without any joy:
modules/webservices-connector.jar
modules/webservices-osgi.jar
modules/webservices.security.jar
modules/jsr109-impl.jar
modules/endorsed/webservices-api-osgi.jar
modules/endorsed/jaxb-api-osgi.jar
I will try to add them as a dependency to see if this makes a difference.

However will also try the following in the link
"Webservices are supported when they are packaged in a war file with the static-shell.jar ONLY"

Does this mean I need to add the static-shell into the war file?
Regards
Amjad

Bhavanishankar ...
Offline
Joined: 2010-11-11

Hi,

If you have the installed GlassFish, then to get this to work, configure
the plugin like this:

org.glassfish
maven-embedded-glassfish-plugin
3.1-SNAPSHOT

glassfish
target/webservice.war
8080
webservice
embedded
/tmp/glassfishv3/glassfish

start
pre-integration-test

start
deploy

stop
post-integration-test

undeploy
stop

Basically you need to set the installRoot, and point to 3.1-SNAPSHOT of
the plugin.

-Bhavani.

On 11/11/2010 01:14 PM, forums@java.net wrote:
> Hi,
>
> Currently I'm working with the embedded glassfish plugin, and I point
> this to
> an instance of Glassfish.
>
> I tried add the following jars without any joy:
>
> modules/webservices-connector.jar
>
> modules/webservices-osgi.jar
>
> modules/webservices.security.jar
>
> modules/jsr109-impl.jar
>
> modules/endorsed/webservices-api-osgi.jar
>
> modules/endorsed/jaxb-api-osgi.jar
>
> I will try to add them as a dependency to see if this makes a difference.
>
>
>
>
>
> However will also try the following in the link
>
> "Webservices are supported when they are packaged in a war file with the
> static-shell.jar ONLY"
>
>
>
> Does this mean I need to add the static-shell into the war file?
>
> Regards
>
> Amjad
>
>
>
>

336 Guest
Offline
Joined: 2010-11-11

 Hi,

In addition:

I've attempted to use the Snapshot 3.1 version of Maven Embedded Plugin put
cannot get this to work with the Snapshot 3.1 version of Embedded-All jar, so
I'm using this with the 3.01 version.

If you are aware how I can get around this, this would be appreciated.

Regards

Amjad

829 Guest
Offline
Joined: 2010-11-11

 Hi,

Can you expand on what these element are set to?

 

glassfish

target/webservice.war

8080
webservice
embedded

Thanks

Amjad

 

mzkq6z
Offline
Joined: 2010-11-10

Hi,
In addition:
I've attempted to use the Snapshot 3.1 version of Maven Embedded Plugin put cannot get this to work with the Snapshot 3.1 version of Embedded-All jar, so I'm using this with the 3.01 version.
If you are aware how I can get around this, this would be appreciated.
Regards
Amjad

906 Guest
Offline
Joined: 2010-11-11

 Hi,

Sorry ignore the last comment, as it does work with the lastest snapshot
version of the embedded all jar. However webservices won't deploy.

Regards

Amjad

Bhavanishankar ...
Offline
Joined: 2010-11-11

The issue with 3.1-SNAPSHOT of the plugin has been fixed. It should work
now. Please try again and let me know.

On 11/11/2010 02:52 PM, forums@java.net wrote:
> Hi,
>
> In addition:
>
> I've attempted to use the Snapshot 3.1 version of Maven Embedded
> Plugin put
> cannot get this to work with the Snapshot 3.1 version of Embedded-All
> jar, so
> I'm using this with the 3.01 version.
>
> If you are aware how I can get around this, this would be appreciated.
>
> Regards
>
> Amjad
>
>

mzkq6z
Offline
Joined: 2010-11-10

Hi,
I've used the latest version no joy, and I've run your copy of the test webservice which works, which is very simple.
So its obvious it works for very simple webservices, anything more complicated it dosn't seem to work.
The war file I have has multiple Webservices, it has an EJB which talks to an JPA Entity. There must be some setting which is preventing this being seen to work.
If you have any other suggestions it would be appreciated.

Regards

Amjad

Bhavanishankar Guest 3 wrote:
The issue with 3.1-SNAPSHOT of the plugin has been fixed. It should work now. Please try again and let me know. On 11/11/2010 02:52 PM, forums@java.net wrote: > Hi, > > In addition: > > I've attempted to use the Snapshot 3.1 version of Maven Embedded > Plugin put > cannot get this to work with the Snapshot 3.1 version of Embedded-All > jar, so > I'm using this with the 3.01 version. > > If you are aware how I can get around this, this would be appreciated. > > Regards > > Amjad > >

6 Guest
Offline
Joined: 2010-11-11

 Hi,

Thinking about this the sample webservice deploys, whether it works or not
I'm not sure? How would I test this to ensure it works? What do I need to see
in the logs to determine its deployed the webservices? Its definitely
deployed the war file,  but I can't see any webservice deployment or that
its listening on any ports.

In my sample I would like to connect to it via SOAPUI, however the fact I
can't and I can't see any deployment of the webservices suggests it deploys
just the war on its own, and does not show the Webservices. Which leads to
the question is this expected behavior? Is there any way I can call the
webservices using SOAPUI?

Regards

Amjad

Bhavanishankar ...
Offline
Joined: 2010-11-11

Please file an issue by attaching your app. I will look into it.

On 11/11/2010 06:00 PM, forums@java.net wrote:
>
>
>
>
> Hi,
>
> I've used the latest version no joy, and I've run your copy of the test
> webservice which works, which is very simple.
>
> So its obvious it works for very simple webservices, anything more
> complicated it dosn't seem to work.
>
> The war file I have has multiple Webservices, it has an EJB which
> talks to an
> JPA Entity. There must be some setting which is preventing this being
> seen to
> work.
>
> If you have any other suggestions it would be appreciated.
>
> Regards
>
> Amjad
>
>
>
>

Bhavanishankar Guest 3 wrote:
The issue with 3.1-SNAPSHOT of the
> plugin has
> been fixed. It should work now. Please try again and let me know. On
> 11/11/2010 02:52 PM, forums@java.net wrote: > Hi, > > In addition: > >
> I've
> attempted to use the Snapshot 3.1 version of Maven Embedded > Plugin
> put >
> cannot get this to work with the Snapshot 3.1 version of Embedded-All
> > jar,
> so > I'm using this with the 3.01 version. > > If you are aware how I
> can get
> around this, this would be appreciated. > > Regards > > Amjad > >

>
>

mzkq6z
Offline
Joined: 2010-11-10

Hi,
Thinking about this the sample webservice deploys, whether it works or not I'm not sure? How would I test this to ensure it works? What do I need to see in the logs to determine its deployed the webservices? Its definitely deployed the war file, but I can't see any webservice deployment or that its listening on any ports.
In my sample I would like to connect to it via SOAPUI, however the fact I can't and I can't see any deployment of the webservices suggests it deploys just the war on its own, and does not show the Webservices. Which leads to the question is this expected behavior? Is there any way I can call the webservices using SOAPUI?

Regards

Amjad

Bhavanishankar ...
Offline
Joined: 2010-11-11

cd v3/tests/embedded/maven-plugin/webservice (or wherever you have
checked out)
export S1AS_HOME=%Your GlassFish installation root%
mvn install

This will deploy the webservice and run junit tests as well.

-Bhavani.

On 11/11/2010 08:24 PM, forums@java.net wrote:
> Hi,
>
> Thinking about this the sample webservice deploys, whether it works or
> not
> I'm not sure? How would I test this to ensure it works? What do I need
> to see
> in the logs to determine its deployed the webservices? Its definitely
> deployed the war file, but I can't see any webservice deployment or that
> its listening on any ports.
>
> In my sample I would like to connect to it via SOAPUI, however the fact I
> can't and I can't see any deployment of the webservices suggests it
> deploys
> just the war on its own, and does not show the Webservices. Which
> leads to
> the question is this expected behavior? Is there any way I can call the
> webservices using SOAPUI?
>
> Regards
>
> Amjad
>
>

mzkq6z
Offline
Joined: 2010-11-10

Hi,
Thanks for the update.
There are no junit tests, all you have in the project is one pom file, a web xml file and one webservice which is in the test folder that has two methods and that's it? No tests run when the service is deployed as there is no test?
Regards

Amjad

Anonymous

Hi,

thanks for the response.

>The SAM is triggered whenever a protected URL is accessed. And it is not
clear why that is not sufficient for your case ?.

ok. That is fine. So, the _standard_ url isn't needed at all and I can use
whatever I want as long as I post to a protected URL.

> With the SAM you need to control the response. Firstly you should not use
FAILURE since that is for the Client Side SAM.

>Also the spec says the following (so my question to you is did you set a
Failure Response Message to be sent to the client or not ?)

Again, fine. I missed that. That is probably the problem with too trivial
examples :)
I added the response status and
s.setStatus(HttpServletResponse.SC_FORBIDDEN); response message
messageInfo.setResponseMessage(s);

But I still don't get the configured 403 error page .. not even the
GlassFish standard 403 but only a browser message.
Is there more magic I should know about? Or spec I haven't read? ;)

>you could set a cookie in the response.

Hmm..

Thanks!
- M

Kumar Jayanti Guest
Offline
Joined: 2011-04-02

On Aug 28, 2012, at 6:20 PM, Markus Eisele wrote:

> Hi,
>
> thanks for the response.
>>
>> >The SAM is triggered whenever a protected URL is accessed. And it is not clear why that is not sufficient for your case ?.
>>
>> ok. That is fine. So, the _standard_ url isn't needed at all and I can use whatever I want as long as I post to a protected URL.
>>
>>
>> > With the SAM you need to control the response. Firstly you should not use FAILURE since that is for the Client Side SAM.
>>
>> >Also the spec says the following (so my question to you is did you set a Failure Response Message to be sent to the client or not ?)
>
>>
>> Again, fine. I missed that. That is probably the problem with too trivial examples :)
>> I added the response status and s.setStatus(HttpServletResponse.SC_FORBIDDEN); response message
>> messageInfo.setResponseMessage(s);
>>
>> But I still don't get the configured 403 error page .. not even the GlassFish standard 403 but only a browser message.
>> Is there more magic I should know about? Or spec I haven't read? ;)

Not sure if you have hit a bug then ?. Which version of GlassFish are you testing with ?. Are you saying whatever response message you set was lost ?.

>>
>>
>> >you could set a cookie in the response.
>>
>> Hmm..
>>
>> Thanks!
>> - M
>

Bhavanishankar ...
Offline
Joined: 2010-11-11

I am not sure what you referring to. In my workspace
v3/tests/embedded/maven-plugin/webservice, this is what it is:

$ find . -name "*.java"

./src/test/java/org/glassfish/tests/standalonewar/WebTest.java
./src/main/java/test/SimpleWebService.java

$ find . -name "pom.xml"

./pom.xml

$ mvn install

....
INFO: webservice was successfully deployed in 16,701 milliseconds.
PlainTextActionReporterSUCCESS
Description: deploy AdminCommand
Application deployed with name webservice.
[name=webservice]
Nov 11, 2010 9:48:14 PM PluginUtil doDeploy
INFO: Deployed webservice
[INFO] [surefire:test {execution: default}]
[INFO] Surefire report directory:
/export/bhavani/ws/glassfish/v3/tests/embedded/maven-plugin/webservice/target/surefire-reports

870 Guest
Offline
Joined: 2010-11-14

Hi,
I tried to run the sample but I get errors for the test with Glassfish V3.01.
However it works with latest version of Glassfish which is 3.1.
So I guess this doesn't work with Glassfish version 3.01 as the install root,
would this be a correct assumption?
Regards
Amjad

mzkq6z
Offline
Joined: 2010-11-10

Hi,

I tried to run the sample but I get errors for the test with Glassfish V3.01. However it works with latest version of Glassfish which is 3.1.

So I guess this doesn't work with Glassfish version 3.01 as the install root, would this be a correct assumption?

Regards

Amjad

Bhavanishankar ...
Offline
Joined: 2010-11-14

Yes, use 3.1-SNAPSHOT.

On 11/14/2010 07:20 PM, forums@java.net wrote:
> Hi,
> I tried to run the sample but I get errors for the test with Glassfish
> V3.01.
> However it works with latest version of Glassfish which is 3.1.
> So I guess this doesn't work with Glassfish version 3.01 as the
> install root,
> would this be a correct assumption?
> Regards
> Amjad
>
>

mzkq6z
Offline
Joined: 2010-11-10

Thanks for the response. I didn't see the test class WebTest.java so I'll try this out tomorrow.
Regards
Amjad

mzkq6z
Offline
Joined: 2010-11-10

Hi,
Sorry ignore the last comment, as it does work with the lastest snapshot version of the embedded all jar. However webservices won't deploy.
Regards
Amjad

mzkq6z
Offline
Joined: 2010-11-10

Hi,
Can you expand on what these element are set to?

glassfish
target/webservice.war
8080
webservice
embedded

Thanks

Amjad

913 Guest
Offline
Joined: 2010-11-11

 My Config is:

 

      

glassfish  

IntegrationTestServer

${basedir}/../caseprep-integration-webservices/target/caseprep-integration-webservices.war

all

true 

${basedir}/config/caseprep-integration-test/domain.xml

${basedir}/glassfish

${basedir}/glassfish

caseprep-integration-webservices

8080

     

Bhavanishankar ...
Offline
Joined: 2010-11-11

I just added a webservice test @
https://glassfish-svn.dev.java.net/source/browse/glassfish-svn/trunk/v3/...

Please refer to the pom.xml there.

-Bhavani.

On 11/11/2010 02:40 PM, forums@java.net wrote:
> Hi,
>
> Can you expand on what these element are set to?
>
>
>
> glassfish
>
> target/webservice.war
>
> 8080
> webservice
> embedded
>
> Thanks
>
> Amjad
>
>
>
>

mzkq6z
Offline
Joined: 2010-11-10

My Config is:

<configuration>
<goalPrefix>glassfish</goalPrefix>
<serverID>IntegrationTestServer</serverID>
<app>${basedir}/../caseprep-integration-webservices/target/caseprep-integration-webservices.war</app>
<containerType>all</containerType>
<autoDelete>true</autoDelete>
<configFile>${basedir}/config/caseprep-integration-test/domain.xml</configFile>
<instanceRoot>${basedir}/glassfish</instanceRoot>
<installRoot>${basedir}/glassfish</installRoot>
<name>caseprep-integration-webservices</name>
<port>8080</port>
</configuration>

Bhavanishankar ...
Offline
Joined: 2010-11-11

Remove configFile, instanceRoot parameters. Change installRoot paramter
to point to your existing installation.

On 11/11/2010 03:06 PM, forums@java.net wrote:
> My Config is:
>
>
>
>
>
> glassfish
>
> IntegrationTestServer
>
> ${basedir}/../caseprep-integration-webservices/target/caseprep-integration-webservices.war
>
>
> all
>
> true
>
> ${basedir}/config/caseprep-integration-test/domain.xml
>
>
> ${basedir}/glassfish
>
> ${basedir}/glassfish
>
> caseprep-integration-webservices
>
> 8080
>
>
>
>

701 Guest
Offline
Joined: 2010-11-10

 Hi All,

I've been looking at deploying Webservices (JAX-WS) in the Embedded version
of Glassfish.

I can't find any definitive documentation to say if this can be done or not?

I've attempted to use the both the Server Class and the Maven Embedded
Plugin, but  without any joy, and I've used the latest versions and
snapshots versions for both. In have no problems in deploying EJBs, EJBs in
Wars and so forth but cannot get a Webservices up and running.

Someone raised an issue #117 on this on the embedded Glassfish project, but
there is no update since May of this year. So I'm unsure if there is an
option to allow webservices to be deployed. I've read very brief
documentation that it's planned, but no idea for when?

If it can be done, would appreciate any help.

Regards

Amjad