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 "Robert Simmons Jr." <ro...@jambit.com> on 2005/01/26 16:00:24 UTC

Ugly Copy/Paste code in WSDL. Where is the Re-use?

Greetings,

I have a WSDL document that describes the services of my client. I am no 
expert at web services so I have a question that might be seen as a 
little silly so please excuse me.

In the document I have SEVERAL places where I have the same string over 
and over again. A prime example is my namespace line which appears all 
over the place. In addition, in the bindings section of my service, I 
have 30 operations with the bindings that all look identical:

How can I possibly re-use code to prevent this issue? It would be a 
nightmare of maintenance and so on.

My bindings look like ...

        <wsdl:operation name="fetchNewIssues">
            <wsdlsoap:operation soapAction=""/>
            <wsdl:input name="fetchNewIssuesRequest">
                <wsdlsoap:body 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                   
 namespace="urn:com.bmw.candy.CandiedServices.SubscriptionAccess" 
use="encoded"/>
            </wsdl:input>
            <wsdl:output name="fetchNewIssuesResponse">
                <wsdlsoap:body 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                   
 namespace="urn:com.bmw.candy.CandiedServices.SubscriptionAccess" 
use="encoded"/>
            </wsdl:output>
            <wsdl:fault name="CandiedServicesException">
                <wsdlsoap:fault 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                    name="CandiedServicesException"
                   
 namespace="urn:com.bmw.candy.CandiedServices.SubscriptionAccess" 
use="encoded"/>
            </wsdl:fault>
        </wsdl:operation>
        <wsdl:operation name="fetchSubscriptionStatuses">
            <wsdlsoap:operation soapAction=""/>
            <wsdl:input name="fetchSubscriptionStatusesRequest">
                <wsdlsoap:body 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                   
 namespace="urn:com.bmw.candy.CandiedServices.SubscriptionAccess" 
use="encoded"/>
            </wsdl:input>
            <wsdl:output name="fetchSubscriptionStatusesResponse">
                <wsdlsoap:body 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                   
 namespace="urn:com.bmw.candy.CandiedServices.SubscriptionAccess" 
use="encoded"/>
            </wsdl:output>
            <wsdl:fault name="CandiedServicesException">
                <wsdlsoap:fault 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                    name="CandiedServicesException"
                   
 namespace="urn:com.bmw.candy.CandiedServices.SubscriptionAccess" 
use="encoded"/>
            </wsdl:fault>
        </wsdl:operation>

And so on ... you can see that each entry is practically identical 
except the name of the request and response.

Thanks in advance.

Re: Ugly Copy/Paste code in WSDL. Where is the Re-use?

Posted by Bill Keese <bi...@tech.beacon-it.co.jp>.
I also feel like the WSDL contains a lot of duplicated code, but I don't 
know how to avoid it.  The message definitions (in document/literal 
mode) are also pretty useless, since each message just points to a 
single element (with the same name).

I've thought about generating the WSDL from a simpler XML file, via XSLT.

Bill

Robert Simmons Jr. wrote:

> Greetings,
>
> I have a WSDL document that describes the services of my client. I am 
> no expert at web services so I have a question that might be seen as a 
> little silly so please excuse me.
>
> In the document I have SEVERAL places where I have the same string 
> over and over again. A prime example is my namespace line which 
> appears all over the place. In addition, in the bindings section of my 
> service, I have 30 operations with the bindings that all look identical:
>
> How can I possibly re-use code to prevent this issue? It would be a 
> nightmare of maintenance and so on.
>
> My bindings look like ...
>
>        <wsdl:operation name="fetchNewIssues">
>            <wsdlsoap:operation soapAction=""/>
>            <wsdl:input name="fetchNewIssuesRequest">
>                <wsdlsoap:body 
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>                   
> namespace="urn:com.bmw.candy.CandiedServices.SubscriptionAccess" 
> use="encoded"/>
>            </wsdl:input>
>            <wsdl:output name="fetchNewIssuesResponse">
>                <wsdlsoap:body 
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>                   
> namespace="urn:com.bmw.candy.CandiedServices.SubscriptionAccess" 
> use="encoded"/>
>            </wsdl:output>
>            <wsdl:fault name="CandiedServicesException">
>                <wsdlsoap:fault 
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>                    name="CandiedServicesException"
>                   
> namespace="urn:com.bmw.candy.CandiedServices.SubscriptionAccess" 
> use="encoded"/>
>            </wsdl:fault>
>        </wsdl:operation>
>        <wsdl:operation name="fetchSubscriptionStatuses">
>            <wsdlsoap:operation soapAction=""/>
>            <wsdl:input name="fetchSubscriptionStatusesRequest">
>                <wsdlsoap:body 
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>                   
> namespace="urn:com.bmw.candy.CandiedServices.SubscriptionAccess" 
> use="encoded"/>
>            </wsdl:input>
>            <wsdl:output name="fetchSubscriptionStatusesResponse">
>                <wsdlsoap:body 
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>                   
> namespace="urn:com.bmw.candy.CandiedServices.SubscriptionAccess" 
> use="encoded"/>
>            </wsdl:output>
>            <wsdl:fault name="CandiedServicesException">
>                <wsdlsoap:fault 
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>                    name="CandiedServicesException"
>                   
> namespace="urn:com.bmw.candy.CandiedServices.SubscriptionAccess" 
> use="encoded"/>
>            </wsdl:fault>
>        </wsdl:operation>
>
> And so on ... you can see that each entry is practically identical 
> except the name of the request and response.
>
> Thanks in advance.