Child pages
  • Generic Web Services Guidelines
Skip to end of metadata
Go to start of metadata

Modified on 2011-02-08 16:40 by Administrator

1. Introduction

This document provides guidelines for producing and consuming web services among companies in the agriculture industry. It includes a sample Web Services Description Language (WSDL) document that is designed to support business document exchange (in contrast to fine-grained operation invocations.)

2. Key Words Used to Indicate Requirement Levels

Key words used to indicate requirements levels are defined at

Per the reference:

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

2.1 Transport and Security Protocols

HTTPS MUST be used for all Web service interactions. The Web Services Security: UsernameToken Profile 1.1 OASIS Standard Specification, 1 February 2006 must be used for identity and authentication. It may be found at

The WS-I Basic Security Profile 1.1 provides examples that may be useful to implementers. It is available at

The following WSDL will serve as the basis for discussion throughout the remainder of this document.

2.2 Sample WSDL with Parameters

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="AgGatewayDocumentExchange" targetNamespace="urn:aggateway:names:ws:docexchange"
  xmlns:xsd="" xmlns:tns="urn:aggateway:names:ws:docexchange"
  xmlns:wsdl="" xmlns:soap=""
  <wsp:UsingPolicy xmlns:n1="" n1:Required="false"/>
    <xsd:schema xmlns="urn:aggateway:names:ws:docexchange"
      xmlns:tns="urn:aggateway:names:ws:docexchange" attributeFormDefault="unqualified"
      elementFormDefault="qualified" targetNamespace="urn:aggateway:names:ws:docexchange">
      <xsd:element name="inboundData" type="inboundData"/>
      <xsd:complexType name="inboundData">
          <!-- Identifies the business process -->
          <xsd:element minOccurs="0" name="businessProcess" type="aggatewayToken"/>
          <!-- Identifies the business process step -->
          <xsd:element minOccurs="0" name="processStep" type="aggatewayToken"/>
          <!-- Identifies the client -->
          <xsd:element minOccurs="0" name="partnerId" type="aggatewayToken"/>
          <!-- The partner Id qualifier. -->
          <xsd:element minOccurs="0" name="partnerType" type="aggatewayToken"/>
          <!-- Identifies the business process instance -->
          <xsd:element minOccurs="0" name="conversationId" type="aggatewayToken"/>
          <!-- Identifies the message (must be globally unique) -->
          <xsd:element minOccurs="0" name="messageId" type="aggatewayToken"/>
          <!-- The business document provided as the request -->
          <xsd:element minOccurs="1" name="xmlPayload" type="xmlPayload"/>
      <xsd:element name="outboundData" type="outboundData"/>
      <xsd:complexType name="outboundData">
          <!-- Identifies the business process step -->
          <xsd:element minOccurs="0" name="processStep" type="aggatewayToken"/>
          <!-- Identifies the message (must be globally unique) -->
          <xsd:element minOccurs="0" name="messageId" type="aggatewayToken"/>
          <!-- The business document provided as the response -->
          <xsd:element minOccurs="0" name="xmlPayload" type="xmlPayload" maxOccurs="unbounded"/>
      <xsd:simpleType name="aggatewayToken">
        <xsd:restriction base="xsd:token">
          <xsd:pattern value="[a-zA-Z0-9_\-:\.]{0,128}"/>
      <xsd:complexType name="xmlPayload">
          <xsd:any namespace="##any" processContents="lax"/>
  <message name="DocExchangeInput">
    <part name="parameters" element="tns:inboundData"/>
  <message name="DocExchangeOutput">
    <part name="result" type="tns:outboundData"/>
  <message name="DocExchangeFault">
    <part name="problem" type="xsd:string"/>
  <portType name="DocExchangePortType">
    <operation name="execute">
      <input message="tns:DocExchangeInput"/>
      <output message="tns:DocExchangeOutput"/>
      <fault name="DocExchangeProblem" message="tns:DocExchangeFault"/>
  <binding name="DocExchangeBinding" type="tns:DocExchangePortType">
    <soap:binding style="document" transport=""/>
    <operation name="execute">
      <soap:operation soapAction="execute"/>
        <soap:body use="literal"/>
          <wsp:PolicyReference URI="policy:userNameTokenPolicy"/>
        <soap:body use="literal"/>
      <fault name="DocExchangeProblem">
        <soap:fault name="DocExchangeProblem" use="literal"/>
  <service name="AgGatewayDocumentExchange">
    <port name="AgGatewayDocumentExchangePort" binding="tns:DocExchangeBinding">
      <soap:address location=""/>

2.3 Definitions

For the purposes of discussion in this specification, the following terms are defined:

