You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Deepak S Patwardhan <cs...@cse.iitd.ac.in> on 2005/08/29 09:53:50 UTC

service url

HI all,

My question is about the way axis makes a service URL. Normally, you see a 
URL like the following :

http://host:unix-port/axis/services/PORT-NAME

where, PORT-NAME is a port defined in the service element.

Is it possible that the service URL be like this :

http://host:unix-port/axis/services/SERVICE-NAME/PORT-NAME

where SERVICE-NAME is the name of the service ? (attribute name of service 
element)

This would look more logical, especially when a service contains multiple 
ports. I tried specifying such URLs in the WSDL but axis overrides it. 
(please see the attached WSDL.)

WHen I deploy my service (service Primality, two ports, a) Prime - to 
check whether a number is prime, b) CoPrime - to check whether two numbers 
are coprime), and when I see the list of deployed services, I expected a 
listing like this

* Primality
   -	Prime
	    -	isPrime
   -	CoPrime
	    - 	areCoPrime

But, what is displayed is as if there are two services, Prime and CoPrime.

* Prime
   - isPrime
* CoPrimes
   - areCoPrime

It seems as if axis elevates a PORT to a service. What's the 
design decision behind this ? (And if you tell me that AXIS expects 
developers to define one port per service, I would be pretty p***ed off)

thanks,
Deepak S Patwardhan.

--------------------------- WSDL -----------------------------
<definitions name="PrimeDef"
        targetNamespace="http://gridsolv.com/deepak/ws1/"
        xmlns:tns="http://gridsolv.com/deepak/ws1/"
        xmlns:xsd="http://www.w3.org/1999/XMLSchema"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns="http://schemas.xmlsoap.org/wsdl/">

    <!--================================================-->
    <message name="aNumber">
        <part name="num" type="xsd:int"/>
    </message>

    <message name="twoNumbers">
        <part name="num1" type="xsd:int"/>
        <part name="num2" type="xsd:int"/>
    </message>

    <message name="aBool">
        <part name="boo" type="xsd:boolean"/>
    </message>

    <!--================================================-->
    <portType name="Prime">
        <!-- Tell if a given number is prime -->
        <operation name="isPrime">
            <input message="tns:aNumber"/>
            <output message="tns:aBool"/>
        </operation>
    </portType>

    <portType name="CoPrime">
        <!-- Tell if given numbers are co-prime -->
        <operation name="areCoprime">
            <input message="tns:twoNumbers"/>
            <output message="tns:aBool"/>
        </operation>
    </portType>

    <!--================================================-->
    <binding name="PrimeSOAPBinding" type="tns:Prime">
        <soap:binding style="rpc"
                transport="http://schemas.xmlsoap.org/soap/http"/>

        <operation name="isPrime">
            <soap:operation soapAction=""/>
            <input>
                <soap:body use="encoded" encodingStyle="soap-enc"/>
            </input>
            <output>
                <soap:body use="encoded" encodingStyle="soap-enc"/>
            </output>
        </operation>
    </binding>

    <binding name="CoPrimeSOAPBinding" type="tns:CoPrime">
        <soap:binding style="rpc"
                transport="http://schemas.xmlsoap.org/soap/http"/>

        <operation name="areCoprime">
            <soap:operation soapAction=""/>
            <input>
                <soap:body use="encoded" encodingStyle="soap-enc"/>
            </input>
            <output>
                <soap:body use="encoded" encodingStyle="soap-enc"/>
            </output>
        </operation>
    </binding>

    <!--================================================-->
    <service name="Primality">
        <port name="Prime" binding="tns:PrimeSOAPBinding">
            <soap:address 
location="http://localhost:8080/axis/services/Primality/Prime"/>
        </port>
        <port name="CoPrime" binding="tns:CoPrimeSOAPBinding">
            <soap:address 
location="http://localhost:8080/axis/services/Primality/CoPrime"/>
        </port>
    </service>

</definitions>


Re: service url

Posted by Deepak S Patwardhan <cs...@cse.iitd.ac.in>.
On Mon, 29 Aug 2005, Javier Gonzalez wrote:

> Deploy them using server-config.wsdd, and use your naming hierachy.
> 
> <service name="foo/bar/myFooBarService" provider="java:MSG"
> style="message" use="literal">
> ...
> </service>
> 
> and you will then have the url
> "http://<HOST>/<CONTEXT>/services/foo/bar/myFooBarService" for
> accesing your web service.
> 
> Hope that helps,
> 
> Javier.
> 

