1

I'm upgrading Web Services that used java EJB's and wer installed in WebLogic 8.1 to JAX-RPC Web Services in WebLogic 12c (WebLogic Server Version: 12.2.1.3.0)

They are several WS in the same project having same context root. So the adress for each is like:

[server]:[port]/services/ws1
[server]:[port]/services/ws2
[server]:[port]/services/ws3
...

In my development i can't set the same context root/path "services" for all Web Services.

Is it possible to have the same context root for all of them? (Like the example above?)

Detailed description: I got a "Weblogic Web Services Project" (Eclipse-> new project ->Oracle->WebLogic->Web Services-> Web Service Project) with multiple Web Services.

The Web Services were made from each WSDL with ANT wsdlc. So I got a "ws.jar" (compiled WSDL) and wsImpl.java (where I put my business code)

So final list of "source files" looks like:

ws1.jar
wsImpl1.java
ws2.jar
wsImpl2.java
ws3.jar
wsImpl3.java
...

Then I try to run ANT jwsc with multiple jws, one for each WS giving them all contextpath="services". When it gets to the second jws i get the error "Context path services for web application my/package/ws2.war is already in use by this application."

<target name="build-service">
    <jwsc srcdir="${src.dir}" destdir="${final.dir}/wars" verbose="true" keepGenerated="false" debug="on" includeantruntime="false">
    <classpath refid="project.class.path.build.services" />

    <jws file="my/package/ws1Impl.java" compiledWsdl="${output.dir}/compiledWsdl/ws1.jar">
        <WLHttpTransport contextpath="services" serviceuri="ws1" portname="ws1Port" />
    </jws>
    <jws file="my/package/ws2Impl.java" compiledWsdl="${output.dir}/compiledWsdl/ws2.jar">
        <WLHttpTransport contextpath="services" serviceuri="ws2" portname="ws2Port" />
    </jws>

        </jwsc>
</target>
Drew
  • 113
  • 1
  • 14
  • 1
    context root must be unique per host. You can merge all services in one war file or use an http server in front of your services to dispatch requests to the 3 web applications. – Emmanuel Collin Jan 18 '19 at 14:56
  • Thanks for the comment @EmmanuelCollin. I think that merging all services in one war file might be the solution I'm looking for but i can't figure how to do it as whe the ANT jws runs (as in my post) it generates one war file per WS. Is there a ANT command/tag to merge the jws in the same war file? – Drew Jan 18 '19 at 15:11

1 Answers1

1

Folowing @EmmanuelCollin comment I was able to do a better search and found a solution using

<module contextPath="services" name="myJar" >
   <jws .../>
   <jws .../>
</module>

as in: Oracle Help Center "Example 4 Packaging Multiple Web Services Into a Single WAR File"

Then I packed the generated aplication.xml and .war file to an .ear with ANT:

<ear destfile="${dist.dir}/${ant.project.name}.ear" appxml="${conf.dir}/application.xml">  
 <metainf dir="${build.dir}/META-INF"/> 
 <fileset dir="${dist.dir}" includes="*.jar,*.war"/>
</ear>

Finally, deployed the .ear into weblogic 12c server and successfully tested the Web Services response. All under the same contextPath.

Thank you!

Drew
  • 113
  • 1
  • 14