Defining a provider Web Service Descriptor with minOccurs and maxOccurs constraints on elements

I am sorry if this is a question that has peoples eyes rolling.

The scenario I have is our team are wrapping a service provided by one of the areas in our organisation. This service has restrictions on input in terms of minimum and maximum entries for certain list values, in that they define in the wsdl minOccurs and maxOccurs entries.

We have no issue consuming this wsdl and providing a flow service that will take the input process it and call the service being consumed. This is going very well.

The issue we have is when using our flow service as the basis for the the creation of our provider wsd that we can only define minOccurs = 0 or 1 and maxOccurs= unlimited. How can we have it automatically define entries in the defined wsdl created in the wsd with say a minOccurs=10 maxOccurs=20 for instance?

By all means if this is easy please point me where to look at.

β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
What we are striving to achieve achieve:
…

  <wsdl:types>
    <xsd:schema targetNamespace="http://Localhost/testschema:new_wsd" xmlns:tns="http://Localhost/testschema:new_wsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          <xsd:element name="in" type="tns:in"/>
          <xsd:element name="out" type="tns:out"/>
          <xsd:complexType name="in">
            <xsd:sequence>
              <xsd:element name="docType_new_flowservice" nillable="true" type="tns:docType_new_flowservice"/>
            </xsd:sequence>
          </xsd:complexType>
          <xsd:complexType name="docType_new_flowservice">
            <xsd:sequence>
              <xsd:element name="filterRequest" type="tns:filterRequest"/>
            </xsd:sequence>
          </xsd:complexType>
          <xsd:complexType name="filterRequest">
            <xsd:sequence>
              <xsd:element name="correlationId" type="xsd:string"/>
              <xsd:element name="entries" type="tns:entries"/>
            </xsd:sequence>
          </xsd:complexType>
          <xsd:complexType name="entries">
            <xsd:sequence>
              <xsd:element maxOccurs=β€œ20” minOccurs=β€œ10” name="entry" type="tns:entry"/>
            </xsd:sequence>
          </xsd:complexType>
          <xsd:complexType name="entry">
            <xsd:sequence>
              <xsd:element name="name" type="xsd:string"/>
              <xsd:element name="value" type="xsd:string"/>
            </xsd:sequence>
          </xsd:complexType>
          <xsd:complexType name="out">
            <xsd:sequence>
              <xsd:element name="docType_new_flowservice" nillable="true" type="tns:docType_new_flowservice"/>
            </xsd:sequence>
          </xsd:complexType>
        	</xsd:schema>
  </wsdl:types>

…
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
What we are presently getting:
…

<wsdl:types>
    <xsd:schema targetNamespace="http://Localhost/testschema:new_wsd" xmlns:tns="http://Localhost/testschema:new_wsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          <xsd:element name="in" type="tns:in"/>
          <xsd:element name="out" type="tns:out"/>
          <xsd:complexType name="in">
            <xsd:sequence>
              <xsd:element name="docType_new_flowservice" nillable="true" type="tns:docType_new_flowservice"/>
            </xsd:sequence>
          </xsd:complexType>
          <xsd:complexType name="docType_new_flowservice">
            <xsd:sequence>
              <xsd:element name="filterRequest" type="tns:filterRequest"/>
            </xsd:sequence>
          </xsd:complexType>
          <xsd:complexType name="filterRequest">
            <xsd:sequence>
              <xsd:element name="correlationId" type="xsd:string"/>
              <xsd:element name="entries" type="tns:entries"/>
            </xsd:sequence>
          </xsd:complexType>
          <xsd:complexType name="entries">
            <xsd:sequence>
              <xsd:element maxOccurs="unbounded" minOccurs=β€œ1” name="entry" type="tns:entry"/>
            </xsd:sequence>
          </xsd:complexType>
          <xsd:complexType name="entry">
            <xsd:sequence>
              <xsd:element name="name" type="xsd:string"/>
              <xsd:element name="value" type="xsd:string"/>
            </xsd:sequence>
          </xsd:complexType>
          <xsd:complexType name="out">
            <xsd:sequence>
              <xsd:element name="docType_new_flowservice" nillable="true" type="tns:docType_new_flowservice"/>
            </xsd:sequence>
          </xsd:complexType>
        	</xsd:schema>
  </wsdl:types>

…

Hi Ian,

when using WSDL to create consumer and provider nodes this is referring to β€œDesign by Contract”, meaning that the constraints cannot be modified afterwards.

Additionally, minOccurs and maxOccurs constraints are defaulting to 1 when missing in the WSDL.

From what I understand from your post:
When you are the provider, you want minOccurs=10 and maxOccurs=20, but when you act as the consumer you have minOccurs=1 and maxOccurs=unbounded. You will require two different WSDL then, one for the provider and one for the consumer.
The direction described in the previous sentence, this should work. The other way round this might leading to difficulties (if not handled correctly by the code), when you are receiving less than 10 elements or more than 20 elements.

Regards,
Holger

Hi Holgger

Thank you for taking time to reply.

You are close but not quite what I am asking.

The service we are consuming has these constraints, in this example minimum occurrence of 10 and a maximum occurrence of 20 of this complex element.

We are able to work with that in our flow services as part of a more complex integration of a number of services that are consumed, no issue there.

With the provider service we produce we need to honour and want to portray in the wsdl created from it that there ore these constraints. In other words when they consume our wsdl they see that they are required to provide between 10 and 20 elements.

So the schema for the provider wsdl we create from our flow service should automatically demonstrate this constraint. This is a basic capability that should be available in creating service wsdl’s. Yet every time we create a wsdl from the flow service we have not found a way to set these limitations, instead on get the minOccurs=0 maxOccurs=unbounded.

It would be awfully disappointing if a product with the capacity of webMethods can not automate this basic requirement

Regards

Ian

Hi,

What you want is reasonable but the IS has some limitations on the contract created from a service.

You could address this issue on a feature request.

Your best solution is to create a WSDL with your specifications and generate a provider WSD which, in turn, calls you service.

Best regards,

1 Like