HI all, 
Thanks a lot, Javier. I changed the attribute name of element
service in deploy.wsdd and undeploy.wsdd and it worked.  

I also found out that if you define your port itself of the form "xyz/abc"
in the service definition, AXIS has no problems. (if you can change the 
WSDL)

Still, I feel that AXIS should accept any URL that WSDL developer defines
as the SOAP address, provided it looks like

http://host:unix-port/axis/services/<CUSTOM>/PORT-NAME

Perhaps, this could be a feature request! :-)

thanks,
Deepak S Patwardhan.

> 
> > 
> > ----------------------
> > On Mon, 29 Aug 2005, Guy Rixon wrote:
> > 
> > > WS-I basic profile expects developers to define one port per service. I think
> > > the underlying philosphy is that each SOAP endpoint has one remote object and
> > > all the operations on that endpoint work as methods on that one object.
> > >
> > > I agree that this is limiting. It's often nice to aggregate ports.
> > >
> > > On Mon, 29 Aug 2005, Deepak S Patwardhan wrote:
> > >
> > > > HI all,
> > > >
> > > > My question is about the way axis makes a service URL. Normally, you see a
> > > > URL like the following :
> > > >
> > > > http://host:unix-port/axis/services/PORT-NAME
> > > >
> > > > where, PORT-NAME is a port defined in the service element.
> > > >
> > > > Is it possible that the service URL be like this :
> > > >
> > > > http://host:unix-port/axis/services/SERVICE-NAME/PORT-NAME
> > > >
> > > > where SERVICE-NAME is the name of the service ? (attribute name of service
> > > > element)
> > > >
> > > > This would look more logical, especially when a service contains multiple
> > > > ports. I tried specifying such URLs in the WSDL but axis overrides it.
> > > > (please see the attached WSDL.)
> > > >
> > > > WHen I deploy my service (service Primality, two ports, a) Prime - to
> > > > check whether a number is prime, b) CoPrime - to check whether two numbers
> > > > are coprime), and when I see the list of deployed services, I expected a
> > > > listing like this
> > > >
> > > > * Primality
> > > >    -        Prime
> > > >         -   isPrime
> > > >    -        CoPrime
> > > >         -   areCoPrime
> > > >
> > > > But, what is displayed is as if there are two services, Prime and CoPrime.
> > > >
> > > > * Prime
> > > >    - isPrime
> > > > * CoPrimes
> > > >    - areCoPrime
> > > >
> > > > It seems as if axis elevates a PORT to a service. What's the
> > > > design decision behind this ? (And if you tell me that AXIS expects
> > > > developers to define one port per service, I would be pretty p***ed off)
> > > >
> > > > thanks,
> > > > Deepak S Patwardhan.
> > > >
> > 
> 
> 
> 

Re: service url

Posted by Javier Gonzalez <ja...@gmail.com>.
> Anyway, so now, my question is how to host two services, which are defined
> in two separate WSDL files, which can't be edited (obviously), and happen
> to literally share a port name.

Deploy them using server-config.wsdd, and use your naming hierachy.

<service name="foo/bar/myFooBarService" provider="java:MSG"
style="message" use="literal">
...
</service>

and you will then have the url
"http://<HOST>/<CONTEXT>/services/foo/bar/myFooBarService" for
accesing your web service.

Hope that helps,

Javier.


