sunlock
sunlock

Reputation: 322

Spring-ws: Multiple endpoints/wsdl/xsd/you-name-it

Info: I'm using Spring-ws 1.5.9 and Spring 2.5.6

I'm currently in the process of build a lot of web services and have a few questions as to how the architecture should be.

Right now I have a single web service. It (of course) contains a single wsdl and a single endpoints and so forth.

I'm currently extending the web service, and there I have created another xsd, auto-gen code using JAXB2 (xjc) and so forth.

Now, how should I handle these xsds, wsdl(s), code and so forth? I cannot see what Spring-ws recommends...

My architect would like to have a single wsdl, which can be achieved using the following:

<bean id="schemaCollection" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
<property name="xsds">
    <list>
        <value>one.xsd</value>
        <value>two.xsd</value>
    </list>
</property>
<property name="inline" value="true"/>

Is this a good way to do this? I'm gonna end up with like 10-15 web services thus a large wsdl.

How about endpoints? Should I create a single endpoint and test for the type of request (e.g. using instanceof)? I myself think that having one endpoint mapping to one request is more elegant/clean.

Finally, what about marshalling? I have this (with one ws/schema):

    <oxm:jaxb2-marshaller id="marshaller" contextPath="mydomain.signals.one.v1_0.schemas"/>
<oxm:jaxb2-marshaller id="unmarshaller" contextPath="mydomain.signals.v1_0.schemas"/>

But, how should I add another schema to this?? I'm trying something like the following, which doesn't seem to be working for me right now:

    <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
    <property name="contextPaths">
        <list>
            <value>mydomain.signals.one.v1_0.schemas</value>
            <value>mydomain.signals.two.v1_0.schemas</value>
        </list>
    </property>
</bean>

I hope this makes sense. What I'm aiming for is pointers and hints as to what I should do.

Upvotes: 3

Views: 6050

Answers (1)

AHungerArtist
AHungerArtist

Reputation: 9579

If you have 10-15 web services there's no way around not having a huge wsdl. If the goal is a single wsdl, what you are doing seems acceptable.

I would prefer endpoints for each request.

Also, have you tried using a colon separated list of values for your context path? So, don't use the list, just have one long string with each context path separated by colons.

From the Spring-WS documentation:

The context path is a list of colon (:) separated Java package names that contain schema derived classes.

I know that passage is for Jaxb1 but I'm pretty sure it still applies to the Jaxb2Marshaller. I think you'd only use the list variant if you were specifying classes.

http://static.springsource.org/spring-ws/site/reference/html/oxm.html

Upvotes: 1

Related Questions