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 Marcin Okraszewski <ok...@o2.pl> on 2003/09/20 21:16:31 UTC

One service with operations in different namespaces

Hi.
I would like to make a message service that has two operations in 
different namespaces. So one would be invoked by messages <ns1:op1/> and 
<ns2:op2/>.

Unfortunately if I try to do it, I get an error, that Axis can't match 
an operation. When I set a namespace attribute in deploying I can run 
only one of those messages.

Is it possible to do it? Maybe it even isn't possible to describe in WSDL?

Thank you in advance.
Marcin Okraszewski

-- 
-------------------------------------------------------------
                       Marcin Okraszewski
okrasz@o2.pl                                       GG: 341942
okrasz@vlo.ids.gda.pl          PGP: www.okrasz.prv.pl/pgp.asc
-------------------------------------------------------------




Re: One service with operations in different namespaces

Posted by Anne Thomas Manes <an...@manes.net>.
You must use WSDL2Java to generate your server skeleton.

At 10:12 PM 9/25/2003 +0200, you wrote:
>At the beggining I'd like to thank you for help!
>
>OK, this is WSDL document. Far I understand documentation,  the wsdlFile 
>atribute in deployment is just for returning WSDL, not for Axis service 
>configuration, isn't it? I'm afraid I will still get errors. Am I wrong?
>
>One more time thanks for help!
>Marcin
>
>>You define the schemas in the <types> section of the WSDL document. For 
>>example:
>><wsdl:definitions name='twoNamepsaces'
>>     targetNamespace='urn:twonamespaces/wsdl'
>>     xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
>>     xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
>>     xmlns:ns1='urn:twoNamespaces/ns1'
>>     xmlns:ns2='urn:twoNamespaces/ns2'
>>     xmlns:tns='urn:twoNamespaces/wsdl'>
>>     <wsdl:types>
>>         <xsd:schema targetNamespace='urn:twoNamespaces/ns1'
>>             xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
>>             <xsd:element name='op1' type='string'/>
>>         </xsd:schema>
>>         <xsd:schema targetNamespace='urn:twoNamespaces/ns2'
>>             xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
>>             <xsd:element name='op2' type='string'/>
>>         </xsd:schema>
>>     </wsdl:types>
>>     <wsdl:message name='op1'>
>>         <wsdl:part name='body' element='ns1:op1'/>
>>     </wsdl:message>
>>     <wsdl:message name='op2'>
>>         <wsdl:part name='body' element='ns2:op2'/>
>>     </wsdl:message>
>>     <wsdl:portType name='interface'>
>>         <wsdl:operation name='op1'>
>>             <wsdl:input message='tns:op1'/>
>>         </wsdl:operation>
>>         <wsdl:operation name='op2'>
>>             <wsdl:input message='tns:op2'/>
>>         </wsdl:operation>
>>     </wsdl:portType>
>>     <wsdl:binding name='interfaceSOAP' type='tns:interface'>
>>         <soap:binding
>>             transport='http://schemas.xmlsoap.org/soap/http'
>>             style='document'/>
>>         <wsdl:operation name='op1'>
>>             <soap:operation
>>               soapAction='op1'
>>               style='document'/>
>>             <wsdl:input>
>>                 <soap:body use='literal'/>
>>             </wsdl:input>
>>         </wsdl:operation>
>>         <wsdl:operation name='op2'>
>>             <soap:operation
>>               soapAction='op2'
>>               style='document'/>
>>             <wsdl:input>
>>                 <soap:body use='literal'/>
>>             </wsdl:input>
>>         </wsdl:operation>
>>     </wsdl:binding>
>
>--
>-------------------------------------------------------------
>                       Marcin Okraszewski
>okrasz@o2.pl                                       GG: 341942
>okrasz@vlo.ids.gda.pl          PGP: www.okrasz.prv.pl/pgp.asc
>-------------------------------------------------------------
>



Re: One service with operations in different namespaces

Posted by Marcin Okraszewski <ok...@o2.pl>.
At the beggining I'd like to thank you for help!

OK, this is WSDL document. Far I understand documentation,  the wsdlFile 
atribute in deployment is just for returning WSDL, not for Axis service 
configuration, isn't it? I'm afraid I will still get errors. Am I wrong?

One more time thanks for help!
Marcin