> 
> thanks,
> Deepak S Patwardhan.
> ----------------------
> On Mon, 29 Aug 2005, Guy Rixon wrote:
> 
> > WS-I basic profile expects developers to define one port per service. I think
> > the underlying philosphy is that each SOAP endpoint has one remote object and
> > all the operations on that endpoint work as methods on that one object.
> >
> > I agree that this is limiting. It's often nice to aggregate ports.
> >
> > On Mon, 29 Aug 2005, Deepak S Patwardhan wrote:
> >
> > > HI all,
> > >
> > > My question is about the way axis makes a service URL. Normally, you see a
> > > URL like the following :
> > >
> > > http://host:unix-port/axis/services/PORT-NAME
> > >
> > > where, PORT-NAME is a port defined in the service element.
> > >
> > > Is it possible that the service URL be like this :
> > >
> > > http://host:unix-port/axis/services/SERVICE-NAME/PORT-NAME
> > >
> > > where SERVICE-NAME is the name of the service ? (attribute name of service
> > > element)
> > >
> > > This would look more logical, especially when a service contains multiple
> > > ports. I tried specifying such URLs in the WSDL but axis overrides it.
> > > (please see the attached WSDL.)
> > >
> > > WHen I deploy my service (service Primality, two ports, a) Prime - to
> > > check whether a number is prime, b) CoPrime - to check whether two numbers
> > > are coprime), and when I see the list of deployed services, I expected a
> > > listing like this
> > >
> > > * Primality
> > >    -        Prime
> > >         -   isPrime
> > >    -        CoPrime
> > >         -   areCoPrime
> > >
> > > But, what is displayed is as if there are two services, Prime and CoPrime.
> > >
> > > * Prime
> > >    - isPrime
> > > * CoPrimes
> > >    - areCoPrime
> > >
> > > It seems as if axis elevates a PORT to a service. What's the
> > > design decision behind this ? (And if you tell me that AXIS expects
> > > developers to define one port per service, I would be pretty p***ed off)
> > >
> > > thanks,
> > > Deepak S Patwardhan.
> > >
> 


-- 
Javier Gonzalez Nicolini

Re: service url

Posted by Deepak S Patwardhan <cs...@cse.iitd.ac.in>.
Hi,

I can accept, as a convention, to define one port per service. However, my 
question was about customizing the service url, to reflect a sort of 
hierarchy. If you say that I'll always get the endpoint url as :

http://host:unix-port/axis/services/PORT-NAME

then this is a recipe for name collision. Two services, written by two
different people, in two different WSDL files, who happen to use the same
port name won't run in the same Tomcat+AXIS container. The last service to 
get deployed grabs that endpoint url (I tested it).

Anyway, so now, my question is how to host two services, which are defined 
in two separate WSDL files, which can't be edited (obviously), and happen 
to literally share a port name.

thanks,
Deepak S Patwardhan.
----------------------
On Mon, 29 Aug 2005, Guy Rixon wrote:

> WS-I basic profile expects developers to define one port per service. I think
> the underlying philosphy is that each SOAP endpoint has one remote object and
> all the operations on that endpoint work as methods on that one object.
> 
> I agree that this is limiting. It's often nice to aggregate ports.
> 
> On Mon, 29 Aug 2005, Deepak S Patwardhan wrote:
> 
> > HI all,
> >
> > My question is about the way axis makes a service URL. Normally, you see a
> > URL like the following :
> >
> > http://host:unix-port/axis/services/PORT-NAME
> >
> > where, PORT-NAME is a port defined in the service element.
> >
> > Is it possible that the service URL be like this :
> >
> > http://host:unix-port/axis/services/SERVICE-NAME/PORT-NAME
> >
> > where SERVICE-NAME is the name of the service ? (attribute name of service
> > element)
> >
> > This would look more logical, especially when a service contains multiple
> > ports. I tried specifying such URLs in the WSDL but axis overrides it.
> > (please see the attached WSDL.)
> >
> > WHen I deploy my service (service Primality, two ports, a) Prime - to
> > check whether a number is prime, b) CoPrime - to check whether two numbers
> > are coprime), and when I see the list of deployed services, I expected a
> > listing like this
> >
> > * Primality
> >    -	Prime
> > 	    -	isPrime
> >    -	CoPrime
> > 	    - 	areCoPrime
> >
> > But, what is displayed is as if there are two services, Prime and CoPrime.
> >
> > * Prime
> >    - isPrime
> > * CoPrimes
> >    - areCoPrime
> >
> > It seems as if axis elevates a PORT to a service. What's the
> > design decision behind this ? (And if you tell me that AXIS expects
> > developers to define one port per service, I would be pretty p***ed off)
> >
> > thanks,
> > Deepak S Patwardhan.
> >

Re: service url

Posted by Guy Rixon <gt...@ast.cam.ac.uk>.
WS-I basic profile expects developers to define one port per service. I think
the underlying philosphy is that each SOAP endpoint has one remote object and
all the operations on that endpoint work as methods on that one object.

I agree that this is limiting. It's often nice to aggregate ports.

On Mon, 29 Aug 2005, Deepak S Patwardhan wrote:

> HI all,
>
> My question is about the way axis makes a service URL. Normally, you see a
> URL like the following :
>
> http://host:unix-port/axis/services/PORT-NAME
>
> where, PORT-NAME is a port defined in the service element.
>
> Is it possible that the service URL be like this :
>
> http://host:unix-port/axis/services/SERVICE-NAME/PORT-NAME
>
> where SERVICE-NAME is the name of the service ? (attribute name of service
> element)
>
> This would look more logical, especially when a service contains multiple
> ports. I tried specifying such URLs in the WSDL but axis overrides it.
> (please see the attached WSDL.)
>
> WHen I deploy my service (service Primality, two ports, a) Prime - to
> check whether a number is prime, b) CoPrime - to check whether two numbers
> are coprime), and when I see the list of deployed services, I expected a
> listing like this
>
> * Primality
>    -	Prime
> 	    -	isPrime
>    -	CoPrime
> 	    - 	areCoPrime
>
> But, what is displayed is as if there are two services, Prime and CoPrime.
>
> * Prime
>    - isPrime
> * CoPrimes
>    - areCoPrime
>
> It seems as if axis elevates a PORT to a service. What's the
> design decision behind this ? (And if you tell me that AXIS expects
> developers to define one port per service, I would be pretty p***ed off)
>
> thanks,
> Deepak S Patwardhan.
>
> --------------------------- WSDL -----------------------------
> <definitions name="PrimeDef"
>         targetNamespace="http://gridsolv.com/deepak/ws1/"
>         xmlns:tns="http://gridsolv.com/deepak/ws1/"
>         xmlns:xsd="http://www.w3.org/1999/XMLSchema"
>         xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>         xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
>         xmlns="http://schemas.xmlsoap.org/wsdl/">
>
>     <!--================================================-->
>     <message name="aNumber">
>         <part name="num" type="xsd:int"/>
>     </message>
>
>     <message name="twoNumbers">
>         <part name="num1" type="xsd:int"/>
>         <part name="num2" type="xsd:int"/>
>     </message>
>
>     <message name="aBool">
>         <part name="boo" type="xsd:boolean"/>
>     </message>
>
>     <!--================================================-->
>     <portType name="Prime">
>         <!-- Tell if a given number is prime -->
>         <operation name="isPrime">
>             <input message="tns:aNumber"/>
>             <output message="tns:aBool"/>
>         </operation>
>     </portType>
>
>     <portType name="CoPrime">
>         <!-- Tell if given numbers are co-prime -->
>         <operation name="areCoprime">
>             <input message="tns:twoNumbers"/>
>             <output message="tns:aBool"/>
>         </operation>
>     </portType>
>
>     <!--================================================-->
>     <binding name="PrimeSOAPBinding" type="tns:Prime">
>         <soap:binding style="rpc"
>                 transport="http://schemas.xmlsoap.org/soap/http"/>
>
>         <operation name="isPrime">
>             <soap:operation soapAction=""/>
>             <input>
>                 <soap:body use="encoded" encodingStyle="soap-enc"/>
>             </input>
>             <output>
>                 <soap:body use="encoded" encodingStyle="soap-enc"/>
>             </output>
>         </operation>
>     </binding>
>
>     <binding name="CoPrimeSOAPBinding" type="tns:CoPrime">
>         <soap:binding style="rpc"
>                 transport="http://schemas.xmlsoap.org/soap/http"/>
>
>         <operation name="areCoprime">
>             <soap:operation soapAction=""/>
>             <input>
>                 <soap:body use="encoded" encodingStyle="soap-enc"/>
>             </input>
>             <output>
>                 <soap:body use="encoded" encodingStyle="soap-enc"/>
>             </output>
>         </operation>
>     </binding>
>
>     <!--================================================-->
>     <service name="Primality">
>         <port name="Prime" binding="tns:PrimeSOAPBinding">
>             <soap:address
> location="http://localhost:8080/axis/services/Primality/Prime"/>
>         </port>
>         <port name="CoPrime" binding="tns:CoPrimeSOAPBinding">
>             <soap:address
> location="http://localhost:8080/axis/services/Primality/CoPrime"/>
>         </port>
>     </service>
>
> </definitions>
>

Guy Rixon 				        gtr@ast.cam.ac.uk
Institute of Astronomy   	                Tel: +44-1223-337542
Madingley Road, Cambridge, UK, CB3 0HA		Fax: +44-1223-337523