AUBTP: is an acronym for agreed upon by trading partners. This refers to two or more trading partners agreeing to a more specific use of some aspect of an eBusiness standard or guideline—an aspect that, by definition, would be more generically defined.

client: a trading partner invoking a web service

metadata elements: refers to all child elements of the inboundData and outboundData elements other than the xmlPayload element, which includes the following elements: businessProcess, processStep, partnerId, partnerType, conversationId, and messageId.

protocol: the supported values, semantics, and usage patterns of the metadata elements AUBTP

request: an HTTPS request

response: an HTTPS response to a request or where a ppropriate a TechnicalAck.

service provider: a trading partner providing web services

TechnicalAck: a message sent back to the client to acknowledge the receipt of a request.

2.4 Specification for AgGateway Services

The AgGateway WSDL metadata elements are intended to support a messaging architecture where the routing/transport responsibilities may be separated from the business processing responsibilities. This enables a message to be routed without inspecting the payload.

The supported values, semantics, and usage patterns for metadata elements are ultimately determined by trading-partner pairs engaged in eBusiness. Trading-partner pairs will often agree to use values, semantics, and usage patterns established by a group representing an industry sector (e.g., seed, feed, ornamental horticulture.)

2.5 Usage Definition of “inboundData” Elements (i.e., Request)

2.5.1 businessProcess

businessProcess identifies the business process associated with the xmlPayload element content. Multiple messages may be required to complete a particular businessProcess, in which case the processStep may be used to specify the message type. However, a processStep MAY not be defined when the business process definition contains only one process step, AUBTP. The businessProcess values defined by AgGateway MUST be defined such that there is a one-to-one identifier-to-process definition correspondence.

2.5.2 processStep

processStep identifies the business process step associated xmlPayload element content. If a processStep element is present then a businessProcess element must be present as well.

The function of some web services is simply for a client to post a message to a service provider with only success/failure indication in a response. In such situations it is RECOMMENDED that the processStep value in the response be either be a TechnicalAck or some equivalent.

2.5.3 partnerId

partnerId identifies the partner sending the request. If a partnerId element is present then a partnerType element MUST be present as well.

It is RECOMMENDED that this identify the physical sender. If a business partner were using a service bureau to send messages, for example, the partnerId would identify the service bureau rather than the business partner. For business partners handling their own communications, of course, the physical sender and the business partner would be one and the same.

2.5.4 PartnerType

partnerType indicates the partnerId identifier. The value MUST be taken from the Ag eStandards cidxListPartnerAgencyAttribute type definition.

2.5.5 conversationId

conversationId identifies an instance of a business process definition between two trading partners, which enables the trading partners to relate two or more messages to the same process instance.

Global uniqueness is NOT REQUIRED. Uniqueness requirements will be AUBTP.

2.5.6 messageId

messageId identifies a message. It must be globally unique from a business perspective. In other words, every message queued for delivery from a business perspective must have a unique identifier. Transport services may need to send a message more than one time to ensure delivery. With each attempt to send the same message, the messageId MUST remain the same.

2.6 Usage Definition of "outboundData" Elements (i.e., Response)

2.6.1 processStep

See discussion of processStep in the inboundData Elements section above.

2.6.2 messageId

See discussion of processStep in the inboundData Elements section above.

2.7 Partner Identification Issues

For any given message there are potentially at least three ways a partner may be identified:

  • WS-Security Username/Password
  • partnerId/partnerType element values
  • information expressed in the xmlPayload element content

When information may be expressed in two or more places in a message, the possibility exists that the identifiers fail to resolve to the same expected partner. Testing for such issues is NOT REQUIRED (by this specification). Furthermore, if such issues are identified, this specification does not specify how they MUST or even SHOULD be addressed.

2.7.1 Service Provider Message Processing Issues

A service provider MUST return a SOAP fault response under the following conditions:

  • The client message does not conform to the schema specified in the WSDL
  • The client message does not contain an inboundData element
  • WS-Security is required and the client fails authentication
  • WS-Security is required and the client fails authorization

A service provider MAY return a SOAP fault response under the following conditions:

  • Missing business data
  • Invalid business data
  • WS-Security is used, the
  • Internal issues at the service provider
  • Other reasons request processing failed

It is RECOMMENDED that the SOAP fault responses contain an explanation of the fault. A service provider is NOT REQUIRED to log SOAP fault responses. In some cases this may mean that the client must maintain artifacts sufficient to investigate issues.

SOAP fault responses must not contain a messageId, a processStep, or an outboundData element.

3.0 Sample Request XML – Generic Request XML Message

A more fitting section title is suggested. Is this Errata and context?

Work on the GenericDocumentRequest will continue, including refinement of the schema and specification of how the parameters should be used, so that it can be used with future services. This work, including the full GenericDocumentRequest schema, will be included in future versions of this document.