> You define the schemas in the <types> section of the WSDL document. For 
> example:
> 
> <wsdl:definitions name='twoNamepsaces'
>     targetNamespace='urn:twonamespaces/wsdl'
>     xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
>     xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
>     xmlns:ns1='urn:twoNamespaces/ns1'
>     xmlns:ns2='urn:twoNamespaces/ns2'
>     xmlns:tns='urn:twoNamespaces/wsdl'>
> 
>     <wsdl:types>
>         <xsd:schema targetNamespace='urn:twoNamespaces/ns1'
>             xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
>             <xsd:element name='op1' type='string'/>
>         </xsd:schema>
>         <xsd:schema targetNamespace='urn:twoNamespaces/ns2'
>             xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
>             <xsd:element name='op2' type='string'/>
>         </xsd:schema>
>     </wsdl:types>
> 
>     <wsdl:message name='op1'>
>         <wsdl:part name='body' element='ns1:op1'/>
>     </wsdl:message>
>     <wsdl:message name='op2'>
>         <wsdl:part name='body' element='ns2:op2'/>
>     </wsdl:message>
> 
>     <wsdl:portType name='interface'>
>         <wsdl:operation name='op1'>
>             <wsdl:input message='tns:op1'/>
>         </wsdl:operation>
>         <wsdl:operation name='op2'>
>             <wsdl:input message='tns:op2'/>
>         </wsdl:operation>
>     </wsdl:portType>
> 
>     <wsdl:binding name='interfaceSOAP' type='tns:interface'>
>         <soap:binding
>             transport='http://schemas.xmlsoap.org/soap/http'
>             style='document'/>
>         <wsdl:operation name='op1'>
>             <soap:operation
>               soapAction='op1'
>               style='document'/>
>             <wsdl:input>
>                 <soap:body use='literal'/>
>             </wsdl:input>
>         </wsdl:operation>
>         <wsdl:operation name='op2'>
>             <soap:operation
>               soapAction='op2'
>               style='document'/>
>             <wsdl:input>
>                 <soap:body use='literal'/>
>             </wsdl:input>
>         </wsdl:operation>
>     </wsdl:binding>

-- 
-------------------------------------------------------------
                       Marcin Okraszewski
okrasz@o2.pl                                       GG: 341942
okrasz@vlo.ids.gda.pl          PGP: www.okrasz.prv.pl/pgp.asc
-------------------------------------------------------------



Re: One service with operations in different namespaces

Posted by Anne Thomas Manes <an...@manes.net>.
Marcin,

You define the schemas in the <types> section of the WSDL document. For 
example:

<wsdl:definitions name='twoNamepsaces'
     targetNamespace='urn:twonamespaces/wsdl'
     xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
     xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
     xmlns:ns1='urn:twoNamespaces/ns1'
     xmlns:ns2='urn:twoNamespaces/ns2'
     xmlns:tns='urn:twoNamespaces/wsdl'>

     <wsdl:types>
         <xsd:schema targetNamespace='urn:twoNamespaces/ns1'
             xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
             <xsd:element name='op1' type='string'/>
         </xsd:schema>
         <xsd:schema targetNamespace='urn:twoNamespaces/ns2'
             xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
             <xsd:element name='op2' type='string'/>
         </xsd:schema>
     </wsdl:types>

     <wsdl:message name='op1'>
         <wsdl:part name='body' element='ns1:op1'/>
     </wsdl:message>
     <wsdl:message name='op2'>
         <wsdl:part name='body' element='ns2:op2'/>
     </wsdl:message>

     <wsdl:portType name='interface'>
         <wsdl:operation name='op1'>
             <wsdl:input message='tns:op1'/>
         </wsdl:operation>
         <wsdl:operation name='op2'>
             <wsdl:input message='tns:op2'/>
         </wsdl:operation>
     </wsdl:portType>

     <wsdl:binding name='interfaceSOAP' type='tns:interface'>
         <soap:binding
             transport='http://schemas.xmlsoap.org/soap/http'
             style='document'/>
         <wsdl:operation name='op1'>
             <soap:operation
               soapAction='op1'
               style='document'/>
             <wsdl:input>
                 <soap:body use='literal'/>
             </wsdl:input>
         </wsdl:operation>
         <wsdl:operation name='op2'>
             <soap:operation
               soapAction='op2'
               style='document'/>
             <wsdl:input>
                 <soap:body use='literal'/>
             </wsdl:input>
         </wsdl:operation>
     </wsdl:binding>


At 08:58 AM 9/25/2003 +0200, you wrote:
>>Are you using rpc/encoded or doc/literal?
>
>I am using message service.
>
>>If you are using doc/literal, then the namespace of the top-level element 
>>in your SOAP body is determined by the targetNamespace attribute of the 
>><schema> that defines the input element. If you want to use different 
>>namespaces, you need to define each message structure in a different schema.
>
>How can I tell Axis in deployment, where the XML Schema is? Could you 
>meybe give simple example?
>
>Regards,
>Marcin
>
>>Regards,
>>Anne
>>At 09:16 PM 9/20/2003 +0200, you wrote:
>>
>>>Hi.
>>>I would like to make a message service that has two operations in 
>>>different namespaces. So one would be invoked by messages <ns1:op1/> and 
>>><ns2:op2/>.
>>>
>>>Unfortunately if I try to do it, I get an error, that Axis can't match 
>>>an operation. When I set a namespace attribute in deploying I can run 
>>>only one of those messages.
>>>
>>>Is it possible to do it? Maybe it even isn't possible to describe in WSDL?
>
>--
>-------------------------------------------------------------
>                       Marcin Okraszewski
>okrasz@o2.pl                                       GG: 341942
>okrasz@vlo.ids.gda.pl          PGP: www.okrasz.prv.pl/pgp.asc
>-------------------------------------------------------------
>



Re: One service with operations in different namespaces

Posted by Marcin Okraszewski <ok...@o2.pl>.
> Are you using rpc/encoded or doc/literal?

I am using message service.

> If you are using doc/literal, then the namespace of the top-level 
> element in your SOAP body is determined by the targetNamespace attribute 
> of the <schema> that defines the input element. If you want to use 
> different namespaces, you need to define each message structure in a 
> different schema.

How can I tell Axis in deployment, where the XML Schema is? Could you 
meybe give simple example?

Regards,
Marcin

> Regards,
> Anne
> 
> At 09:16 PM 9/20/2003 +0200, you wrote:
> 
>> Hi.
>> I would like to make a message service that has two operations in 
>> different namespaces. So one would be invoked by messages <ns1:op1/> 
>> and <ns2:op2/>.
>>
>> Unfortunately if I try to do it, I get an error, that Axis can't match 
>> an operation. When I set a namespace attribute in deploying I can run 
>> only one of those messages.
>>
>> Is it possible to do it? Maybe it even isn't possible to describe in 
>> WSDL?

-- 
-------------------------------------------------------------
                       Marcin Okraszewski
okrasz@o2.pl                                       GG: 341942
okrasz@vlo.ids.gda.pl          PGP: www.okrasz.prv.pl/pgp.asc
-------------------------------------------------------------



Re: One service with operations in different namespaces

Posted by Anne Thomas Manes <an...@manes.net>.
Marcin,

Are you using rpc/encoded or doc/literal?

If you are using rpc/encoded, then the operation namespace is determined by 
the namespace attribute in the <input> definition in the <binding>. You can 
specify a different namespace for each operation. If you generate your 
server code from the WSDL file, Axis should be able to handle it. If not, 
then you should log it as a bug.

If you are using doc/literal, then the namespace of the top-level element 
in your SOAP body is determined by the targetNamespace attribute of the 
<schema> that defines the input element. If you want to use different 
namespaces, you need to define each message structure in a different schema.

Regards,
Anne

At 09:16 PM 9/20/2003 +0200, you wrote:
>Hi.
>I would like to make a message service that has two operations in 
>different namespaces. So one would be invoked by messages <ns1:op1/> and 
><ns2:op2/>.
>
>Unfortunately if I try to do it, I get an error, that Axis can't match an 
>operation. When I set a namespace attribute in deploying I can run only 
>one of those messages.
>
>Is it possible to do it? Maybe it even isn't possible to describe in WSDL?
>
>Thank you in advance.
>Marcin Okraszewski
>
>--
>-------------------------------------------------------------
>                       Marcin Okraszewski
>okrasz@o2.pl                                       GG: 341942
>okrasz@vlo.ids.gda.pl          PGP: www.okrasz.prv.pl/pgp.asc
>-------------------------------------------------------------
>
>