Some specifications and notes so far on this Generic Request document: Are these specifications or are they business rules implied by the document?

  1. If parameters StartDate/EndDate and DocumentReference are not sent, then the consumer would receive all documents that are queued up for that specific consumer.
  2. If parameters StartDate/EndDate OR DocumentReference are sent, then the returned list is based on the parameters whether or not the documents have been sent.

Here are some of the questions regarding the use of the GenericDocumentRequest parameters which have been identified so far:

  • What combination of parameters means to send all documents (e.g. ShipNotices or Invoices) not previously sent?
  • When StartDate/EndDate are set, does it mean to send all documents between those dates which were not previously sent, or does it mean to resend already-sent documents only, or does it mean send all whether previously sent or not?
  • If MaximumDocuments is specified, what is the ordering criteria if any (oldest first, newest first, something else)?
  • If DocumentReference is set, does the client wants that document whether it has previously received it or not? Note the particular data element in the desired document which the DocumentReference value is supposed to match must be specified for each service, e.g. for ShipNotice it should match CIDX element xxx/yyy/zzz/etc (full XPath to CIDX element). Also, is it supposed to be an exact match, or a “starts with” match?
  • When documents are sent due to StateDate/EndDate or DocumentReference being set, does this mean they are then considered already sent for purposes of the client later requesting all unsent documents?

Another area to be reviewed is the desired response when GenericDocumentRequest is used. Assuming multiple documents can be returned, should they be returned in multiple xmlPayload elements (one document per xmlPayload element), or should we define collection elements analogous to the CIDX ShipNoticeList and InvoiceList and send that in a single xmlPayload element, or can this vary depending on the specific service?

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv=""
        <!--Scenario Name plus 3 digit ID-->
        <wsse:Username>user id</wsse:Username>
        <!--Password for Test Harness-->
  <soapenv:Body xmlns:ns1="urn:aggateway:names:ws:docexchange">
        <GenericDocumentRequest Version="5.1">
              <DateTime DateTimeQualifier="On">20050523T160007Z</DateTime>
                <PartnerName>GROWMARK, Inc.</PartnerName>
                <PartnerIdentifier Agency="D-U-N-S"
                  <AddressLine>1701 Towanda Ave</AddressLine>
                <PartnerName>Big Guy</PartnerName>
                <PartnerIdentifier Agency="D-U-N-S"

3.1 Parameters in the Generic Document Request

Parameter NameElement DescriptionRequired
DocumentTypeElement should contain the value of the root tag/document being requested.Yes
DateRange – StartDate, EndDateDateRange – StartDate, EndDateNo
MaximumDocumentsMaximum number of documents the consumer wants to receive back.Yes
DocumentReferenceSpecific document ID on transaction being requested. If sent, then takes precedence over StartDate and EndDate.No


3.2 Sample web service Response XML

<env:Envelope xmlns:env=""
        <ns1:ShipNoticeList xmlns="urn:ecms:schema:shipnotice:response:1:0"
          xmlns:ecms="urn:ecms:schema:shipnotice:response:1:0" Version="1.0">
          <cidx:Header xmlns:cidx="urn:cidx:names:specification:ces:schema:all:4:0">
              <cidx:DateTime DateTimeQualifier="On"
                <cidx:PartnerName>GROWMARK INC</cidx:PartnerName>
                <cidx:PartnerIdentifier Agency="AGIIS-EBID"
                <cidx:PartnerName>LINCOLN LAND FS INC</cidx:PartnerName>
                <cidx:PartnerIdentifier Agency="AGIIS-EBID"
                    <ns2:DateTime DateTimeQualifier="On"
                  <ns2:TransportMethodCode Domain="UN-Rec-19"
                  <ns2:ReferenceInformation ReferenceType="DeliveryNoteNumber">
                    <ns2:DateTime DateTimeQualifier="On"
                      <ns2:PartnerName>LINCOLN LAND FS INC</ns2:PartnerName>
                        <ns2:PartnerIdentifier Agency="AGIIS-EBID"
                      <ns2:PartnerName>GROWMARK INC</ns2:PartnerName>
                      <ns2:PartnerIdentifier Agency="AGIIS-EBID"
                      <ns2:ProductIdentifier Agency="AGIIS-ProductID"
                      <ns2:ProductName>OPTIMIZE SOYBEAN GROWTH PROMOTER 200
                        <ns2:UnitOfMeasureCode Domain="UN-Rec-20"
  • No labels


  1. Jim, in section 2, where can RFC 2119 be found?  Is this in OASIS, or somewhere else?


    1. There's a link to the spec in the preceding sentence.